MCPcopy
hub / github.com/liyupi/sql-mother / initDB

Function initDB

src/core/sqlExecutor.ts:18–32  ·  view source on GitHub ↗
(initSql?: string)

Source from the content-addressed store, hash-verified

16 * @param initSql
17 */
18export const initDB = async (initSql?: string) => {
19 if (!SQL) {
20 SQL = await initSqlJs({
21 // Required to load the wasm binary asynchronously
22 locateFile: () => "./sql-wasm.wasm",
23 });
24 }
25 // Create a database
26 const db = new SQL.Database();
27 if (initSql) {
28 // Execute a single SQL string that contains multiple statements
29 db.run(initSql); // Run the query without returning anything
30 }
31 return db;
32};
33
34/**
35 * 执行 SQL

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected