@itwin/core-backend 5.8.0-dev.5 → 5.8.0-dev.6

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.
Files changed (67) hide show
  1. package/lib/cjs/ECDb.d.ts +26 -0
  2. package/lib/cjs/ECDb.d.ts.map +1 -1
  3. package/lib/cjs/ECDb.js +53 -2
  4. package/lib/cjs/ECDb.js.map +1 -1
  5. package/lib/cjs/ECSqlRowExecutor.d.ts +66 -0
  6. package/lib/cjs/ECSqlRowExecutor.d.ts.map +1 -0
  7. package/lib/cjs/ECSqlRowExecutor.js +135 -0
  8. package/lib/cjs/ECSqlRowExecutor.js.map +1 -0
  9. package/lib/cjs/ECSqlStatement.d.ts +13 -1
  10. package/lib/cjs/ECSqlStatement.d.ts.map +1 -1
  11. package/lib/cjs/ECSqlStatement.js +30 -0
  12. package/lib/cjs/ECSqlStatement.js.map +1 -1
  13. package/lib/cjs/ECSqlSyncReader.d.ts +104 -0
  14. package/lib/cjs/ECSqlSyncReader.d.ts.map +1 -0
  15. package/lib/cjs/ECSqlSyncReader.js +191 -0
  16. package/lib/cjs/ECSqlSyncReader.js.map +1 -0
  17. package/lib/cjs/IModelDb.d.ts +18 -0
  18. package/lib/cjs/IModelDb.d.ts.map +1 -1
  19. package/lib/cjs/IModelDb.js +39 -0
  20. package/lib/cjs/IModelDb.js.map +1 -1
  21. package/lib/cjs/core-backend.d.ts +1 -0
  22. package/lib/cjs/core-backend.d.ts.map +1 -1
  23. package/lib/cjs/core-backend.js +1 -0
  24. package/lib/cjs/core-backend.js.map +1 -1
  25. package/lib/esm/ECDb.d.ts +26 -0
  26. package/lib/esm/ECDb.d.ts.map +1 -1
  27. package/lib/esm/ECDb.js +54 -3
  28. package/lib/esm/ECDb.js.map +1 -1
  29. package/lib/esm/ECSqlRowExecutor.d.ts +66 -0
  30. package/lib/esm/ECSqlRowExecutor.d.ts.map +1 -0
  31. package/lib/esm/ECSqlRowExecutor.js +131 -0
  32. package/lib/esm/ECSqlRowExecutor.js.map +1 -0
  33. package/lib/esm/ECSqlStatement.d.ts +13 -1
  34. package/lib/esm/ECSqlStatement.d.ts.map +1 -1
  35. package/lib/esm/ECSqlStatement.js +30 -0
  36. package/lib/esm/ECSqlStatement.js.map +1 -1
  37. package/lib/esm/ECSqlSyncReader.d.ts +104 -0
  38. package/lib/esm/ECSqlSyncReader.d.ts.map +1 -0
  39. package/lib/esm/ECSqlSyncReader.js +187 -0
  40. package/lib/esm/ECSqlSyncReader.js.map +1 -0
  41. package/lib/esm/IModelDb.d.ts +18 -0
  42. package/lib/esm/IModelDb.d.ts.map +1 -1
  43. package/lib/esm/IModelDb.js +39 -0
  44. package/lib/esm/IModelDb.js.map +1 -1
  45. package/lib/esm/core-backend.d.ts +1 -0
  46. package/lib/esm/core-backend.d.ts.map +1 -1
  47. package/lib/esm/core-backend.js +1 -0
  48. package/lib/esm/core-backend.js.map +1 -1
  49. package/lib/esm/test/ecdb/ECSqlSyncReader.test.d.ts +2 -0
  50. package/lib/esm/test/ecdb/ECSqlSyncReader.test.d.ts.map +1 -0
  51. package/lib/esm/test/ecdb/ECSqlSyncReader.test.js +122 -0
  52. package/lib/esm/test/ecdb/ECSqlSyncReader.test.js.map +1 -0
  53. package/lib/esm/test/ecdb/QueryReaders.test.d.ts +2 -0
  54. package/lib/esm/test/ecdb/QueryReaders.test.d.ts.map +1 -0
  55. package/lib/esm/test/ecdb/QueryReaders.test.js +1421 -0
  56. package/lib/esm/test/ecdb/QueryReaders.test.js.map +1 -0
  57. package/lib/esm/test/ecsql/src/ECSqlTestParser.d.ts +1 -1
  58. package/lib/esm/test/ecsql/src/ECSqlTestParser.d.ts.map +1 -1
  59. package/lib/esm/test/ecsql/src/ECSqlTestParser.js +7 -5
  60. package/lib/esm/test/ecsql/src/ECSqlTestParser.js.map +1 -1
  61. package/lib/esm/test/ecsql/src/ECSqlTestRunner.test.js +172 -98
  62. package/lib/esm/test/ecsql/src/ECSqlTestRunner.test.js.map +1 -1
  63. package/package.json +14 -14
  64. package/lib/esm/test/ecdb/ECSqlReader.test.d.ts +0 -2
  65. package/lib/esm/test/ecdb/ECSqlReader.test.d.ts.map +0 -1
  66. package/lib/esm/test/ecdb/ECSqlReader.test.js +0 -669
  67. package/lib/esm/test/ecdb/ECSqlReader.test.js.map +0 -1
package/lib/cjs/ECDb.d.ts CHANGED
@@ -1,8 +1,13 @@
1
+ /** @packageDocumentation
2
+ * @module ECDb
3
+ */
4
+ import { BeEvent } from "@itwin/core-bentley";
1
5
  import { IModelJsNative } from "@bentley/imodeljs-native";
2
6
  import { ECSchemaProps, ECSqlReader, QueryBinder, QueryOptions } from "@itwin/core-common";
3
7
  import { ECSqlStatement, ECSqlWriteStatement } from "./ECSqlStatement";
4
8
  import { SqliteStatement } from "./SqliteStatement";
5
9
  import { _nativeDb } from "./internal/Symbols";
10
+ import { ECSqlSyncReader, SynchronousQueryOptions } from "./ECSqlSyncReader";
6
11
  /** Modes for how to open [ECDb]($backend) files.
7
12
  * @public
8
13
  */
