| 173 | } // namespace |
| 174 | |
| 175 | arrow::Result<std::shared_ptr<DataType>> GetArrowType(const char* sqlite_type) { |
| 176 | if (sqlite_type == nullptr || std::strlen(sqlite_type) == 0) { |
| 177 | // SQLite may not know the column type yet. |
| 178 | return null(); |
| 179 | } |
| 180 | |
| 181 | if (arrow::internal::AsciiEqualsCaseInsensitive(sqlite_type, "int") || |
| 182 | arrow::internal::AsciiEqualsCaseInsensitive(sqlite_type, "integer")) { |
| 183 | return int64(); |
| 184 | } else if (arrow::internal::AsciiEqualsCaseInsensitive(sqlite_type, "REAL")) { |
| 185 | return float64(); |
| 186 | } else if (arrow::internal::AsciiEqualsCaseInsensitive(sqlite_type, "BLOB")) { |
| 187 | return binary(); |
| 188 | } else if (arrow::internal::AsciiEqualsCaseInsensitive(sqlite_type, "TEXT") || |
| 189 | arrow::internal::AsciiEqualsCaseInsensitive(sqlite_type, "DATE") || |
| 190 | AsciiStartsWithCaseInsensitive(sqlite_type, "char") || |
| 191 | AsciiStartsWithCaseInsensitive(sqlite_type, "varchar")) { |
| 192 | return utf8(); |
| 193 | } |
| 194 | return Status::Invalid("Invalid SQLite type: ", sqlite_type); |
| 195 | } |
| 196 | |
| 197 | int32_t GetSqlTypeFromTypeName(const char* sqlite_type) { |
| 198 | if (sqlite_type == NULLPTR) { |
no test coverage detected