@tursodatabase/database-common 0.1.5 → 0.2.0-pre.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,8 @@
1
+ export declare class AsyncLock {
2
+ locked: boolean;
3
+ queue: any[];
4
+ constructor();
5
+ acquire(): Promise<unknown>;
6
+ release(): void;
7
+ }
8
+ //# sourceMappingURL=async-lock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"async-lock.d.ts","sourceRoot":"","sources":["../async-lock.ts"],"names":[],"mappings":"AAAA,qBAAa,SAAS;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,GAAG,EAAE,CAAC;;IAKP,OAAO;IASb,OAAO;CAYV"}
@@ -0,0 +1,31 @@
1
+ export class AsyncLock {
2
+ locked;
3
+ queue;
4
+ constructor() {
5
+ this.locked = false;
6
+ this.queue = [];
7
+ }
8
+ async acquire() {
9
+ if (!this.locked) {
10
+ this.locked = true;
11
+ return Promise.resolve();
12
+ }
13
+ else {
14
+ const block = new Promise(resolve => { this.queue.push(resolve); });
15
+ return block;
16
+ }
17
+ }
18
+ release() {
19
+ if (this.locked == false) {
20
+ throw new Error("invalid state: lock was already unlocked");
21
+ }
22
+ const item = this.queue.shift();
23
+ if (item != null) {
24
+ this.locked = true;
25
+ item();
26
+ }
27
+ else {
28
+ this.locked = false;
29
+ }
30
+ }
31
+ }
package/dist/compat.d.ts CHANGED
@@ -3,9 +3,12 @@ import { NativeDatabase, NativeStatement } from "./types.js";
3
3
  * Database represents a connection that can prepare and execute SQL statements.
4
4
  */
