MCPcopy
hub / github.com/AlaSQL/alasql / Database

Class Database

src/database/Database.js:5–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3 * Represents a database instance with tables, views, indices, and triggers
4 */
5export class Database {
6 constructor(databaseid) {
7 this.databaseid = databaseid;
8 this.dbversion = 0;
9 this.tables = {};
10 this.views = {};
11 this.triggers = {};
12 this.indices = {};
13 this.objects = {};
14 this.counter = 0;
15 this.sqlCache = {};
16 this.sqlCacheSize = 0;
17 this.astCache = {};
18 }
19
20 /**
21 * Reset SQL statements cache
22 */
23 resetSqlCache() {
24 this.sqlCache = {};
25 this.sqlCacheSize = 0;
26 this.astCache = {};
27 }
28
29 /**
30 * Run SQL statement on database
31 * This is a placeholder - gets wired up in registerDatabase
32 * @param {string} sql - SQL statement
33 * @param {object} params - Parameters
34 * @param {function} cb - Callback
35 */
36 exec(sql, params, cb) {
37 throw new Error('Database.exec not initialized - call registerDatabase first');
38 }
39
40 /**
41 * Get/set auto-increment value
42 * This is a placeholder - gets wired up in registerDatabase
43 */
44 autoval(tablename, colname, getNext) {
45 throw new Error('Database.autoval not initialized - call registerDatabase first');
46 }
47
48 /**
49 * Create a transaction
50 * This is a placeholder - gets wired up in registerDatabase
51 */
52 transaction(cb) {
53 throw new Error('Database.transaction not initialized - call registerDatabase first');
54 }
55}
56
57/**
58 * Register Database class with alasql instance

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…