@@ -19,6 +24,8 @@ export declare class ECDb implements Disposable {
19
24
  private _nativeDb?;
20
25
  private readonly _statementCache;
21
26
  private _sqliteStatementCache;
27
+ /** Event called when the ECDb is about to be closed. */
28
+ readonly onBeforeClose: BeEvent<() => void>;
22
29
  /** only for tests
23
30
  * @internal
24
31
  */
@@ -60,6 +67,10 @@ export declare class ECDb implements Disposable {
60
67
  * @throws [IModelError]($common) if the database is not open.
61
68
  */
62
69
  closeDb(): void;
70
+ /** Clear all in-memory caches held in this ECDb.
71
+ * @beta
72
+ */
73
+ clearCaches(): void;
63
74
  /** @internal use to test statement caching */
64
75
  clearStatementCache(): void;
65
76
  /** @internal use to test statement caching */
@@ -210,5 +221,20 @@ export declare class ECDb implements Disposable {
210
221
  * @public
211
222
  * */
212
223
  createQueryReader(ecsql: string, params?: QueryBinder, config?: QueryOptions): ECSqlReader;
224
+ /** Allow to execute query and read results along with meta data. The result are stepped one by one.
225
+ *
226
+ * See also:
227
+ * - [ECSQL Overview]($docs/learning/backend/ExecutingECSQL)
228
+ * - [Code Examples]($docs/learning/backend/ECSQLCodeExamples)
229
+ * - [ECSQL Row Format]($docs/learning/ECSQLRowFormat)
230
+ * @param ecsql The ECSQL query to execute.
231
+ * @param callback the callback to invoke on the prepared ECSqlSyncReader
232
+ * @param params The values to bind to the parameters (if the ECSQL has any).
233
+ * @param config Optional flags which control how query is executed.
234
+ * @returns the value returned by `callback`.
235
+ * @throws IModelError if db is not open or if error occurs during statement execution
236
+ * @beta
237
+ * */
238
+ withQueryReader<T>(ecsql: string, callback: (reader: ECSqlSyncReader) => T, params?: QueryBinder, config?: SynchronousQueryOptions): T;
213
239
  }
214
240
  //# sourceMappingURL=ECDb.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ECDb.d.ts","sourceRoot":"","sources":["../../src/ECDb.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAkB,aAAa,EAAE,WAAW,EAAe,WAAW,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGxH,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvE,OAAO,EAAE,eAAe,EAAkB,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAI/C;;GAEG;AACH,oBAAY,YAAY;IACtB,QAAQ,IAAA;IACR,SAAS,IAAA;IACT,sGAAsG;IACtG,WAAW,IAAA;CACZ;AAED;;GAEG;AACH,qBAAa,IAAK,YAAW,UAAU;IACrC,OAAO,CAAC,SAAS,CAAC,CAAsB;IAExC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAwC;IACxE,OAAO,CAAC,qBAAqB,CAAyC;IAEtE;;OAEG;IACI,gBAAgB,CAAC,IAAI,EAAE,MAAM;;IAQpC;;OAEG;IACI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI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,2BAA2B,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,CAAC,EAAE,SAAS,UAAO,GAAG,CAAC;IAiB/G;;;;;;;;;OASG;IACI,mBAAmB,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,CAAC,EAAE,SAAS,UAAO,GAAG,CAAC;IAiBvG;;;;;OAKG;IACI,sBAAsB,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,UAAO,GAAG,eAAe;IAM7E,gBAAgB;IAChB,IAAW,CAAC,SAAS,CAAC,IAAI,cAAc,CAAC,IAAI,CAG5C;IAED;;;;;;;;;;;SAWK;IACE,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,WAAW;IAYjG;;;;;;;;;;;;;SAaK;IACE,eAAe,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,CAAC,EAAE,MAAM,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE,uBAAuB,GAAG,CAAC;CAoB9I"}
package/lib/cjs/ECDb.js CHANGED
@@ -16,6 +16,8 @@ const ECSqlStatement_1 = require("./ECSqlStatement");
16
16
  const NativePlatform_1 = require("./internal/NativePlatform");
17
17
  const SqliteStatement_1 = require("./SqliteStatement");
18
18
  const Symbols_1 = require("./internal/Symbols");
19
+ const ECSqlRowExecutor_1 = require("./ECSqlRowExecutor");
20
+ const ECSqlSyncReader_1 = require("./ECSqlSyncReader");
19
21
  const loggerCategory = BackendLoggerCategory_1.BackendLoggerCategory.ECDb;
20
22
  /** Modes for how to open [ECDb]($backend) files.
21
23
  * @public
@@ -35,6 +37,8 @@ class ECDb {
35
37
  // eslint-disable-next-line @typescript-eslint/no-deprecated
36
38
  _statementCache = new SqliteStatement_1.StatementCache();
37
39
  _sqliteStatementCache = new SqliteStatement_1.StatementCache();
40
+ /** Event called when the ECDb is about to be closed. */
41
+ onBeforeClose = new core_bentley_1.BeEvent();
38
42
  /** only for tests
39
43
  * @internal
40
44
  */
@@ -76,7 +80,7 @@ class ECDb {
76
80
  if (alias.toLowerCase() === "main" || alias.toLowerCase() === "schema_sync_db" || alias.toLowerCase() === "ecchange" || alias.toLowerCase() === "temp") {
77
81
  throw new core_common_1.IModelError(core_bentley_1.DbResult.BE_SQLITE_ERROR, "Reserved tablespace name cannot be used");
78
82
  }
79
- this.clearStatementCache();
83
+ this.clearCaches();
80
84
  this[Symbols_1._nativeDb].detachDb(alias);
81
85
  }
82
86
  /** @deprecated in 5.0 - will not be removed until after 2026-06-13. Use [Symbol.dispose] instead. */
@@ -110,9 +114,17 @@ class ECDb {
110
114
  * @throws [IModelError]($common) if the database is not open.
111
115
  */
112
116
  closeDb() {
117
+ this.onBeforeClose.raiseEvent();
118
+ this.clearCaches();
119
+ this[Symbols_1._nativeDb].closeDb();
120
+ }
121
+ /** Clear all in-memory caches held in this ECDb.
122
+ * @beta
123
+ */
124
+ clearCaches() {
113
125
  this._statementCache.clear();
114
126
  this._sqliteStatementCache.clear();
115
- this[Symbols_1._nativeDb].closeDb();
127
+ this[Symbols_1._nativeDb].clearECDbCache();
116
128
  }
117
129
  /** @internal use to test statement caching */
118
130
  clearStatementCache() {
@@ -151,6 +163,7 @@ class ECDb {
151
163
  core_bentley_1.Logger.logError(loggerCategory, `Failed to import schema from '${pathName}'.`);
152
164
  throw new core_common_1.IModelError(status, `Failed to import schema from '${pathName}'.`);
153
165
  }
166
+ this.clearCaches();
154
167
  }
155
168
  /** Removes unused schemas from the database.
156
169
  *
@@ -173,6 +186,9 @@ class ECDb {
173
186
  this.abandonChanges();
174
187
  throw new core_common_1.IModelError(core_bentley_1.DbResult.BE_SQLITE_ERROR, `Failed to drop schemas: ${error}`);
175
188
  }
189
+ finally {
190
+ this.clearCaches();
191
+ }
176
192
  }
177
193
  /**
178
194
  * Returns the full schema for the input name.
@@ -431,6 +447,41 @@ class ECDb {
431
447
  };
432
448
  return new core_common_1.ECSqlReader(executor, ecsql, params, config);
433
449
  }
450
+ /** Allow to execute query and read results along with meta data. The result are stepped one by one.
451
+ *
452
+ * See also:
453
+ * - [ECSQL Overview]($docs/learning/backend/ExecutingECSQL)
454
+ * - [Code Examples]($docs/learning/backend/ECSQLCodeExamples)
455
+ * - [ECSQL Row Format]($docs/learning/ECSQLRowFormat)
456
+ * @param ecsql The ECSQL query to execute.
457
+ * @param callback the callback to invoke on the prepared ECSqlSyncReader
458
+ * @param params The values to bind to the parameters (if the ECSQL has any).
459
+ * @param config Optional flags which control how query is executed.
460
+ * @returns the value returned by `callback`.
461
+ * @throws IModelError if db is not open or if error occurs during statement execution
462
+ * @beta
463
+ * */
464
+ withQueryReader(ecsql, callback, params, config) {
465
+ if (!this[Symbols_1._nativeDb].isOpen())
466
+ throw new core_common_1.IModelError(core_bentley_1.DbResult.BE_SQLITE_ERROR, "db not open");
467
+ const executor = new ECSqlRowExecutor_1.ECSqlRowExecutor(this);
468
+ const reader = new ECSqlSyncReader_1.ECSqlSyncReader(executor, ecsql, params, config);
469
+ const release = () => executor[Symbol.dispose]();
470
+ try {
471
+ const val = callback(reader);
472
+ if (val instanceof Promise) {
473
+ val.then(release, release);
474
+ }
475
+ else {
476
+ release();
477
+ }
478
+ return val;
479
+ }
480
+ catch (err) {
481
+ release();
482
+ throw err;
483
+ }
484
+ }
434
485
  }
435
486
  exports.ECDb = ECDb;
436
487
  //# sourceMappingURL=ECDb.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ECDb.js","sourceRoot":"","sources":["../../src/ECDb.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,sDAAyE;AAEzE,oDAAwH;AACxH,mEAAgE;AAChE,uDAAoD;AACpD,qDAAuE;AACvE,8DAAyD;AACzD,uDAAoE;AACp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D,MAAM,QAAQ,GAAG;YACf,OAAO,EAAE,KAAK,EAAE,OAAuB,EAAE,EAAE;gBACzC,OAAO,iCAAe,CAAC,mBAAmB,CAAC,IAAI,CAAC,mBAAS,CAAC,EAAE,OAAO,CAAC,CAAC;YACvE,CAAC;SACF,CAAC;QACF,OAAO,IAAI,yBAAW,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1D,CAAC;CACF;AA/ZD,oBA+ZC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module ECDb\r\n */\r\nimport { assert, DbResult, Logger, OpenMode } from \"@itwin/core-bentley\";\r\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\r\nimport { DbQueryRequest, ECSchemaProps, ECSqlReader, IModelError, QueryBinder, QueryOptions } from \"@itwin/core-common\";\r\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\r\nimport { ConcurrentQuery } from \"./ConcurrentQuery\";\r\nimport { ECSqlStatement, ECSqlWriteStatement } from \"./ECSqlStatement\";\r\nimport { IModelNative } from \"./internal/NativePlatform\";\r\nimport { SqliteStatement, StatementCache } from \"./SqliteStatement\";\r\nimport { _nativeDb } from \"./internal/Symbols\";\r\n\r\nconst loggerCategory: string = BackendLoggerCategory.ECDb;\r\n\r\n/** Modes for how to open [ECDb]($backend) files.\r\n * @public\r\n */\r\nexport enum ECDbOpenMode {\r\n Readonly,\r\n ReadWrite,\r\n /** Opens the file read-write and upgrades the file if necessary to the latest file format version. */\r\n FileUpgrade,\r\n}\r\n\r\n/** An ECDb file\r\n * @public\r\n */\r\nexport class ECDb implements Disposable {\r\n private _nativeDb?: IModelJsNative.ECDb;\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n private readonly _statementCache = new StatementCache<ECSqlStatement>();\r\n private _sqliteStatementCache = new StatementCache<SqliteStatement>();\r\n\r\n /** only for tests\r\n * @internal\r\n */\r\n public resetSqliteCache(size: number) {\r\n this._sqliteStatementCache.clear();\r\n this._sqliteStatementCache = new StatementCache<SqliteStatement>(size);\r\n }\r\n\r\n constructor() {\r\n this._nativeDb = new IModelNative.platform.ECDb();\r\n }\r\n /** Call this function when finished with this ECDb object. This releases the native resources held by the\r\n * ECDb object.\r\n */\r\n public [Symbol.dispose](): void {\r\n if (!this._nativeDb)\r\n return;\r\n\r\n this.closeDb();\r\n this._nativeDb.dispose();\r\n this._nativeDb = undefined;\r\n }\r\n /**\r\n * Attach an iModel file to this connection and load and register its schemas.\r\n * @note There are some reserve tablespace names that cannot be used. They are 'main', 'schema_sync_db', 'ecchange' & 'temp'\r\n * @param fileName IModel file name\r\n * @param alias identifier for the attached file. This identifer is used to access schema from the attached file. e.g. if alias is 'abc' then schema can be accessed using 'abc.MySchema.MyClass'\r\n */\r\n public attachDb(fileName: string, alias: string): void {\r\n if (alias.toLowerCase() === \"main\" || alias.toLowerCase() === \"schema_sync_db\" || alias.toLowerCase() === \"ecchange\" || alias.toLowerCase() === \"temp\") {\r\n throw new IModelError(DbResult.BE_SQLITE_ERROR, \"Reserved tablespace name cannot be used\");\r\n }\r\n this[_nativeDb].attachDb(fileName, alias);\r\n }\r\n /**\r\n * Detach the attached file from this connection. The attached file is closed and its schemas are unregistered.\r\n * @note There are some reserve tablespace names that cannot be used. They are 'main', 'schema_sync_db', 'ecchange' & 'temp'\r\n * @param alias identifer that was used in the call to [[attachDb]]\r\n */\r\n public detachDb(alias: string): void {\r\n if (alias.toLowerCase() === \"main\" || alias.toLowerCase() === \"schema_sync_db\" || alias.toLowerCase() === \"ecchange\" || alias.toLowerCase() === \"temp\") {\r\n throw new IModelError(DbResult.BE_SQLITE_ERROR, \"Reserved tablespace name cannot be used\");\r\n }\r\n this.clearStatementCache();\r\n this[_nativeDb].detachDb(alias);\r\n }\r\n\r\n /** @deprecated in 5.0 - will not be removed until after 2026-06-13. Use [Symbol.dispose] instead. */\r\n public dispose(): void {\r\n this[Symbol.dispose]();\r\n }\r\n\r\n /** Create an ECDb\r\n * @param pathName The path to the ECDb file to create.\r\n * @throws [IModelError]($common) if the operation failed.\r\n */\r\n public createDb(pathName: string): void {\r\n const status: DbResult = this[_nativeDb].createDb(pathName);\r\n if (status !== DbResult.BE_SQLITE_OK)\r\n throw new IModelError(status, \"Failed to created ECDb\");\r\n }\r\n\r\n /** Open the ECDb.\r\n * @param pathName The path to the ECDb file to open\r\n * @param openMode Open mode\r\n * @throws [IModelError]($common) if the operation failed.\r\n */\r\n public openDb(pathName: string, openMode: ECDbOpenMode = ECDbOpenMode.Readonly): void {\r\n const nativeOpenMode: OpenMode = openMode === ECDbOpenMode.Readonly ? OpenMode.Readonly : OpenMode.ReadWrite;\r\n const tryUpgrade: boolean = openMode === ECDbOpenMode.FileUpgrade;\r\n const status: DbResult = this[_nativeDb].openDb(pathName, nativeOpenMode, tryUpgrade);\r\n if (status !== DbResult.BE_SQLITE_OK)\r\n throw new IModelError(status, \"Failed to open ECDb\");\r\n }\r\n\r\n /** Returns true if the ECDb is open */\r\n public get isOpen(): boolean { return this[_nativeDb].isOpen(); }\r\n\r\n /** Close the Db after saving any uncommitted changes.\r\n * @throws [IModelError]($common) if the database is not open.\r\n */\r\n public closeDb(): void {\r\n this._statementCache.clear();\r\n this._sqliteStatementCache.clear();\r\n this[_nativeDb].closeDb();\r\n }\r\n\r\n /** @internal use to test statement caching */\r\n public clearStatementCache() {\r\n this._statementCache.clear();\r\n }\r\n\r\n /** @internal use to test statement caching */\r\n public getCachedStatementCount() {\r\n return this._statementCache.size;\r\n }\r\n\r\n /** Commit the outermost transaction, writing changes to the file. Then, restart the transaction.\r\n * @param changesetName The name of the operation that generated these changes.\r\n * @throws [IModelError]($common) if the database is not open or if the operation failed.\r\n */\r\n public saveChanges(changesetName?: string): void {\r\n const status: DbResult = this[_nativeDb].saveChanges(changesetName);\r\n if (status !== DbResult.BE_SQLITE_OK)\r\n throw new IModelError(status, \"Failed to save changes\");\r\n }\r\n\r\n /** Abandon (cancel) the outermost transaction, discarding all changes since last save. Then, restart the transaction.\r\n * @throws [IModelError]($common) if the database is not open or if the operation failed.\r\n */\r\n public abandonChanges(): void {\r\n const status: DbResult = this[_nativeDb].abandonChanges();\r\n if (status !== DbResult.BE_SQLITE_OK)\r\n throw new IModelError(status, \"Failed to abandon changes\");\r\n }\r\n\r\n /** Import a schema.\r\n *\r\n * If the import was successful, the database is automatically saved to disk.\r\n * @param pathName Path to ECSchema XML file to import.\r\n * @throws [IModelError]($common) if the database is not open or if the operation failed.\r\n */\r\n public importSchema(pathName: string): void {\r\n const status: DbResult = this[_nativeDb].importSchema(pathName);\r\n if (status !== DbResult.BE_SQLITE_OK) {\r\n Logger.logError(loggerCategory, `Failed to import schema from '${pathName}'.`);\r\n throw new IModelError(status, `Failed to import schema from '${pathName}'.`);\r\n }\r\n }\r\n\r\n /** Removes unused schemas from the database.\r\n *\r\n * If the removal was successful, the database is automatically saved to disk.\r\n * @param schemaNames Array of schema names to drop\r\n * @throws [IModelError]($common) if the database if the operation failed.\r\n * @alpha\r\n */\r\n public dropSchemas(schemaNames: string[]): void {\r\n if (schemaNames.length === 0)\r\n return;\r\n if (this[_nativeDb].schemaSyncEnabled())\r\n throw new IModelError(DbResult.BE_SQLITE_ERROR, \"Cannot drop schemas when schema sync is enabled\");\r\n\r\n try {\r\n this[_nativeDb].dropSchemas(schemaNames);\r\n this.saveChanges('dropped unused schemas');\r\n } catch (error: any) {\r\n Logger.logError(loggerCategory, `Failed to drop schemas: ${error}`);\r\n this.abandonChanges();\r\n throw new IModelError(DbResult.BE_SQLITE_ERROR, `Failed to drop schemas: ${error}`);\r\n }\r\n }\r\n\r\n /**\r\n * Returns the full schema for the input name.\r\n * @param name The name of the schema e.g. 'ECDbMeta'\r\n * @returns The SchemaProps for the requested schema\r\n * @throws if the schema can not be found or loaded.\r\n */\r\n public getSchemaProps(name: string): ECSchemaProps {\r\n return this[_nativeDb].getSchemaProps(name);\r\n }\r\n\r\n /**\r\n * Use a prepared ECSQL statement, potentially from the statement cache. If the requested statement doesn't exist\r\n * in the statement cache, a new statement is prepared. After the callback completes, the statement is reset and saved\r\n * in the statement cache so it can be reused in the future. Use this method for ECSQL statements that will be\r\n * reused often and are expensive to prepare. The statement cache holds the most recently used statements, discarding\r\n * the oldest statements as it fills. For statements you don't intend to reuse, instead use [[withStatement]].\r\n * @param sql The SQLite SQL statement to execute\r\n * @param callback the callback to invoke on the prepared statement\r\n * @param logErrors Determines if error will be logged if statement fail to prepare\r\n * @returns the value returned by `callback`.\r\n * @see [[withWriteStatement]]\r\n * @beta\r\n */\r\n public withCachedWriteStatement<T>(ecsql: string, callback: (stmt: ECSqlWriteStatement) => T, logErrors = true): T {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n const stmt = this._statementCache.findAndRemove(ecsql) ?? this.prepareStatement(ecsql, logErrors);\r\n const release = () => this._statementCache.addOrDispose(stmt);\r\n try {\r\n const val = callback(new ECSqlWriteStatement(stmt));\r\n if (val instanceof Promise) {\r\n val.then(release, release);\r\n } else {\r\n release();\r\n }\r\n return val;\r\n } catch (err) {\r\n release();\r\n throw err;\r\n }\r\n }\r\n\r\n /**\r\n * Prepared and execute a callback on an ECSQL statement. After the callback completes the statement is disposed.\r\n * Use this method for ECSQL statements are either not expected to be reused, or are not expensive to prepare.\r\n * For statements that will be reused often, instead use [[withPreparedStatement]].\r\n * @param sql The SQLite SQL statement to execute\r\n * @param callback the callback to invoke on the prepared statement\r\n * @param logErrors Determines if error will be logged if statement fail to prepare\r\n * @returns the value returned by `callback`.\r\n * @see [[withCachedWriteStatement]]\r\n * @beta\r\n */\r\n public withWriteStatement<T>(ecsql: string, callback: (stmt: ECSqlWriteStatement) => T, logErrors = true): T {\r\n const stmt = this.prepareWriteStatement(ecsql, logErrors);\r\n const release = () => stmt[Symbol.dispose]();\r\n try {\r\n const val = callback(stmt);\r\n if (val instanceof Promise) {\r\n val.then(release, release);\r\n } else {\r\n release();\r\n }\r\n return val;\r\n } catch (err) {\r\n release();\r\n throw err;\r\n }\r\n }\r\n\r\n /** Prepare an ECSQL statement.\r\n * @param ecsql The ECSQL statement to prepare\r\n * @param logErrors Determines if error will be logged if statement fail to prepare\r\n * @throws [IModelError]($common) if there is a problem preparing the statement.\r\n * @beta\r\n */\r\n public prepareWriteStatement(ecsql: string, logErrors = true): ECSqlWriteStatement {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n return new ECSqlWriteStatement(this.prepareStatement(ecsql, logErrors));\r\n }\r\n\r\n /**\r\n * Use a prepared ECSQL statement, potentially from the statement cache. If the requested statement doesn't exist\r\n * in the statement cache, a new statement is prepared. After the callback completes, the statement is reset and saved\r\n * in the statement cache so it can be reused in the future. Use this method for ECSQL statements that will be\r\n * reused often and are expensive to prepare. The statement cache holds the most recently used statements, discarding\r\n * the oldest statements as it fills. For statements you don't intend to reuse, instead use [[withStatement]].\r\n * @param sql The SQLite SQL statement to execute\r\n * @param callback the callback to invoke on the prepared statement\r\n * @param logErrors Determines if error will be logged if statement fail to prepare\r\n * @returns the value returned by `callback`.\r\n * @see [[withStatement]]\r\n * @public\r\n * @deprecated in 4.11 - will not be removed until after 2026-06-13. Use [[createQueryReader]] for SELECT statements and [[withCachedWriteStatement]] for INSERT/UPDATE/DELETE instead.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n public withPreparedStatement<T>(ecsql: string, callback: (stmt: ECSqlStatement) => T, logErrors = true): T {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n const stmt = this._statementCache.findAndRemove(ecsql) ?? this.prepareStatement(ecsql, logErrors);\r\n const release = () => this._statementCache.addOrDispose(stmt);\r\n try {\r\n const val = callback(stmt);\r\n if (val instanceof Promise) {\r\n val.then(release, release);\r\n } else {\r\n release();\r\n }\r\n return val;\r\n } catch (err) {\r\n release();\r\n throw err;\r\n }\r\n }\r\n\r\n /**\r\n * Prepared and execute a callback on an ECSQL statement. After the callback completes the statement is disposed.\r\n * Use this method for ECSQL statements are either not expected to be reused, or are not expensive to prepare.\r\n * For statements that will be reused often, instead use [[withPreparedStatement]].\r\n * @param sql The SQLite SQL statement to execute\r\n * @param callback the callback to invoke on the prepared statement\r\n * @param logErrors Determines if error will be logged if statement fail to prepare\r\n * @returns the value returned by `callback`.\r\n * @see [[withPreparedStatement]]\r\n * @public\r\n * @deprecated in 4.11 - will not be removed until after 2026-06-13. Use [[createQueryReader]] for SELECT statements and [[withWriteStatement]] for INSERT/UPDATE/DELETE instead.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n public withStatement<T>(ecsql: string, callback: (stmt: ECSqlStatement) => T, logErrors = true): T {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n const stmt = this.prepareStatement(ecsql, logErrors);\r\n const release = () => stmt[Symbol.dispose]();\r\n try {\r\n const val = callback(stmt);\r\n if (val instanceof Promise) {\r\n val.then(release, release);\r\n } else {\r\n release();\r\n }\r\n return val;\r\n } catch (err) {\r\n release();\r\n throw err;\r\n }\r\n }\r\n\r\n /** Prepare an ECSQL statement.\r\n * @param ecsql The ECSQL statement to prepare\r\n * @param logErrors Determines if error will be logged if statement fail to prepare\r\n * @throws [IModelError]($common) if there is a problem preparing the statement.\r\n * @deprecated in 4.11 - will not be removed until after 2026-06-13. Use [[prepareWriteStatement]] when preparing an INSERT/UPDATE/DELETE statement or [[createQueryReader]] to execute a SELECT statement.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n public prepareStatement(ecsql: string, logErrors = true): ECSqlStatement {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n const stmt = new ECSqlStatement();\r\n stmt.prepare(this[_nativeDb], ecsql, logErrors);\r\n return stmt;\r\n }\r\n\r\n /**\r\n * Use a prepared SQL statement, potentially from the statement cache. If the requested statement doesn't exist\r\n * in the statement cache, a new statement is prepared. After the callback completes, the statement is reset and saved\r\n * in the statement cache so it can be reused in the future. Use this method for SQL statements that will be\r\n * reused often and are expensive to prepare. The statement cache holds the most recently used statements, discarding\r\n * the oldest statements as it fills. For statements you don't intend to reuse, instead use [[withSqliteStatement]].\r\n * @param sql The SQLite SQL statement to execute\r\n * @param callback the callback to invoke on the prepared statement\r\n * @param logErrors Determines if error will be logged if statement fail to prepare\r\n * @returns the value returned by `callback`.\r\n * @see [[withPreparedStatement]]\r\n * @public\r\n */\r\n public withPreparedSqliteStatement<T>(sql: string, callback: (stmt: SqliteStatement) => T, logErrors = true): T {\r\n const stmt = this._sqliteStatementCache.findAndRemove(sql) ?? this.prepareSqliteStatement(sql, logErrors);\r\n const release = () => this._sqliteStatementCache.addOrDispose(stmt);\r\n try {\r\n const val: T = callback(stmt);\r\n if (val instanceof Promise) {\r\n val.then(release, release);\r\n } else {\r\n release();\r\n }\r\n return val;\r\n } catch (err) {\r\n release();\r\n throw err;\r\n }\r\n }\r\n\r\n /**\r\n * Prepared and execute a callback on a SQL statement. After the callback completes the statement is disposed.\r\n * Use this method for SQL statements are either not expected to be reused, or are not expensive to prepare.\r\n * For statements that will be reused often, instead use [[withPreparedSqliteStatement]].\r\n * @param sql The SQLite SQL statement to execute\r\n * @param callback the callback to invoke on the prepared statement\r\n * @param logErrors Determines if error will be logged if statement fail to prepare\r\n * @returns the value returned by `callback`.\r\n * @public\r\n */\r\n public withSqliteStatement<T>(sql: string, callback: (stmt: SqliteStatement) => T, logErrors = true): T {\r\n const stmt = this.prepareSqliteStatement(sql, logErrors);\r\n const release = () => stmt[Symbol.dispose]();\r\n try {\r\n const val: T = callback(stmt);\r\n if (val instanceof Promise) {\r\n val.then(release, release);\r\n } else {\r\n release();\r\n }\r\n return val;\r\n } catch (err) {\r\n release();\r\n throw err;\r\n }\r\n }\r\n\r\n /** Prepare an SQL statement.\r\n * @param sql The SQLite SQL statement to prepare\r\n * @param logErrors Determines if error will be logged if statement fail to prepare\r\n * @throws [IModelError]($common) if there is a problem preparing the statement.\r\n * @internal\r\n */\r\n public prepareSqliteStatement(sql: string, logErrors = true): SqliteStatement {\r\n const stmt = new SqliteStatement(sql);\r\n stmt.prepare(this[_nativeDb], logErrors);\r\n return stmt;\r\n }\r\n\r\n /** @internal */\r\n public get [_nativeDb](): IModelJsNative.ECDb {\r\n assert(undefined !== this._nativeDb);\r\n return this._nativeDb;\r\n }\r\n\r\n /** Allow to execute query and read results along with meta data. The result are streamed.\r\n *\r\n * See also:\r\n * - [ECSQL Overview]($docs/learning/backend/ExecutingECSQL)\r\n * - [Code Examples]($docs/learning/backend/ECSQLCodeExamples)\r\n * - [ECSQL Row Format]($docs/learning/ECSQLRowFormat)\r\n *\r\n * @param params The values to bind to the parameters (if the ECSQL has any).\r\n * @param config Allow to specify certain flags which control how query is executed.\r\n * @returns Returns an [ECSqlReader]($common) which helps iterate over the result set and also give access to metadata.\r\n * @public\r\n * */\r\n public createQueryReader(ecsql: string, params?: QueryBinder, config?: QueryOptions): ECSqlReader {\r\n if (!this._nativeDb || !this._nativeDb.isOpen()) {\r\n throw new IModelError(DbResult.BE_SQLITE_ERROR, \"db not open\");\r\n }\r\n const executor = {\r\n execute: async (request: DbQueryRequest) => {\r\n return ConcurrentQuery.executeQueryRequest(this[_nativeDb], request);\r\n },\r\n };\r\n return new ECSqlReader(executor, ecsql, params, config);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ECDb.js","sourceRoot":"","sources":["../../src/ECDb.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,sDAAkF;AAElF,oDAAwH;AACxH,mEAAgE;AAChE,uDAAoD;AACpD,qDAAuE;AACvE,8DAAyD;AACzD,uDAAoE;AACpE,gDAA+C;AAC/C,yDAAsD;AACtD,uDAA6E;AAE7E,MAAM,cAAc,GAAW,6CAAqB,CAAC,IAAI,CAAC;AAE1D;;GAEG;AACH,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,uDAAQ,CAAA;IACR,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C,OAAO,GAAQ,EAAE,CAAC;YAClB,OAAO,EAAE,CAAC;YACV,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC;CACF;AAjdD,oBAidC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module ECDb\r\n */\r\nimport { assert, BeEvent, DbResult, Logger, OpenMode } from \"@itwin/core-bentley\";\r\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\r\nimport { DbQueryRequest, ECSchemaProps, ECSqlReader, IModelError, QueryBinder, QueryOptions } from \"@itwin/core-common\";\r\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\r\nimport { ConcurrentQuery } from \"./ConcurrentQuery\";\r\nimport { ECSqlStatement, ECSqlWriteStatement } from \"./ECSqlStatement\";\r\nimport { IModelNative } from \"./internal/NativePlatform\";\r\nimport { SqliteStatement, StatementCache } from \"./SqliteStatement\";\r\nimport { _nativeDb } from \"./internal/Symbols\";\r\nimport { ECSqlRowExecutor } from \"./ECSqlRowExecutor\";\r\nimport { ECSqlSyncReader, SynchronousQueryOptions } from \"./ECSqlSyncReader\";\r\n\r\nconst loggerCategory: string = BackendLoggerCategory.ECDb;\r\n\r\n/** Modes for how to open [ECDb]($backend) files.\r\n * @public\r\n */\r\nexport enum ECDbOpenMode {\r\n Readonly,\r\n ReadWrite,\r\n /** Opens the file read-write and upgrades the file if necessary to the latest file format version. */\r\n FileUpgrade,\r\n}\r\n\r\n/** An ECDb file\r\n * @public\r\n */\r\nexport class ECDb implements Disposable {\r\n private _nativeDb?: IModelJsNative.ECDb;\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n private readonly _statementCache = new StatementCache<ECSqlStatement>();\r\n private _sqliteStatementCache = new StatementCache<SqliteStatement>();\r\n\r\n /** Event called when the ECDb is about to be closed. */\r\n public readonly onBeforeClose = new BeEvent<() => void>();\r\n\r\n /** only for tests\r\n * @internal\r\n */\r\n public resetSqliteCache(size: number) {\r\n this._sqliteStatementCache.clear();\r\n this._sqliteStatementCache = new StatementCache<SqliteStatement>(size);\r\n }\r\n\r\n constructor() {\r\n this._nativeDb = new IModelNative.platform.ECDb();\r\n }\r\n /** Call this function when finished with this ECDb object. This releases the native resources held by the\r\n * ECDb object.\r\n */\r\n public [Symbol.dispose](): void {\r\n if (!this._nativeDb)\r\n return;\r\n\r\n this.closeDb();\r\n this._nativeDb.dispose();\r\n this._nativeDb = undefined;\r\n }\r\n /**\r\n * Attach an iModel file to this connection and load and register its schemas.\r\n * @note There are some reserve tablespace names that cannot be used. They are 'main', 'schema_sync_db', 'ecchange' & 'temp'\r\n * @param fileName IModel file name\r\n * @param alias identifier for the attached file. This identifer is used to access schema from the attached file. e.g. if alias is 'abc' then schema can be accessed using 'abc.MySchema.MyClass'\r\n */\r\n public attachDb(fileName: string, alias: string): void {\r\n if (alias.toLowerCase() === \"main\" || alias.toLowerCase() === \"schema_sync_db\" || alias.toLowerCase() === \"ecchange\" || alias.toLowerCase() === \"temp\") {\r\n throw new IModelError(DbResult.BE_SQLITE_ERROR, \"Reserved tablespace name cannot be used\");\r\n }\r\n this[_nativeDb].attachDb(fileName, alias);\r\n }\r\n /**\r\n * Detach the attached file from this connection. The attached file is closed and its schemas are unregistered.\r\n * @note There are some reserve tablespace names that cannot be used. They are 'main', 'schema_sync_db', 'ecchange' & 'temp'\r\n * @param alias identifer that was used in the call to [[attachDb]]\r\n */\r\n public detachDb(alias: string): void {\r\n if (alias.toLowerCase() === \"main\" || alias.toLowerCase() === \"schema_sync_db\" || alias.toLowerCase() === \"ecchange\" || alias.toLowerCase() === \"temp\") {\r\n throw new IModelError(DbResult.BE_SQLITE_ERROR, \"Reserved tablespace name cannot be used\");\r\n }\r\n this.clearCaches();\r\n this[_nativeDb].detachDb(alias);\r\n }\r\n\r\n /** @deprecated in 5.0 - will not be removed until after 2026-06-13. Use [Symbol.dispose] instead. */\r\n public dispose(): void {\r\n this[Symbol.dispose]();\r\n }\r\n\r\n /** Create an ECDb\r\n * @param pathName The path to the ECDb file to create.\r\n * @throws [IModelError]($common) if the operation failed.\r\n */\r\n public createDb(pathName: string): void {\r\n const status: DbResult = this[_nativeDb].createDb(pathName);\r\n if (status !== DbResult.BE_SQLITE_OK)\r\n throw new IModelError(status, \"Failed to created ECDb\");\r\n }\r\n\r\n /** Open the ECDb.\r\n * @param pathName The path to the ECDb file to open\r\n * @param openMode Open mode\r\n * @throws [IModelError]($common) if the operation failed.\r\n */\r\n public openDb(pathName: string, openMode: ECDbOpenMode = ECDbOpenMode.Readonly): void {\r\n const nativeOpenMode: OpenMode = openMode === ECDbOpenMode.Readonly ? OpenMode.Readonly : OpenMode.ReadWrite;\r\n const tryUpgrade: boolean = openMode === ECDbOpenMode.FileUpgrade;\r\n const status: DbResult = this[_nativeDb].openDb(pathName, nativeOpenMode, tryUpgrade);\r\n if (status !== DbResult.BE_SQLITE_OK)\r\n throw new IModelError(status, \"Failed to open ECDb\");\r\n }\r\n\r\n /** Returns true if the ECDb is open */\r\n public get isOpen(): boolean { return this[_nativeDb].isOpen(); }\r\n\r\n /** Close the Db after saving any uncommitted changes.\r\n * @throws [IModelError]($common) if the database is not open.\r\n */\r\n public closeDb(): void {\r\n this.onBeforeClose.raiseEvent();\r\n this.clearCaches();\r\n this[_nativeDb].closeDb();\r\n }\r\n\r\n /** Clear all in-memory caches held in this ECDb.\r\n * @beta\r\n */\r\n public clearCaches(): void {\r\n this._statementCache.clear();\r\n this._sqliteStatementCache.clear();\r\n this[_nativeDb].clearECDbCache();\r\n }\r\n\r\n /** @internal use to test statement caching */\r\n public clearStatementCache() {\r\n this._statementCache.clear();\r\n }\r\n\r\n /** @internal use to test statement caching */\r\n public getCachedStatementCount() {\r\n return this._statementCache.size;\r\n }\r\n\r\n /** Commit the outermost transaction, writing changes to the file. Then, restart the transaction.\r\n * @param changesetName The name of the operation that generated these changes.\r\n * @throws [IModelError]($common) if the database is not open or if the operation failed.\r\n */\r\n public saveChanges(changesetName?: string): void {\r\n const status: DbResult = this[_nativeDb].saveChanges(changesetName);\r\n if (status !== DbResult.BE_SQLITE_OK)\r\n throw new IModelError(status, \"Failed to save changes\");\r\n }\r\n\r\n /** Abandon (cancel) the outermost transaction, discarding all changes since last save. Then, restart the transaction.\r\n * @throws [IModelError]($common) if the database is not open or if the operation failed.\r\n */\r\n public abandonChanges(): void {\r\n const status: DbResult = this[_nativeDb].abandonChanges();\r\n if (status !== DbResult.BE_SQLITE_OK)\r\n throw new IModelError(status, \"Failed to abandon changes\");\r\n }\r\n\r\n /** Import a schema.\r\n *\r\n * If the import was successful, the database is automatically saved to disk.\r\n * @param pathName Path to ECSchema XML file to import.\r\n * @throws [IModelError]($common) if the database is not open or if the operation failed.\r\n */\r\n public importSchema(pathName: string): void {\r\n const status: DbResult = this[_nativeDb].importSchema(pathName);\r\n if (status !== DbResult.BE_SQLITE_OK) {\r\n Logger.logError(loggerCategory, `Failed to import schema from '${pathName}'.`);\r\n throw new IModelError(status, `Failed to import schema from '${pathName}'.`);\r\n }\r\n this.clearCaches();\r\n }\r\n\r\n /** Removes unused schemas from the database.\r\n *\r\n * If the removal was successful, the database is automatically saved to disk.\r\n * @param schemaNames Array of schema names to drop\r\n * @throws [IModelError]($common) if the database if the operation failed.\r\n * @alpha\r\n */\r\n public dropSchemas(schemaNames: string[]): void {\r\n if (schemaNames.length === 0)\r\n return;\r\n if (this[_nativeDb].schemaSyncEnabled())\r\n throw new IModelError(DbResult.BE_SQLITE_ERROR, \"Cannot drop schemas when schema sync is enabled\");\r\n\r\n try {\r\n this[_nativeDb].dropSchemas(schemaNames);\r\n this.saveChanges('dropped unused schemas');\r\n } catch (error: any) {\r\n Logger.logError(loggerCategory, `Failed to drop schemas: ${error}`);\r\n this.abandonChanges();\r\n throw new IModelError(DbResult.BE_SQLITE_ERROR, `Failed to drop schemas: ${error}`);\r\n } finally {\r\n this.clearCaches();\r\n }\r\n }\r\n\r\n /**\r\n * Returns the full schema for the input name.\r\n * @param name The name of the schema e.g. 'ECDbMeta'\r\n * @returns The SchemaProps for the requested schema\r\n * @throws if the schema can not be found or loaded.\r\n */\r\n public getSchemaProps(name: string): ECSchemaProps {\r\n return this[_nativeDb].getSchemaProps(name);\r\n }\r\n\r\n /**\r\n * Use a prepared ECSQL statement, potentially from the statement cache. If the requested statement doesn't exist\r\n * in the statement cache, a new statement is prepared. After the callback completes, the statement is reset and saved\r\n * in the statement cache so it can be reused in the future. Use this method for ECSQL statements that will be\r\n * reused often and are expensive to prepare. The statement cache holds the most recently used statements, discarding\r\n * the oldest statements as it fills. For statements you don't intend to reuse, instead use [[withStatement]].\r\n * @param sql The SQLite SQL statement to execute\r\n * @param callback the callback to invoke on the prepared statement\r\n * @param logErrors Determines if error will be logged if statement fail to prepare\r\n * @returns the value returned by `callback`.\r\n * @see [[withWriteStatement]]\r\n * @beta\r\n */\r\n public withCachedWriteStatement<T>(ecsql: string, callback: (stmt: ECSqlWriteStatement) => T, logErrors = true): T {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n const stmt = this._statementCache.findAndRemove(ecsql) ?? this.prepareStatement(ecsql, logErrors);\r\n const release = () => this._statementCache.addOrDispose(stmt);\r\n try {\r\n const val = callback(new ECSqlWriteStatement(stmt));\r\n if (val instanceof Promise) {\r\n val.then(release, release);\r\n } else {\r\n release();\r\n }\r\n return val;\r\n } catch (err) {\r\n release();\r\n throw err;\r\n }\r\n }\r\n\r\n /**\r\n * Prepared and execute a callback on an ECSQL statement. After the callback completes the statement is disposed.\r\n * Use this method for ECSQL statements are either not expected to be reused, or are not expensive to prepare.\r\n * For statements that will be reused often, instead use [[withPreparedStatement]].\r\n * @param sql The SQLite SQL statement to execute\r\n * @param callback the callback to invoke on the prepared statement\r\n * @param logErrors Determines if error will be logged if statement fail to prepare\r\n * @returns the value returned by `callback`.\r\n * @see [[withCachedWriteStatement]]\r\n * @beta\r\n */\r\n public withWriteStatement<T>(ecsql: string, callback: (stmt: ECSqlWriteStatement) => T, logErrors = true): T {\r\n const stmt = this.prepareWriteStatement(ecsql, logErrors);\r\n const release = () => stmt[Symbol.dispose]();\r\n try {\r\n const val = callback(stmt);\r\n if (val instanceof Promise) {\r\n val.then(release, release);\r\n } else {\r\n release();\r\n }\r\n return val;\r\n } catch (err) {\r\n release();\r\n throw err;\r\n }\r\n }\r\n\r\n /** Prepare an ECSQL statement.\r\n * @param ecsql The ECSQL statement to prepare\r\n * @param logErrors Determines if error will be logged if statement fail to prepare\r\n * @throws [IModelError]($common) if there is a problem preparing the statement.\r\n * @beta\r\n */\r\n public prepareWriteStatement(ecsql: string, logErrors = true): ECSqlWriteStatement {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n return new ECSqlWriteStatement(this.prepareStatement(ecsql, logErrors));\r\n }\r\n\r\n /**\r\n * Use a prepared ECSQL statement, potentially from the statement cache. If the requested statement doesn't exist\r\n * in the statement cache, a new statement is prepared. After the callback completes, the statement is reset and saved\r\n * in the statement cache so it can be reused in the future. Use this method for ECSQL statements that will be\r\n * reused often and are expensive to prepare. The statement cache holds the most recently used statements, discarding\r\n * the oldest statements as it fills. For statements you don't intend to reuse, instead use [[withStatement]].\r\n * @param sql The SQLite SQL statement to execute\r\n * @param callback the callback to invoke on the prepared statement\r\n * @param logErrors Determines if error will be logged if statement fail to prepare\r\n * @returns the value returned by `callback`.\r\n * @see [[withStatement]]\r\n * @public\r\n * @deprecated in 4.11 - will not be removed until after 2026-06-13. Use [[createQueryReader]] for SELECT statements and [[withCachedWriteStatement]] for INSERT/UPDATE/DELETE instead.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n public withPreparedStatement<T>(ecsql: string, callback: (stmt: ECSqlStatement) => T, logErrors = true): T {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n const stmt = this._statementCache.findAndRemove(ecsql) ?? this.prepareStatement(ecsql, logErrors);\r\n const release = () => this._statementCache.addOrDispose(stmt);\r\n try {\r\n const val = callback(stmt);\r\n if (val instanceof Promise) {\r\n val.then(release, release);\r\n } else {\r\n release();\r\n }\r\n return val;\r\n } catch (err) {\r\n release();\r\n throw err;\r\n }\r\n }\r\n\r\n /**\r\n * Prepared and execute a callback on an ECSQL statement. After the callback completes the statement is disposed.\r\n * Use this method for ECSQL statements are either not expected to be reused, or are not expensive to prepare.\r\n * For statements that will be reused often, instead use [[withPreparedStatement]].\r\n * @param sql The SQLite SQL statement to execute\r\n * @param callback the callback to invoke on the prepared statement\r\n * @param logErrors Determines if error will be logged if statement fail to prepare\r\n * @returns the value returned by `callback`.\r\n * @see [[withPreparedStatement]]\r\n * @public\r\n * @deprecated in 4.11 - will not be removed until after 2026-06-13. Use [[createQueryReader]] for SELECT statements and [[withWriteStatement]] for INSERT/UPDATE/DELETE instead.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n public withStatement<T>(ecsql: string, callback: (stmt: ECSqlStatement) => T, logErrors = true): T {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n const stmt = this.prepareStatement(ecsql, logErrors);\r\n const release = () => stmt[Symbol.dispose]();\r\n try {\r\n const val = callback(stmt);\r\n if (val instanceof Promise) {\r\n val.then(release, release);\r\n } else {\r\n release();\r\n }\r\n return val;\r\n } catch (err) {\r\n release();\r\n throw err;\r\n }\r\n }\r\n\r\n /** Prepare an ECSQL statement.\r\n * @param ecsql The ECSQL statement to prepare\r\n * @param logErrors Determines if error will be logged if statement fail to prepare\r\n * @throws [IModelError]($common) if there is a problem preparing the statement.\r\n * @deprecated in 4.11 - will not be removed until after 2026-06-13. Use [[prepareWriteStatement]] when preparing an INSERT/UPDATE/DELETE statement or [[createQueryReader]] to execute a SELECT statement.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n public prepareStatement(ecsql: string, logErrors = true): ECSqlStatement {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n const stmt = new ECSqlStatement();\r\n stmt.prepare(this[_nativeDb], ecsql, logErrors);\r\n return stmt;\r\n }\r\n\r\n /**\r\n * Use a prepared SQL statement, potentially from the statement cache. If the requested statement doesn't exist\r\n * in the statement cache, a new statement is prepared. After the callback completes, the statement is reset and saved\r\n * in the statement cache so it can be reused in the future. Use this method for SQL statements that will be\r\n * reused often and are expensive to prepare. The statement cache holds the most recently used statements, discarding\r\n * the oldest statements as it fills. For statements you don't intend to reuse, instead use [[withSqliteStatement]].\r\n * @param sql The SQLite SQL statement to execute\r\n * @param callback the callback to invoke on the prepared statement\r\n * @param logErrors Determines if error will be logged if statement fail to prepare\r\n * @returns the value returned by `callback`.\r\n * @see [[withPreparedStatement]]\r\n * @public\r\n */\r\n public withPreparedSqliteStatement<T>(sql: string, callback: (stmt: SqliteStatement) => T, logErrors = true): T {\r\n const stmt = this._sqliteStatementCache.findAndRemove(sql) ?? this.prepareSqliteStatement(sql, logErrors);\r\n const release = () => this._sqliteStatementCache.addOrDispose(stmt);\r\n try {\r\n const val: T = callback(stmt);\r\n if (val instanceof Promise) {\r\n val.then(release, release);\r\n } else {\r\n release();\r\n }\r\n return val;\r\n } catch (err) {\r\n release();\r\n throw err;\r\n }\r\n }\r\n\r\n /**\r\n * Prepared and execute a callback on a SQL statement. After the callback completes the statement is disposed.\r\n * Use this method for SQL statements are either not expected to be reused, or are not expensive to prepare.\r\n * For statements that will be reused often, instead use [[withPreparedSqliteStatement]].\r\n * @param sql The SQLite SQL statement to execute\r\n * @param callback the callback to invoke on the prepared statement\r\n * @param logErrors Determines if error will be logged if statement fail to prepare\r\n * @returns the value returned by `callback`.\r\n * @public\r\n */\r\n public withSqliteStatement<T>(sql: string, callback: (stmt: SqliteStatement) => T, logErrors = true): T {\r\n const stmt = this.prepareSqliteStatement(sql, logErrors);\r\n const release = () => stmt[Symbol.dispose]();\r\n try {\r\n const val: T = callback(stmt);\r\n if (val instanceof Promise) {\r\n val.then(release, release);\r\n } else {\r\n release();\r\n }\r\n return val;\r\n } catch (err) {\r\n release();\r\n throw err;\r\n }\r\n }\r\n\r\n /** Prepare an SQL statement.\r\n * @param sql The SQLite SQL statement to prepare\r\n * @param logErrors Determines if error will be logged if statement fail to prepare\r\n * @throws [IModelError]($common) if there is a problem preparing the statement.\r\n * @internal\r\n */\r\n public prepareSqliteStatement(sql: string, logErrors = true): SqliteStatement {\r\n const stmt = new SqliteStatement(sql);\r\n stmt.prepare(this[_nativeDb], logErrors);\r\n return stmt;\r\n }\r\n\r\n /** @internal */\r\n public get [_nativeDb](): IModelJsNative.ECDb {\r\n assert(undefined !== this._nativeDb);\r\n return this._nativeDb;\r\n }\r\n\r\n /** Allow to execute query and read results along with meta data. The result are streamed.\r\n *\r\n * See also:\r\n * - [ECSQL Overview]($docs/learning/backend/ExecutingECSQL)\r\n * - [Code Examples]($docs/learning/backend/ECSQLCodeExamples)\r\n * - [ECSQL Row Format]($docs/learning/ECSQLRowFormat)\r\n *\r\n * @param params The values to bind to the parameters (if the ECSQL has any).\r\n * @param config Allow to specify certain flags which control how query is executed.\r\n * @returns Returns an [ECSqlReader]($common) which helps iterate over the result set and also give access to metadata.\r\n * @public\r\n * */\r\n public createQueryReader(ecsql: string, params?: QueryBinder, config?: QueryOptions): ECSqlReader {\r\n if (!this._nativeDb || !this._nativeDb.isOpen()) {\r\n throw new IModelError(DbResult.BE_SQLITE_ERROR, \"db not open\");\r\n }\r\n const executor = {\r\n execute: async (request: DbQueryRequest) => {\r\n return ConcurrentQuery.executeQueryRequest(this[_nativeDb], request);\r\n },\r\n };\r\n return new ECSqlReader(executor, ecsql, params, config);\r\n }\r\n\r\n /** Allow to execute query and read results along with meta data. The result are stepped one by one.\r\n *\r\n * See also:\r\n * - [ECSQL Overview]($docs/learning/backend/ExecutingECSQL)\r\n * - [Code Examples]($docs/learning/backend/ECSQLCodeExamples)\r\n * - [ECSQL Row Format]($docs/learning/ECSQLRowFormat)\r\n * @param ecsql The ECSQL query to execute.\r\n * @param callback the callback to invoke on the prepared ECSqlSyncReader\r\n * @param params The values to bind to the parameters (if the ECSQL has any).\r\n * @param config Optional flags which control how query is executed.\r\n * @returns the value returned by `callback`.\r\n * @throws IModelError if db is not open or if error occurs during statement execution\r\n * @beta\r\n * */\r\n public withQueryReader<T>(ecsql: string, callback: (reader: ECSqlSyncReader) => T, params?: QueryBinder, config?: SynchronousQueryOptions): T {\r\n if (!this[_nativeDb].isOpen())\r\n throw new IModelError(DbResult.BE_SQLITE_ERROR, \"db not open\");\r\n\r\n const executor = new ECSqlRowExecutor(this);\r\n const reader = new ECSqlSyncReader(executor, ecsql, params, config);\r\n const release = () => executor[Symbol.dispose]();\r\n try {\r\n const val = callback(reader);\r\n if (val instanceof Promise) {\r\n val.then(release, release);\r\n } else {\r\n release();\r\n }\r\n return val;\r\n } catch (err: any) {\r\n release();\r\n throw err;\r\n }\r\n }\r\n}\r\n"]}
@@ -0,0 +1,66 @@
1
+ import { QueryPropertyMetaData } from "@itwin/core-common";
2
+ import { IModelDb } from "./IModelDb";
3
+ import { IModelJsNative } from "@bentley/imodeljs-native";
4
+ import { ECDb } from "./ECDb";
5
+ /**
6
+ * Executes ECSql queries one row at a time against an IModelDb, maintaining statement state between
7
+ * successive calls so the caller can page through results via offset-based requests.
8
+ * @internal
9
+ */
10
+ export declare class ECSqlRowExecutor implements Disposable {
11
+ private readonly _db;
12
+ private _stmt;
13
+ private _removeListener;
14
+ constructor(_db: IModelDb | ECDb);
15
+ /** Disposes the current statement and resets all internal state.
16
+ * Invoked when the db signals that the executor must be recycled.
17
+ * @internal
18
+ */
19
+ private cleanup;
20
+ /** Call this function to dispose the row executor off.
21
+ * @internal
22
+ */
23
+ [Symbol.dispose](): void;
24
+ /** Prepare the statement and bind parameters in one step.
25
+ * Call once during reader initialization — avoids the per-row `ensureStatementReady` check.
26
+ * @param query - The ECSql text to prepare.
27
+ * @param args - Optional bind parameters.
28
+ * @throws IModelError on preparation or binding failure.
29
+ * @internal
30
+ */
31
+ prepareAndBind(query: string, args?: object): void;
32
+ /** Fast-path: step the cursor once and return row data directly.
33
+ *
34
+ * Returns the row data array if a row is available.
35
+ * Returns `undefined` if the result set is exhausted (DONE).
36
+ *
37
+ * This avoids all intermediate object allocations (StepResult, RowDataResult,
38
+ * DbRuntimeStats, DbQueryResponse) that the general `execute()` path creates per row.
39
+ *
40
+ * @param options - Native row-adaptor options (should be cached and reused across rows).
41
+ * @throws IModelError on step failure or row extraction failure.
42
+ * @internal
43
+ */
44
+ stepNextRow(options: IModelJsNative.ECSqlRowAdaptorOptions): any;
45
+ /** Get column metadata directly from the prepared statement.
46
+ * Call once after `prepareAndBind` — the metadata does not change between rows.
47
+ * @param options - Native row-adaptor options that influence property naming.
48
+ * @returns Array of column metadata.
49
+ * @internal
50
+ */
51
+ fetchMetadata(options: IModelJsNative.ECSqlRowAdaptorOptions): QueryPropertyMetaData[];
52
+ /** Prepares the ECSql statement against the native database and records the elapsed preparation time.
53
+ * @param ecsql - The ECSql text to prepare.
54
+ * @returns An `OperationResult` indicating success or failure.
55
+ * @internal
56
+ */
57
+ private prepareStmt;
58
+ /** Resets the statement and binds the given parameter values. Caches the arguments for later
59
+ * comparison so that redundant rebinds can be skipped.
60
+ * @param args - The parameter object to bind, or `undefined` when no parameters are needed.
61
+ * @returns An `OperationResult` indicating success or failure.
62
+ * @internal
63
+ */
64
+ private bindValues;
65
+ }
66
+ //# sourceMappingURL=ECSqlRowExecutor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ECSqlRowExecutor.d.ts","sourceRoot":"","sources":["../../src/ECSqlRowExecutor.ts"],"names":[],"mappings":"AAKA,OAAO,EAAe,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAkB9B;;;;GAIG;AACH,qBAAa,gBAAiB,YAAW,UAAU;IAK9B,OAAO,CAAC,QAAQ,CAAC,GAAG;IAHvC,OAAO,CAAC,KAAK,CAAiB;IAC9B,OAAO,CAAC,eAAe,CAAa;gBAEA,GAAG,EAAE,QAAQ,GAAG,IAAI;IAUxD;;;OAGG;IACH,OAAO,CAAC,OAAO;IAIf;;OAEG;IACI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI;IAS/B;;;;;;OAMG;IACI,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI;IAazD;;;;;;;;;;;OAWG;IACI,WAAW,CAAC,OAAO,EAAE,cAAc,CAAC,sBAAsB,GAAG,GAAG;IAWvE;;;;;OAKG;IACI,aAAa,CAAC,OAAO,EAAE,cAAc,CAAC,sBAAsB,GAAG,qBAAqB,EAAE;IAQ7F;;;;OAIG;IACH,OAAO,CAAC,WAAW;IASnB;;;;;OAKG;IACH,OAAO,CAAC,UAAU;CAWnB"}
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.ECSqlRowExecutor = void 0;
8
+ const core_common_1 = require("@itwin/core-common");
9
+ const ECSqlStatement_1 = require("./ECSqlStatement");
10
+ const core_bentley_1 = require("@itwin/core-bentley");
11
+ const Symbols_1 = require("./internal/Symbols");
12
+ // --------------------------------------------------------------------------------------------
13
+ // ECSqlRowExecutor
14
+ // --------------------------------------------------------------------------------------------
15
+ /**
16
+ * Executes ECSql queries one row at a time against an IModelDb, maintaining statement state between
17
+ * successive calls so the caller can page through results via offset-based requests.
18
+ * @internal
19
+ */
20
+ class ECSqlRowExecutor {
21
+ _db;
22
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
23
+ _stmt;
24
+ _removeListener;
25
+ constructor(_db) {
26
+ this._db = _db;
27
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
28
+ this._stmt = new ECSqlStatement_1.ECSqlStatement();
29
+ this._removeListener = this._db.onBeforeClose.addListener(() => this.cleanup());
30
+ }
31
+ // --------------------------------------------------------------------------------------------
32
+ // Lifecycle
33
+ // --------------------------------------------------------------------------------------------
34
+ /** Disposes the current statement and resets all internal state.
35
+ * Invoked when the db signals that the executor must be recycled.
36
+ * @internal
37
+ */
38
+ cleanup() {
39
+ this._stmt[Symbol.dispose]();
40
+ }
41
+ /** Call this function to dispose the row executor off.
42
+ * @internal
43
+ */
44
+ [Symbol.dispose]() {
45
+ this._removeListener();
46
+ this.cleanup();
47
+ }
48
+ // --------------------------------------------------------------------------------------------
49
+ // Core execution
50
+ // --------------------------------------------------------------------------------------------
51
+ /** Prepare the statement and bind parameters in one step.
52
+ * Call once during reader initialization — avoids the per-row `ensureStatementReady` check.
53
+ * @param query - The ECSql text to prepare.
54
+ * @param args - Optional bind parameters.
55
+ * @throws IModelError on preparation or binding failure.
56
+ * @internal
57
+ */
58
+ prepareAndBind(query, args) {
59
+ const prepResult = this.prepareStmt(query);
60
+ if (!prepResult.isSuccessful)
61
+ throw new core_common_1.IModelError(core_bentley_1.DbResult.BE_SQLITE_ERROR, prepResult.message ?? `Failed to prepare statement: ${query}`);
62
+ if (args) {
63
+ const bindResult = this.bindValues(args);
64
+ if (!bindResult.isSuccessful)
65
+ throw new core_common_1.IModelError(core_bentley_1.DbResult.BE_SQLITE_ERROR, bindResult.message ?? `Failed to bind values: ${query}`);
66
+ }
67
+ }
68
+ /** Fast-path: step the cursor once and return row data directly.
69
+ *
70
+ * Returns the row data array if a row is available.
71
+ * Returns `undefined` if the result set is exhausted (DONE).
72
+ *
73
+ * This avoids all intermediate object allocations (StepResult, RowDataResult,
74
+ * DbRuntimeStats, DbQueryResponse) that the general `execute()` path creates per row.
75
+ *
76
+ * @param options - Native row-adaptor options (should be cached and reused across rows).
77
+ * @throws IModelError on step failure or row extraction failure.
78
+ * @internal
79
+ */
80
+ stepNextRow(options) {
81
+ if (!this._stmt.isPrepared)
82
+ throw new core_common_1.IModelError(core_bentley_1.DbResult.BE_SQLITE_ERROR, "Statement is not prepared. Likely cause: the db was closed before step is called or the ECSqlSyncReader is used outside the context of the callback passed to withQueryReader.");
83
+ const stepResult = this._stmt.step();
84
+ if (stepResult === core_bentley_1.DbResult.BE_SQLITE_ROW)
85
+ return this._stmt.toRow(options).data;
86
+ if (stepResult === core_bentley_1.DbResult.BE_SQLITE_DONE)
87
+ return undefined;
88
+ throw new core_common_1.IModelError(stepResult, `Step failed with code ${stepResult}`);
89
+ }
90
+ /** Get column metadata directly from the prepared statement.
91
+ * Call once after `prepareAndBind` — the metadata does not change between rows.
92
+ * @param options - Native row-adaptor options that influence property naming.
93
+ * @returns Array of column metadata.
94
+ * @internal
95
+ */
96
+ fetchMetadata(options) {
97
+ return this._stmt.getMetadata(options).properties;
98
+ }
99
+ // --------------------------------------------------------------------------------------------
100
+ // Execution phases
101
+ // --------------------------------------------------------------------------------------------
102
+ /** Prepares the ECSql statement against the native database and records the elapsed preparation time.
103
+ * @param ecsql - The ECSql text to prepare.
104
+ * @returns An `OperationResult` indicating success or failure.
105
+ * @internal
106
+ */
107
+ prepareStmt(ecsql) {
108
+ try {
109
+ this._stmt.prepare(this._db[Symbols_1._nativeDb], ecsql);
110
+ return { isSuccessful: true };
111
+ }
112
+ catch (error) {
113
+ return { isSuccessful: false, message: error.message };
114
+ }
115
+ }
116
+ /** Resets the statement and binds the given parameter values. Caches the arguments for later
117
+ * comparison so that redundant rebinds can be skipped.
118
+ * @param args - The parameter object to bind, or `undefined` when no parameters are needed.
119
+ * @returns An `OperationResult` indicating success or failure.
120
+ * @internal
121
+ */
122
+ bindValues(args) {
123
+ try {
124
+ if (args === undefined)
125
+ return { isSuccessful: true };
126
+ this._stmt.bindParams(args);
127
+ return { isSuccessful: true };
128
+ }
129
+ catch (error) {
130
+ return { isSuccessful: false, message: error.message };
131
+ }
132
+ }
133
+ }
134
+ exports.ECSqlRowExecutor = ECSqlRowExecutor;
135
+ //# sourceMappingURL=ECSqlRowExecutor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ECSqlRowExecutor.js","sourceRoot":"","sources":["../../src/ECSqlRowExecutor.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,oDAAwE;AAExE,qDAAkD;AAClD,sDAA+C;AAE/C,gDAA+C;AAe/C,+FAA+F;AAC/F,mBAAmB;AACnB,+FAA+F;AAE/F;;;;GAIG;AACH,MAAa,gBAAgB;IAKS;IAJpC,4DAA4D;IACpD,KAAK,CAAiB;IACtB,eAAe,CAAa;IAEpC,YAAoC,GAAoB;QAApB,QAAG,GAAH,GAAG,CAAiB;QACtD,4DAA4D;QAC5D,IAAI,CAAC,KAAK,GAAG,IAAI,+BAAc,EAAE,CAAC;QAClC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;IAClF,CAAC;IAED,+FAA+F;IAC/F,YAAY;IACZ,+FAA+F;IAE/F;;;OAGG;IACK,OAAO;QACb,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;IAC/B,CAAC;IAED;;OAEG;IACI,CAAC,MAAM,CAAC,OAAO,CAAC;QACrB,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,IAAI,CAAC,OAAO,EAAE,CAAC;IACjB,CAAC;IAED,+FAA+F;IAC/F,iBAAiB;IACjB,+FAA+F;IAE/F;;;;;;OAMG;IACI,cAAc,CAAC,KAAa,EAAE,IAAa;QAEhD,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAC3C,IAAI,CAAC,UAAU,CAAC,YAAY;YAC1B,MAAM,IAAI,yBAAW,CAAC,uBAAQ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AAE,IAAI,EAAE,CAAC;QAChC,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;QACzD,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACK,UAAU,CAAC,IAAwB;QACzC,IAAI,CAAC;YACH,IAAI,IAAI,KAAK,SAAS;gBACpB,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;YAEhC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAC5B,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;QAChC,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;QACzD,CAAC;IACH,CAAC;CACF;AA3HD,4CA2HC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport { IModelError, QueryPropertyMetaData } from \"@itwin/core-common\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { ECSqlStatement } from \"./ECSqlStatement\";\r\nimport { DbResult } from \"@itwin/core-bentley\";\r\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\r\nimport { _nativeDb } from \"./internal/Symbols\";\r\nimport { ECDb } from \"./ECDb\";\r\n\r\n// --------------------------------------------------------------------------------------------\r\n// Internal result types\r\n// --------------------------------------------------------------------------------------------\r\n\r\n/** Result of an internal operation that may fail with a message.\r\n * @internal\r\n */\r\ninterface OperationResult {\r\n isSuccessful: boolean;\r\n message?: string;\r\n}\r\n\r\n// --------------------------------------------------------------------------------------------\r\n// ECSqlRowExecutor\r\n// --------------------------------------------------------------------------------------------\r\n\r\n/**\r\n * Executes ECSql queries one row at a time against an IModelDb, maintaining statement state between\r\n * successive calls so the caller can page through results via offset-based requests.\r\n * @internal\r\n */\r\nexport class ECSqlRowExecutor implements Disposable {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n private _stmt: ECSqlStatement;\r\n private _removeListener: () => void;\r\n\r\n public constructor(private readonly _db: IModelDb | ECDb) {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n this._stmt = new ECSqlStatement();\r\n this._removeListener = this._db.onBeforeClose.addListener(() => this.cleanup());\r\n }\r\n\r\n // --------------------------------------------------------------------------------------------\r\n // Lifecycle\r\n // --------------------------------------------------------------------------------------------\r\n\r\n /** Disposes the current statement and resets all internal state.\r\n * Invoked when the db signals that the executor must be recycled.\r\n * @internal\r\n */\r\n private cleanup(): void {\r\n this._stmt[Symbol.dispose]();\r\n }\r\n\r\n /** Call this function to dispose the row executor off.\r\n * @internal\r\n */\r\n public [Symbol.dispose](): void {\r\n this._removeListener();\r\n this.cleanup();\r\n }\r\n\r\n // --------------------------------------------------------------------------------------------\r\n // Core execution\r\n // --------------------------------------------------------------------------------------------\r\n\r\n /** Prepare the statement and bind parameters in one step.\r\n * Call once during reader initialization — avoids the per-row `ensureStatementReady` check.\r\n * @param query - The ECSql text to prepare.\r\n * @param args - Optional bind parameters.\r\n * @throws IModelError on preparation or binding failure.\r\n * @internal\r\n */\r\n public prepareAndBind(query: string, args?: object): void {\r\n\r\n const prepResult = this.prepareStmt(query);\r\n if (!prepResult.isSuccessful)\r\n throw new IModelError(DbResult.BE_SQLITE_ERROR, prepResult.message ?? `Failed to prepare statement: ${query}`);\r\n\r\n if (args) {\r\n const bindResult = this.bindValues(args);\r\n if (!bindResult.isSuccessful)\r\n throw new IModelError(DbResult.BE_SQLITE_ERROR, bindResult.message ?? `Failed to bind values: ${query}`);\r\n }\r\n }\r\n\r\n /** Fast-path: step the cursor once and return row data directly.\r\n *\r\n * Returns the row data array if a row is available.\r\n * Returns `undefined` if the result set is exhausted (DONE).\r\n *\r\n * This avoids all intermediate object allocations (StepResult, RowDataResult,\r\n * DbRuntimeStats, DbQueryResponse) that the general `execute()` path creates per row.\r\n *\r\n * @param options - Native row-adaptor options (should be cached and reused across rows).\r\n * @throws IModelError on step failure or row extraction failure.\r\n * @internal\r\n */\r\n public stepNextRow(options: IModelJsNative.ECSqlRowAdaptorOptions): any {\r\n if (!this._stmt.isPrepared)\r\n throw new IModelError(DbResult.BE_SQLITE_ERROR, \"Statement is not prepared. Likely cause: the db was closed before step is called or the ECSqlSyncReader is used outside the context of the callback passed to withQueryReader.\");\r\n const stepResult = this._stmt.step();\r\n if (stepResult === DbResult.BE_SQLITE_ROW)\r\n return this._stmt.toRow(options).data;\r\n if (stepResult === DbResult.BE_SQLITE_DONE)\r\n return undefined;\r\n throw new IModelError(stepResult, `Step failed with code ${stepResult}`);\r\n }\r\n\r\n /** Get column metadata directly from the prepared statement.\r\n * Call once after `prepareAndBind` — the metadata does not change between rows.\r\n * @param options - Native row-adaptor options that influence property naming.\r\n * @returns Array of column metadata.\r\n * @internal\r\n */\r\n public fetchMetadata(options: IModelJsNative.ECSqlRowAdaptorOptions): QueryPropertyMetaData[] {\r\n return this._stmt.getMetadata(options).properties;\r\n }\r\n\r\n // --------------------------------------------------------------------------------------------\r\n // Execution phases\r\n // --------------------------------------------------------------------------------------------\r\n\r\n /** Prepares the ECSql statement against the native database and records the elapsed preparation time.\r\n * @param ecsql - The ECSql text to prepare.\r\n * @returns An `OperationResult` indicating success or failure.\r\n * @internal\r\n */\r\n private prepareStmt(ecsql: string): OperationResult {\r\n try {\r\n this._stmt.prepare(this._db[_nativeDb], ecsql);\r\n return { isSuccessful: true };\r\n } catch (error: any) {\r\n return { isSuccessful: false, message: error.message };\r\n }\r\n }\r\n\r\n /** Resets the statement and binds the given parameter values. Caches the arguments for later\r\n * comparison so that redundant rebinds can be skipped.\r\n * @param args - The parameter object to bind, or `undefined` when no parameters are needed.\r\n * @returns An `OperationResult` indicating success or failure.\r\n * @internal\r\n */\r\n private bindValues(args: object | undefined): OperationResult {\r\n try {\r\n if (args === undefined)\r\n return { isSuccessful: true };\r\n\r\n this._stmt.bindParams(args);\r\n return { isSuccessful: true };\r\n } catch (error: any) {\r\n return { isSuccessful: false, message: error.message };\r\n }\r\n }\r\n}"]}
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import { DbResult, GuidString, Id64String } from "@itwin/core-bentley";
5
5
  import { LowAndHighXYZ, XAndY, XYAndZ } from "@itwin/core-geometry";
6
- import { ECSqlValueType, NavigationBindingValue, NavigationValue, QueryRowFormat } from "@itwin/core-common";
6
+ import { ECSqlValueType, NavigationBindingValue, NavigationValue, PropertyMetaDataMap, QueryRowFormat } from "@itwin/core-common";
7
7
  import { IModelJsNative } from "@bentley/imodeljs-native";
8
8
  /** The result of an **ECSQL INSERT** statement as returned from [ECSqlStatement.stepForInsert]($backend).
9
9
  *
@@ -240,6 +240,18 @@ export declare class ECSqlStatement implements IterableIterator<any>, Disposable
240
240
  * - [Code Samples]($docs/learning/backend/ECSQLCodeExamples#working-with-the-query-result)
241
241
  */
242
242
  getRow(args?: ECSqlRowArg): any;
243
+ /**
244
+ * Used by ECSqlRowExecutor to get row data as json with options determined by request parameters.
245
+ * @internal */
246
+ toRow(args: IModelJsNative.ECSqlRowAdaptorOptions): any;
247
+ /**
248
+ * Used by ECSqlRowExecutor to get metadata as json.
249
+ * @internal */
250
+ getMetadata(args: IModelJsNative.ECSqlRowAdaptorOptions): PropertyMetaDataMap;
251
+ /**
252
+ * Used by ECSqlRowExecutor to bind params to the statement.
253
+ * @internal */
254
+ bindParams(args: object): void;
243
255
  private formatCurrentRow;
244
256
  /** Calls step when called as an iterator.
245
257
  *
@@ -1 +1 @@
1
- {"version":3,"file":"ECSqlStatement.d.ts","sourceRoot":"","sources":["../../src/ECSqlStatement.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAU,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;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