MCPcopy Index your code
hub / github.com/outerbase/studio / SqliteLikeBaseDriver

Class SqliteLikeBaseDriver

src/drivers/sqlite-base-driver.ts:29–387  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27import generateSqlSchemaChange from "./sqlite/sqlite-generate-schema";
28
29export class SqliteLikeBaseDriver extends CommonSQLImplement {
30 protected supportPragmaList = false;
31 protected supportBigInt = false;
32
33 constructor(
34 protected _db: QueryableBaseDriver,
35 protected options?: {
36 supportPragmaList?: boolean;
37 supportBigInt?: boolean;
38 }
39 ) {
40 super();
41 this.supportPragmaList = options?.supportPragmaList ?? false;
42 this.supportBigInt = options?.supportBigInt ?? false;
43 }
44
45 query(stmt: string): Promise<DatabaseResultSet> {
46 return this._db.query(stmt);
47 }
48
49 transaction(stmts: string[]): Promise<DatabaseResultSet[]> {
50 return this._db.transaction(stmts);
51 }
52
53 batch(stmts: string[]): Promise<DatabaseResultSet[]> {
54 return this._db.batch ? this._db.batch(stmts) : super.batch(stmts);
55 }
56
57 columnTypeSelector: ColumnTypeSelector = {
58 type: "dropdown",
59 dropdownNormalized: (typeName: string): string => {
60 const type = convertSqliteType(typeName);
61 if (type === undefined) return "TEXT";
62 if (type === ColumnType.INTEGER) return "INTEGER";
63 if (type === ColumnType.REAL) return "REAL";
64 if (type === ColumnType.BLOB) return "BLOB";
65 return "TEXT";
66 },
67 dropdownOptions: [
68 { text: "Integer", value: "INTEGER" },
69 { text: "Real", value: "REAL" },
70 { text: "Text", value: "TEXT" },
71 { text: "Blob", value: "BLOB" },
72 ],
73 };
74
75 escapeId(id: string) {
76 return `"${id.replace(/"/g, '""')}"`;
77 }
78
79 escapeValue(value: unknown): string {
80 return escapeSqlValue(value);
81 }
82
83 getFlags(): DriverFlags {
84 return {
85 supportRowId: true,
86 supportBigInt: this.supportBigInt,

Callers

nothing calls this directly

Calls 1

convertSqliteTypeFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…