MCPcopy Create free account
hub / github.com/outerbase/studio / convertSqliteType

Function convertSqliteType

src/drivers/sqlite/sql-helper.ts:54–81  ·  view source on GitHub ↗
(
  type: string | undefined
)

Source from the content-addressed store, hash-verified

52}
53
54export 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
83export function escapeDelimitedValue(
84 value: unknown,

Callers 5

inferTypeFromHeaderMethod · 0.90
transformRawResultFunction · 0.90
transformRawResultFunction · 0.90
sql-helper.test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected