( type: string | undefined )
| 52 | } |
| 53 | |
| 54 | export function convertSqliteType( |
| 55 | type: string | undefined |
| 56 | ): ColumnType | undefined { |
| 57 | // https://www.sqlite.org/datatype3.html |
| 58 | if (type === "") return undefined; |
| 59 | if (type === undefined) return ColumnType.BLOB; |
| 60 | |
| 61 | type = type.toUpperCase(); |
| 62 | |
| 63 | if (type.includes("CHAR")) return ColumnType.TEXT; |
| 64 | if (type.includes("TEXT")) return ColumnType.TEXT; |
| 65 | if (type.includes("CLOB")) return ColumnType.TEXT; |
| 66 | if (type.includes("STRING")) return ColumnType.TEXT; |
| 67 | |
| 68 | if (type.includes("INT")) return ColumnType.INTEGER; |
| 69 | if (type.includes("NUMBER")) return ColumnType.INTEGER; |
| 70 | |
| 71 | if (type.includes("BLOB")) return ColumnType.BLOB; |
| 72 | |
| 73 | if ( |
| 74 | type.includes("REAL") || |
| 75 | type.includes("DOUBLE") || |
| 76 | type.includes("FLOAT") |
| 77 | ) |
| 78 | return ColumnType.REAL; |
| 79 | |
| 80 | return ColumnType.TEXT; |
| 81 | } |
| 82 | |
| 83 | export function escapeDelimitedValue( |
| 84 | value: unknown, |
no outgoing calls
no test coverage detected