5
5
  declare class Database {
6
- db: NativeDatabase;
7
- memory: boolean;
6
+ name: string;
7
+ readonly: boolean;
8
8
  open: boolean;
9
+ memory: boolean;
10
+ inTransaction: boolean;
11
+ private db;
9
12
  private _inTransaction;
10
13
  /**
11
14
  * Creates a new database connection. If the database file pointed to by `path` does not exists, it will be created.
@@ -17,7 +20,7 @@ declare class Database {
17
20
  * @param {boolean} [opts.fileMustExist=false] - If true, throws if database file does not exist.
18
21
  * @param {number} [opts.timeout=0] - Timeout duration in milliseconds for database operations. Defaults to 0 (no timeout).
19
22
  */
20
- constructor(db: NativeDatabase, opts?: any);
23
+ constructor(db: NativeDatabase);
21
24
  /**
22
25
  * Prepares a SQL statement for execution.
23
26
  *
@@ -39,9 +42,10 @@ declare class Database {
39
42
  loadExtension(path: any): void;
40
43
  maxWriteReplicationIndex(): void;
41
44
  /**
42
- * Executes a SQL statement.
45
+ * Executes the given SQL string
46
+ * Unlike prepared statements, this can execute strings that contain multiple SQL statements
43
47
  *
44
- * @param {string} sql - The SQL statement string to execute.
48
+ * @param {string} sql - The string containing SQL statements to execute
45
49
  */
46
50
  exec(sql: any): void;
47
51
  /**
@@ -64,8 +68,8 @@ declare class Database {
64
68
  */
65
69
  declare class Statement {
66
70
  stmt: NativeStatement;
67
- db: Database;
68
- constructor(stmt: NativeStatement, database: Database);
71
+ db: NativeDatabase;
72
+ constructor(stmt: NativeStatement, db: NativeDatabase);
69
73
  /**
70
74
  * Toggle raw mode.
71
75
  *
@@ -89,10 +93,10 @@ declare class Statement {
89
93
  *
90
94
  * @returns {Array} An array of column objects with name, column, table, database, and type properties.
91
95
  */
92
- columns(): string[];
96
+ columns(): import("./types.js").TableColumn[];
93
97
  get source(): void;
94
98
  get reader(): void;
95
- get database(): Database;
99
+ get database(): NativeDatabase;
96
100
  /**
97
101
  * Executes the SQL statement and returns an info object.
98
102
  */
@@ -129,6 +133,7 @@ declare class Statement {
129
133
  * @returns this - Statement with binded parameters
130
134
  */
131
135
  bind(...bindParameters: any[]): this;
136
+ close(): void;
132
137
  }
133
138
  export { Database, Statement };
134
139
  //# sourceMappingURL=compat.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"compat.d.ts","sourceRoot":"","sources":["../compat.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAgC,MAAM,YAAY,CAAC;AAyB3F;;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BAAmB,CAAC,MAAM,KAAA;IAI1B;;OAEG;IACH,KAAK;CAGN;AAED;;GAEG;AACH,cAAM,SAAS;IACb,IAAI,EAAE,eAAe,CAAC;IACtB,EAAE,EAAE,cAAc,CAAC;gBAEP,IAAI,EAAE,eAAe,EAAE,EAAE,EAAE,cAAc;IAKrD;;;;OAIG;IACH,GAAG,CAAC,GAAG,KAAA;IAKP;;;;OAIG;IACH,KAAK,CAAC,SAAS,KAAA;IAKf;;;;OAIG;IACH,YAAY,CAAC,MAAM,KAAA;IAKnB;;;;OAIG;IACH,OAAO;IAIP,IAAI,MAAM,SAET;IAED,IAAI,MAAM,SAET;IAED,IAAI,QAAQ,mBAEX;IAED;;OAEG;IACH,GAAG,CAAC,GAAG,cAAc,OAAA;;;;IA0BrB;;;;OAIG;IACH,GAAG,CAAC,GAAG,cAAc,OAAA;IAkBrB;;;;OAIG;IACF,OAAO,CAAC,GAAG,cAAc,OAAA;IAmB1B;;;;OAIG;IACH,GAAG,CAAC,GAAG,cAAc,OAAA;IAoBrB;;OAEG;IACH,SAAS;IAKT;;;;;OAKG;IACH,IAAI,CAAC,GAAG,cAAc,OAAA;IAStB,KAAK;CAGN;AAED,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAA"}
package/dist/compat.js CHANGED
@@ -20,9 +20,12 @@ function createErrorByName(name, message) {
20
20
  * Database represents a connection that can prepare and execute SQL statements.
21
21
  */
22
22
  class Database {
23
- db;
24
- memory;
23
+ name;
24
+ readonly;
25
25
  open;
26
+ memory;
27
+ inTransaction;
28
+ db;
26
29
  _inTransaction = false;
27
30
  /**
28
31
  * Creates a new database connection. If the database file pointed to by `path` does not exists, it will be created.
@@ -34,32 +37,15 @@ class Database {
34
37
  * @param {boolean} [opts.fileMustExist=false] - If true, throws if database file does not exist.
35
38
  * @param {number} [opts.timeout=0] - Timeout duration in milliseconds for database operations. Defaults to 0 (no timeout).
36
39
  */
37
- constructor(db, opts = {}) {
38
- opts.readonly = opts.readonly === undefined ? false : opts.readonly;
39
- opts.fileMustExist =
40
- opts.fileMustExist === undefined ? false : opts.fileMustExist;
41
- opts.timeout = opts.timeout === undefined ? 0 : opts.timeout;
40
+ constructor(db) {
42
41
  this.db = db;
43
- this.memory = this.db.memory;
42
+ this.db.connectSync();
44
43
  Object.defineProperties(this, {
45
- inTransaction: {
46
- get: () => this._inTransaction,
47
- },
48
- name: {
49
- get() {
50
- return db.path;
51
- },
52
- },
53
- readonly: {
54
- get() {
55
- return opts.readonly;
56
- },
57
- },
58
- open: {
59
- get() {
60
- return this.db.open;
61
- },
62
- },
44
+ name: { get: () => this.db.path },
45
+ readonly: { get: () => this.db.readonly },
46
+ open: { get: () => this.db.open },
47
+ memory: { get: () => this.db.memory },
48
+ inTransaction: { get: () => this._inTransaction },
63
49
  });
64
50
  }
65
51
  /**
@@ -68,14 +54,11 @@ class Database {
68
54
  * @param {string} sql - The SQL statement string to prepare.
69
55
  */
70
56
  prepare(sql) {
71
- if (!this.open) {
72
- throw new TypeError("The database connection is not open");
73
- }
74
57
  if (!sql) {
75
58
  throw new RangeError("The supplied SQL string contains no statements");
76
59
  }
77
60
  try {
78
- return new Statement(this.db.prepare(sql), this);
61
+ return new Statement(this.db.prepare(sql), this.db);
79
62
  }
80
63
  catch (err) {
81
64
  throw convertError(err);
@@ -129,8 +112,13 @@ class Database {
129
112
  throw new TypeError("Expected second argument to be an options object");
130
113
  const pragma = `PRAGMA ${source}`;
131
114
  const stmt = this.prepare(pragma);
132
- const results = stmt.all();
133
- return results;
115
+ try {
116
+ const results = stmt.all();
117
+ return results;
118
+ }
119
+ finally {
120
+ stmt.close();
121
+ }
134
122
  }
135
123
  backup(filename, options) {
136
124
  throw new Error("not implemented");
@@ -154,19 +142,31 @@ class Database {
154
142
  throw new Error("not implemented");
155
143
  }
156
144
  /**
157
- * Executes a SQL statement.
145
+ * Executes the given SQL string
146
+ * Unlike prepared statements, this can execute strings that contain multiple SQL statements
158
147
  *
159
- * @param {string} sql - The SQL statement string to execute.
148
+ * @param {string} sql - The string containing SQL statements to execute
160
149
  */
161
150
  exec(sql) {
162
- if (!this.open) {
163
- throw new TypeError("The database connection is not open");
164
- }
151
+ const exec = this.db.executor(sql);
165
152
  try {
166
- this.db.batchSync(sql);
153
+ while (true) {
154
+ const stepResult = exec.stepSync();
155
+ if (stepResult === STEP_IO) {
156
+ this.db.ioLoopSync();
157
+ continue;
158
+ }
159
+ if (stepResult === STEP_DONE) {
160
+ break;
161
+ }
162
+ if (stepResult === STEP_ROW) {
163
+ // For exec(), we don't need the row data, just continue
164
+ continue;
165
+ }
166
+ }
167
167
  }
168
- catch (err) {
169
- throw convertError(err);
168
+ finally {
169
+ exec.reset();
170
170
  }
171
171
  }
172
172
  /**
@@ -196,9 +196,9 @@ class Database {
196
196
  class Statement {
197
197
  stmt;
198
198
  db;
199
- constructor(stmt, database) {
199
+ constructor(stmt, db) {
200
200
  this.stmt = stmt;
201
- this.db = database;
201
+ this.db = db;
202
202
  }
203
203
  /**
204
204
  * Toggle raw mode.
@@ -248,13 +248,13 @@ class Statement {
248
248
  * Executes the SQL statement and returns an info object.
249
249
  */
250
250
  run(...bindParameters) {
251
- const totalChangesBefore = this.db.db.totalChanges();
251
+ const totalChangesBefore = this.db.totalChanges();
252
252
  this.stmt.reset();
253
253
  bindParams(this.stmt, bindParameters);
254
254
  for (;;) {
255
255
  const stepResult = this.stmt.stepSync();
256
256
  if (stepResult === STEP_IO) {
257
- this.db.db.ioLoopSync();
257
+ this.db.ioLoopSync();
258
258
  continue;
259
259
  }
260
260
  if (stepResult === STEP_DONE) {
@@ -265,8 +265,8 @@ class Statement {
265
265
  continue;
266
266
  }
267
267
  }
268
- const lastInsertRowid = this.db.db.lastInsertRowid();
269
- const changes = this.db.db.totalChanges() === totalChangesBefore ? 0 : this.db.db.changes();
268
+ const lastInsertRowid = this.db.lastInsertRowid();
269
+ const changes = this.db.totalChanges() === totalChangesBefore ? 0 : this.db.changes();
270
270
  return { changes, lastInsertRowid };
271
271
  }
272
272
  /**
@@ -280,7 +280,7 @@ class Statement {
280
280
  for (;;) {
281
281
  const stepResult = this.stmt.stepSync();
282
282
  if (stepResult === STEP_IO) {
283
- this.db.db.ioLoopSync();
283
+ this.db.ioLoopSync();
284
284
  continue;
285
285
  }
286
286
  if (stepResult === STEP_DONE) {
@@ -302,7 +302,7 @@ class Statement {
302
302
  while (true) {
303
303
  const stepResult = this.stmt.stepSync();
304
304
  if (stepResult === STEP_IO) {
305
- this.db.db.ioLoopSync();
305
+ this.db.ioLoopSync();
306
306
  continue;
307
307
  }
308
308
  if (stepResult === STEP_DONE) {
@@ -325,7 +325,7 @@ class Statement {
325
325
  for (;;) {
326
326
  const stepResult = this.stmt.stepSync();
327
327
  if (stepResult === STEP_IO) {
328
- this.db.db.ioLoopSync();
328
+ this.db.ioLoopSync();
329
329
  continue;
330
330
  }
331
331
  if (stepResult === STEP_DONE) {
@@ -358,5 +358,8 @@ class Statement {
358
358
  throw convertError(err);
359
359
  }
360
360
  }
361
+ close() {
362
+ this.stmt.finalize();
363
+ }
361
364
  }
362
365
  export { Database, Statement };
package/dist/index.d.ts CHANGED
@@ -2,5 +2,6 @@ import { NativeDatabase, NativeStatement, DatabaseOpts } from "./types.js";
2
2
  import { Database as DatabaseCompat, Statement as StatementCompat } from "./compat.js";
3
3
  import { Database as DatabasePromise, Statement as StatementPromise } from "./promise.js";
4
4
  import { SqliteError } from "./sqlite-error.js";
5
- export { DatabaseCompat, StatementCompat, DatabasePromise, StatementPromise, NativeDatabase, NativeStatement, SqliteError, DatabaseOpts };
5
+ import { AsyncLock } from "./async-lock.js";
6
+ export { DatabaseOpts, DatabaseCompat, StatementCompat, DatabasePromise, StatementPromise, NativeDatabase, NativeStatement, SqliteError, AsyncLock };
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC3E,OAAO,EAAE,QAAQ,IAAI,cAAc,EAAE,SAAS,IAAI,eAAe,EAAE,MAAM,aAAa,CAAC;AACvF,OAAO,EAAE,QAAQ,IAAI,eAAe,EAAE,SAAS,IAAI,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC1F,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,eAAe,EAAE,gBAAgB,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,YAAY,EAAE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC3E,OAAO,EAAE,QAAQ,IAAI,cAAc,EAAE,SAAS,IAAI,eAAe,EAAE,MAAM,aAAa,CAAC;AACvF,OAAO,EAAE,QAAQ,IAAI,eAAe,EAAE,SAAS,IAAI,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC1F,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EACH,YAAY,EACZ,cAAc,EAAE,eAAe,EAC/B,eAAe,EAAE,gBAAgB,EACjC,cAAc,EAAE,eAAe,EAC/B,WAAW,EACX,SAAS,EACZ,CAAA"}
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Database as DatabaseCompat, Statement as StatementCompat } from "./compat.js";
2
2
  import { Database as DatabasePromise, Statement as StatementPromise } from "./promise.js";
3
3
  import { SqliteError } from "./sqlite-error.js";
4
- export { DatabaseCompat, StatementCompat, DatabasePromise, StatementPromise, SqliteError };
4
+ import { AsyncLock } from "./async-lock.js";
5
+ export { DatabaseCompat, StatementCompat, DatabasePromise, StatementPromise, SqliteError, AsyncLock };
package/dist/promise.d.ts CHANGED
@@ -1,25 +1,22 @@
1
- import { NativeDatabase, NativeStatement, DatabaseOpts } from "./types.js";
1
+ import { AsyncLock } from "./async-lock.js";
2
+ import { NativeDatabase, NativeStatement } from "./types.js";
2
3
  /**
3
4
  * Database represents a connection that can prepare and execute SQL statements.
4
5
  */
5
6
  declare class Database {
6
- db: NativeDatabase;
7
- memory: boolean;
7
+ name: string;
8
+ readonly: boolean;
8
9
  open: boolean;
10
+ memory: boolean;
11
+ inTransaction: boolean;
12
+ private db;
13
+ private execLock;
9
14
  private _inTransaction;
15
+ constructor(db: NativeDatabase);
10
16
  /**
11
- * Creates a new database connection. If the database file pointed to by `path` does not exists, it will be created.
12
- *
13
- * @constructor
14
- * @param {string} path - Path to the database file.
15
- * @param {Object} opts - Options for database behavior.
16
- * @param {boolean} [opts.readonly=false] - Open the database in read-only mode.
17
- * @param {boolean} [opts.fileMustExist=false] - If true, throws if database file does not exist.
18
- * @param {number} [opts.timeout=0] - Timeout duration in milliseconds for database operations. Defaults to 0 (no timeout).
17
+ * connect database
19
18
  */
20
- constructor(db: NativeDatabase, opts?: DatabaseOpts);
21
- static create(): any;
22
- initialize(db: NativeDatabase, name: any, readonly: any): void;
19
+ connect(): Promise<void>;
23
20
  /**
24
21
  * Prepares a SQL statement for execution.
25
22
  *
@@ -41,9 +38,10 @@ declare class Database {
41
38
  loadExtension(path: any): void;
42
39
  maxWriteReplicationIndex(): void;
43
40
  /**
44
- * Executes a SQL statement.
41
+ * Executes the given SQL string
42
+ * Unlike prepared statements, this can execute strings that contain multiple SQL statements
45
43
  *
46
- * @param {string} sql - The SQL statement string to execute.
44
+ * @param {string} sql - The string containing SQL statements to execute
47
45
  */
48
46
  exec(sql: any): Promise<void>;
49
47
  /**
@@ -65,9 +63,10 @@ declare class Database {
65
63
  * Statement represents a prepared SQL statement that can be executed.
66
64
  */
67
65
  declare class Statement {
68
- stmt: NativeStatement;
69
- db: Database;
70
- constructor(stmt: any, database: any);
66
+ private stmt;
67
+ private db;
68
+ private execLock;
69
+ constructor(stmt: NativeStatement, db: NativeDatabase, execLock: AsyncLock);
71
70
  /**
72
71
  * Toggle raw mode.
73
72
  *
@@ -91,10 +90,10 @@ declare class Statement {
91
90
  *
92
91
  * @returns {Array} An array of column objects with name, column, table, database, and type properties.
93
92
  */
94
- columns(): string[];
93
+ columns(): import("./types.js").TableColumn[];
95
94
  get source(): void;
96
95
  get reader(): void;
97
- get database(): Database;
96
+ get database(): NativeDatabase;
98
97
  /**
99
98
  * Executes the SQL statement and returns an info object.
100
99
  */
@@ -1 +1 @@
1
- {"version":3,"file":"promise.d.ts","sourceRoot":"","sources":["../promise.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAgC,YAAY,EAAE,MAAM,YAAY,CAAC;AAyBzG;;GAEG;AACH,cAAM,QAAQ;IACZ,EAAE,EAAE,cAAc,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,cAAc,CAAkB;IACxC;;;;;;;;;OASG;gBACS,EAAE,EAAE,cAAc,EAAE,IAAI,GAAE,YAAiB;IAQvD,MAAM,CAAC,MAAM;IAGb,UAAU,CAAC,EAAE,EAAE,cAAc,EAAE,IAAI,KAAA,EAAE,QAAQ,KAAA;IAyB7C;;;;OAIG;IACH,OAAO,CAAC,GAAG,KAAA;IAgBX;;;;OAIG;IACH,WAAW,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,OAAA,KAAK,OAAO,CAAC,GAAG,CAAC;IAmClC,MAAM,CAAC,MAAM,KAAA,EAAE,OAAO,KAAA;IAiB5B,MAAM,CAAC,QAAQ,KAAA,EAAE,OAAO,KAAA;IAIxB,SAAS,CAAC,OAAO,KAAA;IAIjB,QAAQ,CAAC,IAAI,KAAA,EAAE,OAAO,KAAA,EAAE,EAAE,KAAA;IAI1B,SAAS,CAAC,IAAI,KAAA,EAAE,OAAO,KAAA;IAIvB,KAAK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IAAI,MAAM,SAET;IAED,IAAI,MAAM,SAET;IAED,IAAI,QAAQ,mBAEX;IAED;;OAEG;IACG,GAAG,CAAC,GAAG,cAAc,OAAA;;;;IAgC3B;;;;OAIG;IACG,GAAG,CAAC,GAAG,cAAc,OAAA;IAwB3B;;;;OAIG;IACI,OAAO,CAAC,GAAG,cAAc,OAAA;IAwBhC;;;;OAIG;IACG,GAAG,CAAC,GAAG,cAAc,OAAA;IA2B3B;;OAEG;IACH,SAAS;IAKT;;;;;OAKG;IACH,IAAI,CAAC,GAAG,cAAc,OAAA;IAStB,KAAK;CAGN;AAED,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAA"}
package/dist/promise.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { AsyncLock } from "./async-lock.js";
1
2
  import { bindParams } from "./bind.js";
2
3
  import { SqliteError } from "./sqlite-error.js";
3
4
  import { STEP_IO, STEP_ROW, STEP_DONE } from "./types.js";
@@ -20,68 +21,42 @@ function createErrorByName(name, message) {
20
21
  * Database represents a connection that can prepare and execute SQL statements.
21
22
  */
22
23
  class Database {
23
- db;
24
- memory;
24
+ name;
25
+ readonly;
25
26
  open;
27
+ memory;
28
+ inTransaction;
29
+ db;
30
+ execLock;
26
31
  _inTransaction = false;
27
- /**
28
- * Creates a new database connection. If the database file pointed to by `path` does not exists, it will be created.
29
- *
30
- * @constructor
31
- * @param {string} path - Path to the database file.
32
- * @param {Object} opts - Options for database behavior.
33
- * @param {boolean} [opts.readonly=false] - Open the database in read-only mode.
34
- * @param {boolean} [opts.fileMustExist=false] - If true, throws if database file does not exist.
35
- * @param {number} [opts.timeout=0] - Timeout duration in milliseconds for database operations. Defaults to 0 (no timeout).
36
- */
37
- constructor(db, opts = {}) {
38
- opts.readonly = opts.readonly === undefined ? false : opts.readonly;
39
- opts.fileMustExist =
40
- opts.fileMustExist === undefined ? false : opts.fileMustExist;
41
- opts.timeout = opts.timeout === undefined ? 0 : opts.timeout;
42
- this.initialize(db, opts.name, opts.readonly);
43
- }
44
- static create() {
45
- return Object.create(this.prototype);
46
- }
47
- initialize(db, name, readonly) {
32
+ constructor(db) {
48
33
  this.db = db;
49
- this.memory = db.memory;
34
+ this.execLock = new AsyncLock();
50
35
  Object.defineProperties(this, {
51
- inTransaction: {
52
- get: () => this._inTransaction,
53
- },
54
- name: {
55
- get() {
56
- return name;
57
- },
58
- },
59
- readonly: {
60
- get() {
61
- return readonly;
62
- },
63
- },
64
- open: {
65
- get() {
66
- return this.db.open;
67
- },
68
- },
36
+ name: { get: () => this.db.path },
37
+ readonly: { get: () => this.db.readonly },
38
+ open: { get: () => this.db.open },
39
+ memory: { get: () => this.db.memory },
40
+ inTransaction: { get: () => this._inTransaction },
69
41
  });
70
42
  }
43
+ /**
44
+ * connect database
45
+ */
46
+ async connect() {
47
+ await this.db.connectAsync();
48
+ }
71
49
  /**
72
50
  * Prepares a SQL statement for execution.
73
51
  *
74
52
  * @param {string} sql - The SQL statement string to prepare.
75
53
  */
76
54
  prepare(sql) {
77
- if (!this.open) {
78
- throw new TypeError("The database connection is not open");
79
- }
80
55
  if (!sql) {
81
56
  throw new RangeError("The supplied SQL string contains no statements");
82
57
  }
83
58
  try {
84
- return new Statement(this.db.prepare(sql), this);
59
+ return new Statement(this.db.prepare(sql), this.db, this.execLock);
85
60
  }
86
61
  catch (err) {
87
62
  throw convertError(err);
@@ -134,9 +109,14 @@ class Database {
134
109
  if (typeof options !== "object")
135
110
  throw new TypeError("Expected second argument to be an options object");
136
111
  const pragma = `PRAGMA ${source}`;
137
- const stmt = await this.prepare(pragma);
138
- const results = await stmt.all();
139
- return results;
112
+ const stmt = this.prepare(pragma);
113
+ try {
114
+ const results = await stmt.all();
115
+ return results;
116
+ }
117
+ finally {
118
+ await stmt.close();
119
+ }
140
120
  }
141
121
  backup(filename, options) {
142
122
  throw new Error("not implemented");
@@ -160,19 +140,33 @@ class Database {
160
140
  throw new Error("not implemented");
161
141
  }
162
142
  /**
163
- * Executes a SQL statement.
143
+ * Executes the given SQL string
144
+ * Unlike prepared statements, this can execute strings that contain multiple SQL statements
164
145
  *
165
- * @param {string} sql - The SQL statement string to execute.
146
+ * @param {string} sql - The string containing SQL statements to execute
166
147
  */
167
148
  async exec(sql) {
168
- if (!this.open) {
169
- throw new TypeError("The database connection is not open");
170
- }
149
+ await this.execLock.acquire();
150
+ const exec = this.db.executor(sql);
171
151
  try {
172
- await this.db.batchAsync(sql);
152
+ while (true) {
153
+ const stepResult = exec.stepSync();
154
+ if (stepResult === STEP_IO) {
155
+ await this.db.ioLoopAsync();
156
+ continue;
157
+ }
158
+ if (stepResult === STEP_DONE) {
159
+ break;
160
+ }
161
+ if (stepResult === STEP_ROW) {
162
+ // For exec(), we don't need the row data, just continue
163
+ continue;
164
+ }
165
+ }
173
166
  }
174
- catch (err) {
175
- throw convertError(err);
167
+ finally {
168
+ exec.reset();
169
+ this.execLock.release();
176
170
  }
177
171
  }
178
172
  /**
@@ -202,9 +196,11 @@ class Database {
202
196
  class Statement {
203
197
  stmt;
204
198
  db;
205
- constructor(stmt, database) {
199
+ execLock;
200
+ constructor(stmt, db, execLock) {
206
201
  this.stmt = stmt;
207
- this.db = database;
202
+ this.db = db;
203
+ this.execLock = execLock;
208
204
  }
209
205
  /**
210
206
  * Toggle raw mode.
@@ -254,26 +250,32 @@ class Statement {
254
250
  * Executes the SQL statement and returns an info object.
255
251
  */
256
252
  async run(...bindParameters) {
257
- const totalChangesBefore = this.db.db.totalChanges();
253
+ const totalChangesBefore = this.db.totalChanges();
258
254
  this.stmt.reset();
259
255
  bindParams(this.stmt, bindParameters);
260
- while (true) {
261
- const stepResult = await this.stmt.stepAsync();
262
- if (stepResult === STEP_IO) {
263
- await this.db.db.ioLoopAsync();
264
- continue;
265
- }
266
- if (stepResult === STEP_DONE) {
267
- break;
268
- }
269
- if (stepResult === STEP_ROW) {
270
- // For run(), we don't need the row data, just continue
271
- continue;
256
+ await this.execLock.acquire();
257
+ try {
258
+ while (true) {
259
+ const stepResult = await this.stmt.stepSync();
260
+ if (stepResult === STEP_IO) {
261
+ await this.db.ioLoopAsync();
262
+ continue;
263
+ }
264
+ if (stepResult === STEP_DONE) {
265
+ break;
266
+ }
267
+ if (stepResult === STEP_ROW) {
268
+ // For run(), we don't need the row data, just continue
269
+ continue;
270
+ }
272
271
  }
272
+ const lastInsertRowid = this.db.lastInsertRowid();
273
+ const changes = this.db.totalChanges() === totalChangesBefore ? 0 : this.db.changes();
274
+ return { changes, lastInsertRowid };
275
+ }
276
+ finally {
277
+ this.execLock.release();
273
278
  }
274
- const lastInsertRowid = this.db.db.lastInsertRowid();
275
- const changes = this.db.db.totalChanges() === totalChangesBefore ? 0 : this.db.db.changes();
276
- return { changes, lastInsertRowid };
277
279
  }
278
280
  /**
279
281
  * Executes the SQL statement and returns the first row.
@@ -283,19 +285,25 @@ class Statement {
283
285
  async get(...bindParameters) {
284
286
  this.stmt.reset();
285
287
  bindParams(this.stmt, bindParameters);
286
- while (true) {
287
- const stepResult = await this.stmt.stepAsync();
288
- if (stepResult === STEP_IO) {
289
- await this.db.db.ioLoopAsync();
290
- continue;
291
- }
292
- if (stepResult === STEP_DONE) {
293
- return undefined;
294
- }
295
- if (stepResult === STEP_ROW) {
296
- return this.stmt.row();
288
+ await this.execLock.acquire();
289
+ try {
290
+ while (true) {
291
+ const stepResult = await this.stmt.stepSync();
292
+ if (stepResult === STEP_IO) {
293
+ await this.db.ioLoopAsync();
294
+ continue;
295
+ }
296
+ if (stepResult === STEP_DONE) {
297
+ return undefined;
298
+ }
299
+ if (stepResult === STEP_ROW) {
300
+ return this.stmt.row();
301
+ }
297
302
  }
298
303
  }
304
+ finally {
305
+ this.execLock.release();
306
+ }
299
307
  }
300
308
  /**
301
309
  * Executes the SQL statement and returns an iterator to the resulting rows.
@@ -305,19 +313,25 @@ class Statement {
305
313
  async *iterate(...bindParameters) {
306
314
  this.stmt.reset();
307
315
  bindParams(this.stmt, bindParameters);
308
- while (true) {
309
- const stepResult = await this.stmt.stepAsync();
310
- if (stepResult === STEP_IO) {
311
- await this.db.db.ioLoopAsync();
312
- continue;
313
- }
314
- if (stepResult === STEP_DONE) {
315
- break;
316
- }
317
- if (stepResult === STEP_ROW) {
318
- yield this.stmt.row();
316
+ await this.execLock.acquire();
317
+ try {
318
+ while (true) {
319
+ const stepResult = await this.stmt.stepSync();
320
+ if (stepResult === STEP_IO) {
321
+ await this.db.ioLoopAsync();
322
+ continue;
323
+ }
324
+ if (stepResult === STEP_DONE) {
325
+ break;
326
+ }
327
+ if (stepResult === STEP_ROW) {
328
+ yield this.stmt.row();
329
+ }
319
330
  }
320
331
  }
332
+ finally {
333
+ this.execLock.release();
334
+ }
321
335
  }
322
336
  /**
323
337
  * Executes the SQL statement and returns an array of the resulting rows.
@@ -328,20 +342,26 @@ class Statement {
328
342
  this.stmt.reset();
329
343
  bindParams(this.stmt, bindParameters);
330
344
  const rows = [];
331
- while (true) {
332
- const stepResult = await this.stmt.stepAsync();
333
- if (stepResult === STEP_IO) {
334
- await this.db.db.ioLoopAsync();
335
- continue;
336
- }
337
- if (stepResult === STEP_DONE) {
338
- break;
339
- }
340
- if (stepResult === STEP_ROW) {
341
- rows.push(this.stmt.row());
345
+ await this.execLock.acquire();
346
+ try {
347
+ while (true) {
348
+ const stepResult = await this.stmt.stepSync();
349
+ if (stepResult === STEP_IO) {
350
+ await this.db.ioLoopAsync();
351
+ continue;
352
+ }
353
+ if (stepResult === STEP_DONE) {
354
+ break;
355
+ }
356
+ if (stepResult === STEP_ROW) {
357
+ rows.push(this.stmt.row());
358
+ }
342
359
  }
360
+ return rows;
361
+ }
362
+ finally {
363
+ this.execLock.release();
343
364
  }
344
- return rows;
345
365
  }
346
366
  /**
347
367
  * Interrupts the statement.
package/dist/types.d.ts CHANGED
@@ -2,19 +2,20 @@ export interface DatabaseOpts {
2
2
  readonly?: boolean;
3
3
  fileMustExist?: boolean;
4
4
  timeout?: number;
5
- name?: string;
6
5
  tracing?: 'info' | 'debug' | 'trace';
7
6
  }
8
7
  export interface NativeDatabase {
9
8
  memory: boolean;
10
9
  path: string;
10
+ readonly: boolean;
11
+ open: boolean;
11
12
  new (path: string): NativeDatabase;
12
- batchSync(sql: string): any;
13
- batchAsync(sql: string): Promise<void>;
13
+ connectSync(): any;
14
+ connectAsync(): Promise<void>;
14
15
  ioLoopSync(): any;
15
16
  ioLoopAsync(): Promise<void>;
16
17
  prepare(sql: string): NativeStatement;
17
- pluck(pluckMode: boolean): any;
18
+ executor(sql: string): NativeExecutor;
18
19
  defaultSafeIntegers(toggle: boolean): any;
19
20
  totalChanges(): number;
20
21
  changes(): number;
@@ -24,13 +25,21 @@ export interface NativeDatabase {
24
25
  export declare const STEP_ROW = 1;
25
26
  export declare const STEP_DONE = 2;
26
27
  export declare const STEP_IO = 3;
28
+ export interface TableColumn {
29
+ name: string;
30
+ type: string;
31
+ }
32
+ export interface NativeExecutor {
33
+ stepSync(): number;
34
+ reset(): any;
35
+ }
27
36
  export interface NativeStatement {
28
37
  stepAsync(): Promise<number>;
29
38
  stepSync(): number;
30
39
  pluck(pluckMode: boolean): any;
31
40
  safeIntegers(toggle: boolean): any;
32
41
  raw(toggle: boolean): any;
33
- columns(): string[];
42
+ columns(): TableColumn[];
34
43
  row(): any;
35
44
  reset(): any;
36
45
  finalize(): any;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,CAAA;CACvC;AAED,MAAM,WAAW,cAAc;IAC3B,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,KAAI,IAAI,EAAE,MAAM,GAAG,cAAc,CAAC;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"0.2.0-pre.10",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/tursodatabase/turso"