@itwin/core-backend 5.12.0-dev.8 → 5.13.0-dev.1

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 (96) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/lib/cjs/ClassRegistry.d.ts.map +1 -1
  3. package/lib/cjs/ClassRegistry.js +1 -2
  4. package/lib/cjs/ClassRegistry.js.map +1 -1
  5. package/lib/cjs/ECDb.d.ts.map +1 -1
  6. package/lib/cjs/ECDb.js +8 -3
  7. package/lib/cjs/ECDb.js.map +1 -1
  8. package/lib/cjs/ECSqlRowExecutor.d.ts +23 -10
  9. package/lib/cjs/ECSqlRowExecutor.d.ts.map +1 -1
  10. package/lib/cjs/ECSqlRowExecutor.js +77 -15
  11. package/lib/cjs/ECSqlRowExecutor.js.map +1 -1
  12. package/lib/cjs/IModelDb.d.ts +20 -8
  13. package/lib/cjs/IModelDb.d.ts.map +1 -1
  14. package/lib/cjs/IModelDb.js +83 -54
  15. package/lib/cjs/IModelDb.js.map +1 -1
  16. package/lib/cjs/IpcHost.d.ts +26 -0
  17. package/lib/cjs/IpcHost.d.ts.map +1 -1
  18. package/lib/cjs/IpcHost.js +68 -61
  19. package/lib/cjs/IpcHost.js.map +1 -1
  20. package/lib/cjs/Relationship.d.ts.map +1 -1
  21. package/lib/cjs/Relationship.js +13 -7
  22. package/lib/cjs/Relationship.js.map +1 -1
  23. package/lib/cjs/SQLiteDb.d.ts +43 -0
  24. package/lib/cjs/SQLiteDb.d.ts.map +1 -1
  25. package/lib/cjs/SQLiteDb.js +51 -0
  26. package/lib/cjs/SQLiteDb.js.map +1 -1
  27. package/lib/cjs/ViewStore.js +1 -1
  28. package/lib/cjs/ViewStore.js.map +1 -1
  29. package/lib/cjs/internal/ECSqlInstanceReshaper.d.ts +23 -0
  30. package/lib/cjs/internal/ECSqlInstanceReshaper.d.ts.map +1 -0
  31. package/lib/cjs/internal/ECSqlInstanceReshaper.js +125 -0
  32. package/lib/cjs/internal/ECSqlInstanceReshaper.js.map +1 -0
  33. package/lib/cjs/internal/annotations/fields.d.ts.map +1 -1
  34. package/lib/cjs/internal/annotations/fields.js +9 -4
  35. package/lib/cjs/internal/annotations/fields.js.map +1 -1
  36. package/lib/esm/ClassRegistry.d.ts.map +1 -1
  37. package/lib/esm/ClassRegistry.js +1 -2
  38. package/lib/esm/ClassRegistry.js.map +1 -1
  39. package/lib/esm/ECDb.d.ts.map +1 -1
  40. package/lib/esm/ECDb.js +9 -4
  41. package/lib/esm/ECDb.js.map +1 -1
  42. package/lib/esm/ECSqlRowExecutor.d.ts +23 -10
  43. package/lib/esm/ECSqlRowExecutor.d.ts.map +1 -1
  44. package/lib/esm/ECSqlRowExecutor.js +77 -16
  45. package/lib/esm/ECSqlRowExecutor.js.map +1 -1
  46. package/lib/esm/IModelDb.d.ts +20 -8
  47. package/lib/esm/IModelDb.d.ts.map +1 -1
  48. package/lib/esm/IModelDb.js +85 -56
  49. package/lib/esm/IModelDb.js.map +1 -1
  50. package/lib/esm/IpcHost.d.ts +26 -0
  51. package/lib/esm/IpcHost.d.ts.map +1 -1
  52. package/lib/esm/IpcHost.js +70 -63
  53. package/lib/esm/IpcHost.js.map +1 -1
  54. package/lib/esm/Relationship.d.ts.map +1 -1
  55. package/lib/esm/Relationship.js +13 -7
  56. package/lib/esm/Relationship.js.map +1 -1
  57. package/lib/esm/SQLiteDb.d.ts +43 -0
  58. package/lib/esm/SQLiteDb.d.ts.map +1 -1
  59. package/lib/esm/SQLiteDb.js +51 -0
  60. package/lib/esm/SQLiteDb.js.map +1 -1
  61. package/lib/esm/ViewStore.js +1 -1
  62. package/lib/esm/ViewStore.js.map +1 -1
  63. package/lib/esm/internal/ECSqlInstanceReshaper.d.ts +23 -0
  64. package/lib/esm/internal/ECSqlInstanceReshaper.d.ts.map +1 -0
  65. package/lib/esm/internal/ECSqlInstanceReshaper.js +120 -0
  66. package/lib/esm/internal/ECSqlInstanceReshaper.js.map +1 -0
  67. package/lib/esm/internal/annotations/fields.d.ts.map +1 -1
  68. package/lib/esm/internal/annotations/fields.js +9 -4
  69. package/lib/esm/internal/annotations/fields.js.map +1 -1
  70. package/lib/esm/test/IpcHost.test.js +232 -1
  71. package/lib/esm/test/IpcHost.test.js.map +1 -1
  72. package/lib/esm/test/ecdb/ECSqlSyncReader.test.js +139 -1
  73. package/lib/esm/test/ecdb/ECSqlSyncReader.test.js.map +1 -1
  74. package/lib/esm/test/imodel/IModel.test.js +20 -0
  75. package/lib/esm/test/imodel/IModel.test.js.map +1 -1
  76. package/lib/esm/test/internal/ECSqlInstanceReshaper.test.d.ts +2 -0
  77. package/lib/esm/test/internal/ECSqlInstanceReshaper.test.d.ts.map +1 -0
  78. package/lib/esm/test/internal/ECSqlInstanceReshaper.test.js +289 -0
  79. package/lib/esm/test/internal/ECSqlInstanceReshaper.test.js.map +1 -0
  80. package/lib/esm/test/schema/ClassRegistry.test.js +2 -2
  81. package/lib/esm/test/schema/ClassRegistry.test.js.map +1 -1
  82. package/lib/esm/test/schema/SchemaViewFragmentLoading.test.d.ts +2 -0
  83. package/lib/esm/test/schema/SchemaViewFragmentLoading.test.d.ts.map +1 -0
  84. package/lib/esm/test/schema/SchemaViewFragmentLoading.test.js +546 -0
  85. package/lib/esm/test/schema/SchemaViewFragmentLoading.test.js.map +1 -0
  86. package/lib/esm/test/schema/SchemaViewLifecycle.test.js +2 -2
  87. package/lib/esm/test/schema/SchemaViewLifecycle.test.js.map +1 -1
  88. package/lib/esm/test/standalone/MergeConflict.test.js +1 -1
  89. package/lib/esm/test/standalone/MergeConflict.test.js.map +1 -1
  90. package/lib/esm/test/standalone/SQLiteDb.test.d.ts +1 -1
  91. package/lib/esm/test/standalone/SQLiteDb.test.d.ts.map +1 -1
  92. package/lib/esm/test/standalone/SQLiteDb.test.js +93 -1
  93. package/lib/esm/test/standalone/SQLiteDb.test.js.map +1 -1
  94. package/lib/esm/test/standalone/ViewStoreDb.test.js +30 -0
  95. package/lib/esm/test/standalone/ViewStoreDb.test.js.map +1 -1
  96. package/package.json +13 -13
@@ -1 +1 @@
1
- {"version":3,"file":"ECDb.js","sourceRoot":"","sources":["../../src/ECDb.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAElF,OAAO,EAAiC,WAAW,EAAE,WAAW,EAA6B,MAAM,oBAAoB,CAAC;AACxH,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,eAAe,EAA2B,MAAM,mBAAmB,CAAC;AAE7E,MAAM,cAAc,GAAW,qBAAqB,CAAC,IAAI,CAAC;AAE1D;;GAEG;AACH,MAAM,CAAN,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,uDAAQ,CAAA;IACR,yDAAS,CAAA;IACT,sGAAsG;IACtG,6DAAW,CAAA;AACb,CAAC,EALW,YAAY,KAAZ,YAAY,QAKvB;AAED;;GAEG;AACH,MAAM,OAAO,IAAI;IACP,SAAS,CAAuB;IACxC,4DAA4D;IAC3C,eAAe,GAAG,IAAI,cAAc,EAAkB,CAAC;IAChE,qBAAqB,GAAG,IAAI,cAAc,EAAmB,CAAC;IAEtE,wDAAwD;IACxC,aAAa,GAAG,IAAI,OAAO,EAAc,CAAC;IAE1D;;OAEG;IACI,gBAAgB,C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AAW,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1D,CAAC;IAED;;;;;;;;;;;;;SAaK;IACE,eAAe,CAAI,KAAa,EAAE,QAAwC,EAAE,MAAoB,EAAE,MAAgC;QACvI,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE;YAC3B,MAAM,IAAI,WAAW,CAAC,QAAQ,CAAC,uBAAuB,EAAE,aAAa,CAAC,CAAC;QAEzE,MAAM,QAAQ,GAAG,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAC5C,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QACpE,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;QACjD,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;YAC7B,IAAI,GAAG,YAAY,OAAO,EAAE,CAAC;gBAC3B,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC7B,CAAC;iBAAM,CAAC;gBACN,OAAO,EAAE,CAAC;YACZ,CAAC;YACD,OAAO,GAAG,CAAC;QACb,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,OAAO,EAAE,CAAC;YACV,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module ECDb\n */\nimport { assert, BeEvent, DbResult, Logger, OpenMode } from \"@itwin/core-bentley\";\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\nimport { DbQueryRequest, ECSchemaProps, ECSqlReader, IModelError, QueryBinder, QueryOptions } from \"@itwin/core-common\";\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\nimport { ConcurrentQuery } from \"./ConcurrentQuery\";\nimport { ECSqlStatement, ECSqlWriteStatement } from \"./ECSqlStatement\";\nimport { IModelNative } from \"./internal/NativePlatform\";\nimport { SqliteStatement, StatementCache } from \"./SqliteStatement\";\nimport { _nativeDb } from \"./internal/Symbols\";\nimport { ECSqlRowExecutor } from \"./ECSqlRowExecutor\";\nimport { ECSqlSyncReader, SynchronousQueryOptions } from \"./ECSqlSyncReader\";\n\nconst loggerCategory: string = BackendLoggerCategory.ECDb;\n\n/** Modes for how to open [ECDb]($backend) files.\n * @public\n */\nexport enum ECDbOpenMode {\n Readonly,\n ReadWrite,\n /** Opens the file read-write and upgrades the file if necessary to the latest file format version. */\n FileUpgrade,\n}\n\n/** An ECDb file\n * @public\n */\nexport class ECDb implements Disposable {\n private _nativeDb?: IModelJsNative.ECDb;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n private readonly _statementCache = new StatementCache<ECSqlStatement>();\n private _sqliteStatementCache = new StatementCache<SqliteStatement>();\n\n /** Event called when the ECDb is about to be closed. */\n public readonly onBeforeClose = new BeEvent<() => void>();\n\n /** only for tests\n * @internal\n */\n public resetSqliteCache(size: number) {\n this._sqliteStatementCache.clear();\n this._sqliteStatementCache = new StatementCache<SqliteStatement>(size);\n }\n\n constructor() {\n this._nativeDb = new IModelNative.platform.ECDb();\n }\n /** Call this function when finished with this ECDb object. This releases the native resources held by the\n * ECDb object.\n */\n public [Symbol.dispose](): void {\n if (!this._nativeDb)\n return;\n\n this.closeDb();\n this._nativeDb.dispose();\n this._nativeDb = undefined;\n }\n /**\n * Attach an iModel file to this connection and load and register its schemas.\n * @note There are some reserve tablespace names that cannot be used. They are 'main', 'schema_sync_db', 'ecchange' & 'temp'\n * @param fileName IModel file name\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'\n */\n public attachDb(fileName: string, alias: string): void {\n if (alias.toLowerCase() === \"main\" || alias.toLowerCase() === \"schema_sync_db\" || alias.toLowerCase() === \"ecchange\" || alias.toLowerCase() === \"temp\") {\n throw new IModelError(DbResult.BE_SQLITE_ERROR, \"Reserved tablespace name cannot be used\");\n }\n this[_nativeDb].attachDb(fileName, alias);\n }\n /**\n * Detach the attached file from this connection. The attached file is closed and its schemas are unregistered.\n * @note There are some reserve tablespace names that cannot be used. They are 'main', 'schema_sync_db', 'ecchange' & 'temp'\n * @param alias identifer that was used in the call to [[attachDb]]\n */\n public detachDb(alias: string): void {\n if (alias.toLowerCase() === \"main\" || alias.toLowerCase() === \"schema_sync_db\" || alias.toLowerCase() === \"ecchange\" || alias.toLowerCase() === \"temp\") {\n throw new IModelError(DbResult.BE_SQLITE_ERROR, \"Reserved tablespace name cannot be used\");\n }\n this.clearCaches();\n this[_nativeDb].detachDb(alias);\n }\n\n /** @deprecated in 5.0 - might be removed in next major version. Use [Symbol.dispose] instead. */\n public dispose(): void {\n this[Symbol.dispose]();\n }\n\n /** Create an ECDb\n * @param pathName The path to the ECDb file to create.\n * @throws [IModelError]($common) if the operation failed.\n */\n public createDb(pathName: string): void {\n const status: DbResult = this[_nativeDb].createDb(pathName);\n if (status !== DbResult.BE_SQLITE_OK)\n throw new IModelError(status, \"Failed to created ECDb\");\n }\n\n /** Open the ECDb.\n * @param pathName The path to the ECDb file to open\n * @param openMode Open mode\n * @throws [IModelError]($common) if the operation failed.\n */\n public openDb(pathName: string, openMode: ECDbOpenMode = ECDbOpenMode.Readonly): void {\n const nativeOpenMode: OpenMode = openMode === ECDbOpenMode.Readonly ? OpenMode.Readonly : OpenMode.ReadWrite;\n const tryUpgrade: boolean = openMode === ECDbOpenMode.FileUpgrade;\n const status: DbResult = this[_nativeDb].openDb(pathName, nativeOpenMode, tryUpgrade);\n if (status !== DbResult.BE_SQLITE_OK)\n throw new IModelError(status, \"Failed to open ECDb\");\n }\n\n /** Returns true if the ECDb is open */\n public get isOpen(): boolean { return this[_nativeDb].isOpen(); }\n\n /** Close the Db after saving any uncommitted changes.\n * @throws [IModelError]($common) if the database is not open.\n */\n public closeDb(): void {\n this.onBeforeClose.raiseEvent();\n this.clearCaches();\n this[_nativeDb].closeDb();\n }\n\n /** Clear all in-memory caches held in this ECDb.\n * @beta\n */\n public clearCaches(): void {\n this._statementCache.clear();\n this._sqliteStatementCache.clear();\n this[_nativeDb].clearECDbCache();\n }\n\n /** @internal use to test statement caching */\n public clearStatementCache() {\n this._statementCache.clear();\n }\n\n /** @internal use to test statement caching */\n public getCachedStatementCount() {\n return this._statementCache.size;\n }\n\n /** Commit the outermost transaction, writing changes to the file. Then, restart the transaction.\n * @param changesetName The name of the operation that generated these changes.\n * @throws [IModelError]($common) if the database is not open or if the operation failed.\n */\n public saveChanges(changesetName?: string): void {\n const status: DbResult = this[_nativeDb].saveChanges(changesetName);\n if (status !== DbResult.BE_SQLITE_OK)\n throw new IModelError(status, \"Failed to save changes\");\n }\n\n /** Abandon (cancel) the outermost transaction, discarding all changes since last save. Then, restart the transaction.\n * @throws [IModelError]($common) if the database is not open or if the operation failed.\n */\n public abandonChanges(): void {\n const status: DbResult = this[_nativeDb].abandonChanges();\n if (status !== DbResult.BE_SQLITE_OK)\n throw new IModelError(status, \"Failed to abandon changes\");\n }\n\n /** Import a schema.\n *\n * If the import was successful, the database is automatically saved to disk.\n * @param pathName Path to ECSchema XML file to import.\n * @throws [IModelError]($common) if the database is not open or if the operation failed.\n */\n public importSchema(pathName: string): void {\n const status: DbResult = this[_nativeDb].importSchema(pathName);\n if (status !== DbResult.BE_SQLITE_OK) {\n Logger.logError(loggerCategory, `Failed to import schema from '${pathName}'.`);\n throw new IModelError(status, `Failed to import schema from '${pathName}'.`);\n }\n this.clearCaches();\n }\n\n /** Removes unused schemas from the database.\n *\n * If the removal was successful, the database is automatically saved to disk.\n * @param schemaNames Array of schema names to drop\n * @throws [IModelError]($common) if the database if the operation failed.\n * @alpha\n */\n public dropSchemas(schemaNames: string[]): void {\n if (schemaNames.length === 0)\n return;\n if (this[_nativeDb].schemaSyncEnabled())\n throw new IModelError(DbResult.BE_SQLITE_ERROR, \"Cannot drop schemas when schema sync is enabled\");\n\n try {\n this[_nativeDb].dropSchemas(schemaNames);\n this.saveChanges('dropped unused schemas');\n } catch (error: any) {\n Logger.logError(loggerCategory, `Failed to drop schemas: ${error}`);\n this.abandonChanges();\n throw new IModelError(DbResult.BE_SQLITE_ERROR, `Failed to drop schemas: ${error}`);\n } finally {\n this.clearCaches();\n }\n }\n\n /**\n * Returns the full schema for the input name.\n * @param name The name of the schema e.g. 'ECDbMeta'\n * @returns The SchemaProps for the requested schema\n * @throws if the schema can not be found or loaded.\n */\n public getSchemaProps(name: string): ECSchemaProps {\n return this[_nativeDb].getSchemaProps(name);\n }\n\n /**\n * Use a prepared ECSQL statement, potentially from the statement cache. If the requested statement doesn't exist\n * in the statement cache, a new statement is prepared. After the callback completes, the statement is reset and saved\n * in the statement cache so it can be reused in the future. Use this method for ECSQL statements that will be\n * reused often and are expensive to prepare. The statement cache holds the most recently used statements, discarding\n * the oldest statements as it fills. For statements you don't intend to reuse, instead use [[withStatement]].\n * @param sql The SQLite SQL statement to execute\n * @param callback the callback to invoke on the prepared statement\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @returns the value returned by `callback`.\n * @see [[withWriteStatement]]\n * @beta\n */\n public withCachedWriteStatement<T>(ecsql: string, callback: (stmt: ECSqlWriteStatement) => T, logErrors = true): T {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const stmt = this._statementCache.findAndRemove(ecsql) ?? this.prepareStatement(ecsql, logErrors);\n const release = () => this._statementCache.addOrDispose(stmt);\n try {\n const val = callback(new ECSqlWriteStatement(stmt));\n if (val instanceof Promise) {\n val.then(release, release);\n } else {\n release();\n }\n return val;\n } catch (err) {\n release();\n throw err;\n }\n }\n\n /**\n * Prepared and execute a callback on an ECSQL statement. After the callback completes the statement is disposed.\n * Use this method for ECSQL statements are either not expected to be reused, or are not expensive to prepare.\n * For statements that will be reused often, instead use [[withPreparedStatement]].\n * @param sql The SQLite SQL statement to execute\n * @param callback the callback to invoke on the prepared statement\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @returns the value returned by `callback`.\n * @see [[withCachedWriteStatement]]\n * @beta\n */\n public withWriteStatement<T>(ecsql: string, callback: (stmt: ECSqlWriteStatement) => T, logErrors = true): T {\n const stmt = this.prepareWriteStatement(ecsql, logErrors);\n const release = () => stmt[Symbol.dispose]();\n try {\n const val = callback(stmt);\n if (val instanceof Promise) {\n val.then(release, release);\n } else {\n release();\n }\n return val;\n } catch (err) {\n release();\n throw err;\n }\n }\n\n /** Prepare an ECSQL statement.\n * @param ecsql The ECSQL statement to prepare\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @throws [IModelError]($common) if there is a problem preparing the statement.\n * @beta\n */\n public prepareWriteStatement(ecsql: string, logErrors = true): ECSqlWriteStatement {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return new ECSqlWriteStatement(this.prepareStatement(ecsql, logErrors));\n }\n\n /**\n * Use a prepared ECSQL statement, potentially from the statement cache. If the requested statement doesn't exist\n * in the statement cache, a new statement is prepared. After the callback completes, the statement is reset and saved\n * in the statement cache so it can be reused in the future. Use this method for ECSQL statements that will be\n * reused often and are expensive to prepare. The statement cache holds the most recently used statements, discarding\n * the oldest statements as it fills. For statements you don't intend to reuse, instead use [[withStatement]].\n * @param sql The SQLite SQL statement to execute\n * @param callback the callback to invoke on the prepared statement\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @returns the value returned by `callback`.\n * @see [[withStatement]]\n * @public\n * @deprecated in 4.11 - might be removed in next major version. Use [[createQueryReader]] for SELECT statements and [[withCachedWriteStatement]] for INSERT/UPDATE/DELETE instead.\n */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public withPreparedStatement<T>(ecsql: string, callback: (stmt: ECSqlStatement) => T, logErrors = true): T {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const stmt = this._statementCache.findAndRemove(ecsql) ?? this.prepareStatement(ecsql, logErrors);\n const release = () => this._statementCache.addOrDispose(stmt);\n try {\n const val = callback(stmt);\n if (val instanceof Promise) {\n val.then(release, release);\n } else {\n release();\n }\n return val;\n } catch (err) {\n release();\n throw err;\n }\n }\n\n /**\n * Prepared and execute a callback on an ECSQL statement. After the callback completes the statement is disposed.\n * Use this method for ECSQL statements are either not expected to be reused, or are not expensive to prepare.\n * For statements that will be reused often, instead use [[withPreparedStatement]].\n * @param sql The SQLite SQL statement to execute\n * @param callback the callback to invoke on the prepared statement\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @returns the value returned by `callback`.\n * @see [[withPreparedStatement]]\n * @public\n * @deprecated in 4.11 - might be removed in next major version. Use [[createQueryReader]] for SELECT statements and [[withWriteStatement]] for INSERT/UPDATE/DELETE instead.\n */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public withStatement<T>(ecsql: string, callback: (stmt: ECSqlStatement) => T, logErrors = true): T {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const stmt = this.prepareStatement(ecsql, logErrors);\n const release = () => stmt[Symbol.dispose]();\n try {\n const val = callback(stmt);\n if (val instanceof Promise) {\n val.then(release, release);\n } else {\n release();\n }\n return val;\n } catch (err) {\n release();\n throw err;\n }\n }\n\n /** Prepare an ECSQL statement.\n * @param ecsql The ECSQL statement to prepare\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @throws [IModelError]($common) if there is a problem preparing the statement.\n * @deprecated in 4.11 - might be removed in next major version. Use [[prepareWriteStatement]] when preparing an INSERT/UPDATE/DELETE statement or [[createQueryReader]] to execute a SELECT statement.\n */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public prepareStatement(ecsql: string, logErrors = true): ECSqlStatement {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const stmt = new ECSqlStatement();\n stmt.prepare(this[_nativeDb], ecsql, logErrors);\n return stmt;\n }\n\n /**\n * Use a prepared SQL statement, potentially from the statement cache. If the requested statement doesn't exist\n * in the statement cache, a new statement is prepared. After the callback completes, the statement is reset and saved\n * in the statement cache so it can be reused in the future. Use this method for SQL statements that will be\n * reused often and are expensive to prepare. The statement cache holds the most recently used statements, discarding\n * the oldest statements as it fills. For statements you don't intend to reuse, instead use [[withSqliteStatement]].\n * @param sql The SQLite SQL statement to execute\n * @param callback the callback to invoke on the prepared statement\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @returns the value returned by `callback`.\n * @see [[withPreparedStatement]]\n * @public\n */\n public withPreparedSqliteStatement<T>(sql: string, callback: (stmt: SqliteStatement) => T, logErrors = true): T {\n const stmt = this._sqliteStatementCache.findAndRemove(sql) ?? this.prepareSqliteStatement(sql, logErrors);\n const release = () => this._sqliteStatementCache.addOrDispose(stmt);\n try {\n const val: T = callback(stmt);\n if (val instanceof Promise) {\n val.then(release, release);\n } else {\n release();\n }\n return val;\n } catch (err) {\n release();\n throw err;\n }\n }\n\n /**\n * Prepared and execute a callback on a SQL statement. After the callback completes the statement is disposed.\n * Use this method for SQL statements are either not expected to be reused, or are not expensive to prepare.\n * For statements that will be reused often, instead use [[withPreparedSqliteStatement]].\n * @param sql The SQLite SQL statement to execute\n * @param callback the callback to invoke on the prepared statement\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @returns the value returned by `callback`.\n * @public\n */\n public withSqliteStatement<T>(sql: string, callback: (stmt: SqliteStatement) => T, logErrors = true): T {\n const stmt = this.prepareSqliteStatement(sql, logErrors);\n const release = () => stmt[Symbol.dispose]();\n try {\n const val: T = callback(stmt);\n if (val instanceof Promise) {\n val.then(release, release);\n } else {\n release();\n }\n return val;\n } catch (err) {\n release();\n throw err;\n }\n }\n\n /** Prepare an SQL statement.\n * @param sql The SQLite SQL statement to prepare\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @throws [IModelError]($common) if there is a problem preparing the statement.\n * @internal\n */\n public prepareSqliteStatement(sql: string, logErrors = true): SqliteStatement {\n const stmt = new SqliteStatement(sql);\n stmt.prepare(this[_nativeDb], logErrors);\n return stmt;\n }\n\n /** @internal */\n public get [_nativeDb](): IModelJsNative.ECDb {\n assert(undefined !== this._nativeDb);\n return this._nativeDb;\n }\n\n /** Allow to execute query and read results along with meta data. The result are streamed.\n *\n * See also:\n * - [ECSQL Overview]($docs/learning/backend/ExecutingECSQL)\n * - [Code Examples]($docs/learning/backend/ECSQLCodeExamples)\n * - [ECSQL Row Format]($docs/learning/ECSQLRowFormat)\n *\n * @param params The values to bind to the parameters (if the ECSQL has any).\n * @param config Allow to specify certain flags which control how query is executed.\n * @returns Returns an [ECSqlReader]($common) which helps iterate over the result set and also give access to metadata.\n * @public\n * */\n public createQueryReader(ecsql: string, params?: QueryBinder, config?: QueryOptions): ECSqlReader {\n if (!this._nativeDb || !this._nativeDb.isOpen()) {\n throw new IModelError(DbResult.BE_SQLITE_ERROR_NOTOPEN, \"db not open\");\n }\n const executor = {\n execute: async (request: DbQueryRequest) => {\n return ConcurrentQuery.executeQueryRequest(this[_nativeDb], request);\n },\n };\n return new ECSqlReader(executor, ecsql, params, config);\n }\n\n /** Allow to execute query and read results along with meta data. The result are stepped one by one.\n *\n * See also:\n * - [ECSQL Overview]($docs/learning/backend/ExecutingECSQL)\n * - [Code Examples]($docs/learning/backend/ECSQLCodeExamples)\n * - [ECSQL Row Format]($docs/learning/ECSQLRowFormat)\n * @param ecsql The ECSQL query to execute.\n * @param callback the callback to invoke on the prepared ECSqlSyncReader\n * @param params The values to bind to the parameters (if the ECSQL has any).\n * @param config Optional flags which control how query is executed.\n * @returns the value returned by `callback`.\n * @throws IModelError if db is not open or if error occurs during statement execution\n * @beta\n * */\n public withQueryReader<T>(ecsql: string, callback: (reader: ECSqlSyncReader) => T, params?: QueryBinder, config?: SynchronousQueryOptions): T {\n if (!this[_nativeDb].isOpen())\n throw new IModelError(DbResult.BE_SQLITE_ERROR_NOTOPEN, \"db not open\");\n\n const executor = new ECSqlRowExecutor(this);\n const reader = new ECSqlSyncReader(executor, ecsql, params, config);\n const release = () => executor[Symbol.dispose]();\n try {\n const val = callback(reader);\n if (val instanceof Promise) {\n val.then(release, release);\n } else {\n release();\n }\n return val;\n } catch (err: any) {\n release();\n throw err;\n }\n }\n}\n"]}
1
+ {"version":3,"file":"ECDb.js","sourceRoot":"","sources":["../../src/ECDb.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAElF,OAAO,EAAiC,WAAW,EAAE,WAAW,EAA6B,MAAM,oBAAoB,CAAC;AACxH,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAAE,eAAe,EAA2B,MAAM,mBAAmB,CAAC;AAE7E,MAAM,cAAc,GAAW,qBAAqB,CAAC,IAAI,CAAC;AAE1D;;GAEG;AACH,MAAM,CAAN,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,uDAAQ,CAAA;IACR,yDAAS,CAAA;IACT,sGAAsG;IACtG,6DAAW,CAAA;AACb,CAAC,EALW,YAAY,KAAZ,YAAY,QAKvB;AAED;;GAEG;AACH,MAAM,OAAO,IAAI;IACP,SAAS,CAAuB;IACxC,4DAA4D;IAC3C,eAAe,GAAG,IAAI,cAAc,EAAkB,CAAC;IAChE,qBAAqB,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,EAAE,CAAC;YAClB,OAAO,EAAE,CAAC;YACV,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module ECDb\n */\nimport { assert, BeEvent, DbResult, Logger, OpenMode } from \"@itwin/core-bentley\";\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\nimport { DbQueryRequest, ECSchemaProps, ECSqlReader, IModelError, QueryBinder, QueryOptions } from \"@itwin/core-common\";\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\nimport { ConcurrentQuery } from \"./ConcurrentQuery\";\nimport { ECSqlStatement, ECSqlWriteStatement } from \"./ECSqlStatement\";\nimport { IModelNative } from \"./internal/NativePlatform\";\nimport { SqliteStatement, StatementCache } from \"./SqliteStatement\";\nimport { _nativeDb } from \"./internal/Symbols\";\nimport { ECSqlRowExecutor, releaseECSqlStatement } from \"./ECSqlRowExecutor\";\nimport { ECSqlSyncReader, SynchronousQueryOptions } from \"./ECSqlSyncReader\";\n\nconst loggerCategory: string = BackendLoggerCategory.ECDb;\n\n/** Modes for how to open [ECDb]($backend) files.\n * @public\n */\nexport enum ECDbOpenMode {\n Readonly,\n ReadWrite,\n /** Opens the file read-write and upgrades the file if necessary to the latest file format version. */\n FileUpgrade,\n}\n\n/** An ECDb file\n * @public\n */\nexport class ECDb implements Disposable {\n private _nativeDb?: IModelJsNative.ECDb;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n private readonly _statementCache = new StatementCache<ECSqlStatement>();\n private _sqliteStatementCache = new StatementCache<SqliteStatement>();\n\n /** Event called when the ECDb is about to be closed. */\n public readonly onBeforeClose = new BeEvent<() => void>();\n\n /** only for tests\n * @internal\n */\n public resetSqliteCache(size: number) {\n this._sqliteStatementCache.clear();\n this._sqliteStatementCache = new StatementCache<SqliteStatement>(size);\n }\n\n constructor() {\n this._nativeDb = new IModelNative.platform.ECDb();\n }\n /** Call this function when finished with this ECDb object. This releases the native resources held by the\n * ECDb object.\n */\n public [Symbol.dispose](): void {\n if (!this._nativeDb)\n return;\n\n this.closeDb();\n this._nativeDb.dispose();\n this._nativeDb = undefined;\n }\n /**\n * Attach an iModel file to this connection and load and register its schemas.\n * @note There are some reserve tablespace names that cannot be used. They are 'main', 'schema_sync_db', 'ecchange' & 'temp'\n * @param fileName IModel file name\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'\n */\n public attachDb(fileName: string, alias: string): void {\n if (alias.toLowerCase() === \"main\" || alias.toLowerCase() === \"schema_sync_db\" || alias.toLowerCase() === \"ecchange\" || alias.toLowerCase() === \"temp\") {\n throw new IModelError(DbResult.BE_SQLITE_ERROR, \"Reserved tablespace name cannot be used\");\n }\n this[_nativeDb].attachDb(fileName, alias);\n }\n /**\n * Detach the attached file from this connection. The attached file is closed and its schemas are unregistered.\n * @note There are some reserve tablespace names that cannot be used. They are 'main', 'schema_sync_db', 'ecchange' & 'temp'\n * @param alias identifer that was used in the call to [[attachDb]]\n */\n public detachDb(alias: string): void {\n if (alias.toLowerCase() === \"main\" || alias.toLowerCase() === \"schema_sync_db\" || alias.toLowerCase() === \"ecchange\" || alias.toLowerCase() === \"temp\") {\n throw new IModelError(DbResult.BE_SQLITE_ERROR, \"Reserved tablespace name cannot be used\");\n }\n this.clearCaches();\n this[_nativeDb].detachDb(alias);\n }\n\n /** @deprecated in 5.0 - might be removed in next major version. Use [Symbol.dispose] instead. */\n public dispose(): void {\n this[Symbol.dispose]();\n }\n\n /** Create an ECDb\n * @param pathName The path to the ECDb file to create.\n * @throws [IModelError]($common) if the operation failed.\n */\n public createDb(pathName: string): void {\n const status: DbResult = this[_nativeDb].createDb(pathName);\n if (status !== DbResult.BE_SQLITE_OK)\n throw new IModelError(status, \"Failed to created ECDb\");\n }\n\n /** Open the ECDb.\n * @param pathName The path to the ECDb file to open\n * @param openMode Open mode\n * @throws [IModelError]($common) if the operation failed.\n */\n public openDb(pathName: string, openMode: ECDbOpenMode = ECDbOpenMode.Readonly): void {\n const nativeOpenMode: OpenMode = openMode === ECDbOpenMode.Readonly ? OpenMode.Readonly : OpenMode.ReadWrite;\n const tryUpgrade: boolean = openMode === ECDbOpenMode.FileUpgrade;\n const status: DbResult = this[_nativeDb].openDb(pathName, nativeOpenMode, tryUpgrade);\n if (status !== DbResult.BE_SQLITE_OK)\n throw new IModelError(status, \"Failed to open ECDb\");\n }\n\n /** Returns true if the ECDb is open */\n public get isOpen(): boolean { return this[_nativeDb].isOpen(); }\n\n /** Close the Db after saving any uncommitted changes.\n * @throws [IModelError]($common) if the database is not open.\n */\n public closeDb(): void {\n this.onBeforeClose.raiseEvent();\n this.clearCaches();\n this[_nativeDb].closeDb();\n }\n\n /** Clear all in-memory caches held in this ECDb.\n * @beta\n */\n public clearCaches(): void {\n this._statementCache.clear();\n this._sqliteStatementCache.clear();\n this[_nativeDb].clearECDbCache();\n }\n\n /** @internal use to test statement caching */\n public clearStatementCache() {\n this._statementCache.clear();\n }\n\n /** @internal use to test statement caching */\n public getCachedStatementCount() {\n return this._statementCache.size;\n }\n\n /** Commit the outermost transaction, writing changes to the file. Then, restart the transaction.\n * @param changesetName The name of the operation that generated these changes.\n * @throws [IModelError]($common) if the database is not open or if the operation failed.\n */\n public saveChanges(changesetName?: string): void {\n const status: DbResult = this[_nativeDb].saveChanges(changesetName);\n if (status !== DbResult.BE_SQLITE_OK)\n throw new IModelError(status, \"Failed to save changes\");\n }\n\n /** Abandon (cancel) the outermost transaction, discarding all changes since last save. Then, restart the transaction.\n * @throws [IModelError]($common) if the database is not open or if the operation failed.\n */\n public abandonChanges(): void {\n const status: DbResult = this[_nativeDb].abandonChanges();\n if (status !== DbResult.BE_SQLITE_OK)\n throw new IModelError(status, \"Failed to abandon changes\");\n }\n\n /** Import a schema.\n *\n * If the import was successful, the database is automatically saved to disk.\n * @param pathName Path to ECSchema XML file to import.\n * @throws [IModelError]($common) if the database is not open or if the operation failed.\n */\n public importSchema(pathName: string): void {\n const status: DbResult = this[_nativeDb].importSchema(pathName);\n if (status !== DbResult.BE_SQLITE_OK) {\n Logger.logError(loggerCategory, `Failed to import schema from '${pathName}'.`);\n throw new IModelError(status, `Failed to import schema from '${pathName}'.`);\n }\n this.clearCaches();\n }\n\n /** Removes unused schemas from the database.\n *\n * If the removal was successful, the database is automatically saved to disk.\n * @param schemaNames Array of schema names to drop\n * @throws [IModelError]($common) if the database if the operation failed.\n * @alpha\n */\n public dropSchemas(schemaNames: string[]): void {\n if (schemaNames.length === 0)\n return;\n if (this[_nativeDb].schemaSyncEnabled())\n throw new IModelError(DbResult.BE_SQLITE_ERROR, \"Cannot drop schemas when schema sync is enabled\");\n\n try {\n this[_nativeDb].dropSchemas(schemaNames);\n this.saveChanges('dropped unused schemas');\n } catch (error: any) {\n Logger.logError(loggerCategory, `Failed to drop schemas: ${error}`);\n this.abandonChanges();\n throw new IModelError(DbResult.BE_SQLITE_ERROR, `Failed to drop schemas: ${error}`);\n } finally {\n this.clearCaches();\n }\n }\n\n /**\n * Returns the full schema for the input name.\n * @param name The name of the schema e.g. 'ECDbMeta'\n * @returns The SchemaProps for the requested schema\n * @throws if the schema can not be found or loaded.\n */\n public getSchemaProps(name: string): ECSchemaProps {\n return this[_nativeDb].getSchemaProps(name);\n }\n\n /**\n * Use a prepared ECSQL statement, potentially from the statement cache. If the requested statement doesn't exist\n * in the statement cache, a new statement is prepared. After the callback completes, the statement is reset and saved\n * in the statement cache so it can be reused in the future. Use this method for ECSQL statements that will be\n * reused often and are expensive to prepare. The statement cache holds the most recently used statements, discarding\n * the oldest statements as it fills. For statements you don't intend to reuse, instead use [[withStatement]].\n * @param sql The SQLite SQL statement to execute\n * @param callback the callback to invoke on the prepared statement\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @returns the value returned by `callback`.\n * @see [[withWriteStatement]]\n * @beta\n */\n public withCachedWriteStatement<T>(ecsql: string, callback: (stmt: ECSqlWriteStatement) => T, logErrors = true): T {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const stmt = this._statementCache.findAndRemove(ecsql) ?? this.prepareStatement(ecsql, logErrors);\n const release = () => this._statementCache.addOrDispose(stmt);\n try {\n const val = callback(new ECSqlWriteStatement(stmt));\n if (val instanceof Promise) {\n val.then(release, release);\n } else {\n release();\n }\n return val;\n } catch (err) {\n release();\n throw err;\n }\n }\n\n /**\n * Prepared and execute a callback on an ECSQL statement. After the callback completes the statement is disposed.\n * Use this method for ECSQL statements are either not expected to be reused, or are not expensive to prepare.\n * For statements that will be reused often, instead use [[withPreparedStatement]].\n * @param sql The SQLite SQL statement to execute\n * @param callback the callback to invoke on the prepared statement\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @returns the value returned by `callback`.\n * @see [[withCachedWriteStatement]]\n * @beta\n */\n public withWriteStatement<T>(ecsql: string, callback: (stmt: ECSqlWriteStatement) => T, logErrors = true): T {\n const stmt = this.prepareWriteStatement(ecsql, logErrors);\n const release = () => stmt[Symbol.dispose]();\n try {\n const val = callback(stmt);\n if (val instanceof Promise) {\n val.then(release, release);\n } else {\n release();\n }\n return val;\n } catch (err) {\n release();\n throw err;\n }\n }\n\n /** Prepare an ECSQL statement.\n * @param ecsql The ECSQL statement to prepare\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @throws [IModelError]($common) if there is a problem preparing the statement.\n * @beta\n */\n public prepareWriteStatement(ecsql: string, logErrors = true): ECSqlWriteStatement {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return new ECSqlWriteStatement(this.prepareStatement(ecsql, logErrors));\n }\n\n /**\n * Use a prepared ECSQL statement, potentially from the statement cache. If the requested statement doesn't exist\n * in the statement cache, a new statement is prepared. After the callback completes, the statement is reset and saved\n * in the statement cache so it can be reused in the future. Use this method for ECSQL statements that will be\n * reused often and are expensive to prepare. The statement cache holds the most recently used statements, discarding\n * the oldest statements as it fills. For statements you don't intend to reuse, instead use [[withStatement]].\n * @param sql The SQLite SQL statement to execute\n * @param callback the callback to invoke on the prepared statement\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @returns the value returned by `callback`.\n * @see [[withStatement]]\n * @public\n * @deprecated in 4.11 - might be removed in next major version. Use [[createQueryReader]] for SELECT statements and [[withCachedWriteStatement]] for INSERT/UPDATE/DELETE instead.\n */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public withPreparedStatement<T>(ecsql: string, callback: (stmt: ECSqlStatement) => T, logErrors = true): T {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const stmt = this._statementCache.findAndRemove(ecsql) ?? this.prepareStatement(ecsql, logErrors);\n const release = () => this._statementCache.addOrDispose(stmt);\n try {\n const val = callback(stmt);\n if (val instanceof Promise) {\n val.then(release, release);\n } else {\n release();\n }\n return val;\n } catch (err) {\n release();\n throw err;\n }\n }\n\n /**\n * Prepared and execute a callback on an ECSQL statement. After the callback completes the statement is disposed.\n * Use this method for ECSQL statements are either not expected to be reused, or are not expensive to prepare.\n * For statements that will be reused often, instead use [[withPreparedStatement]].\n * @param sql The SQLite SQL statement to execute\n * @param callback the callback to invoke on the prepared statement\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @returns the value returned by `callback`.\n * @see [[withPreparedStatement]]\n * @public\n * @deprecated in 4.11 - might be removed in next major version. Use [[createQueryReader]] for SELECT statements and [[withWriteStatement]] for INSERT/UPDATE/DELETE instead.\n */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public withStatement<T>(ecsql: string, callback: (stmt: ECSqlStatement) => T, logErrors = true): T {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const stmt = this.prepareStatement(ecsql, logErrors);\n const release = () => stmt[Symbol.dispose]();\n try {\n const val = callback(stmt);\n if (val instanceof Promise) {\n val.then(release, release);\n } else {\n release();\n }\n return val;\n } catch (err) {\n release();\n throw err;\n }\n }\n\n /** Prepare an ECSQL statement.\n * @param ecsql The ECSQL statement to prepare\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @throws [IModelError]($common) if there is a problem preparing the statement.\n * @deprecated in 4.11 - might be removed in next major version. Use [[prepareWriteStatement]] when preparing an INSERT/UPDATE/DELETE statement or [[createQueryReader]] to execute a SELECT statement.\n */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public prepareStatement(ecsql: string, logErrors = true): ECSqlStatement {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const stmt = new ECSqlStatement();\n stmt.prepare(this[_nativeDb], ecsql, logErrors);\n return stmt;\n }\n\n /**\n * Use a prepared SQL statement, potentially from the statement cache. If the requested statement doesn't exist\n * in the statement cache, a new statement is prepared. After the callback completes, the statement is reset and saved\n * in the statement cache so it can be reused in the future. Use this method for SQL statements that will be\n * reused often and are expensive to prepare. The statement cache holds the most recently used statements, discarding\n * the oldest statements as it fills. For statements you don't intend to reuse, instead use [[withSqliteStatement]].\n * @param sql The SQLite SQL statement to execute\n * @param callback the callback to invoke on the prepared statement\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @returns the value returned by `callback`.\n * @see [[withPreparedStatement]]\n * @public\n */\n public withPreparedSqliteStatement<T>(sql: string, callback: (stmt: SqliteStatement) => T, logErrors = true): T {\n const stmt = this._sqliteStatementCache.findAndRemove(sql) ?? this.prepareSqliteStatement(sql, logErrors);\n const release = () => this._sqliteStatementCache.addOrDispose(stmt);\n try {\n const val: T = callback(stmt);\n if (val instanceof Promise) {\n val.then(release, release);\n } else {\n release();\n }\n return val;\n } catch (err) {\n release();\n throw err;\n }\n }\n\n /**\n * Prepared and execute a callback on a SQL statement. After the callback completes the statement is disposed.\n * Use this method for SQL statements are either not expected to be reused, or are not expensive to prepare.\n * For statements that will be reused often, instead use [[withPreparedSqliteStatement]].\n * @param sql The SQLite SQL statement to execute\n * @param callback the callback to invoke on the prepared statement\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @returns the value returned by `callback`.\n * @public\n */\n public withSqliteStatement<T>(sql: string, callback: (stmt: SqliteStatement) => T, logErrors = true): T {\n const stmt = this.prepareSqliteStatement(sql, logErrors);\n const release = () => stmt[Symbol.dispose]();\n try {\n const val: T = callback(stmt);\n if (val instanceof Promise) {\n val.then(release, release);\n } else {\n release();\n }\n return val;\n } catch (err) {\n release();\n throw err;\n }\n }\n\n /** Prepare an SQL statement.\n * @param sql The SQLite SQL statement to prepare\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @throws [IModelError]($common) if there is a problem preparing the statement.\n * @internal\n */\n public prepareSqliteStatement(sql: string, logErrors = true): SqliteStatement {\n const stmt = new SqliteStatement(sql);\n stmt.prepare(this[_nativeDb], logErrors);\n return stmt;\n }\n\n /** @internal */\n public get [_nativeDb](): IModelJsNative.ECDb {\n assert(undefined !== this._nativeDb);\n return this._nativeDb;\n }\n\n /** Allow to execute query and read results along with meta data. The result are streamed.\n *\n * See also:\n * - [ECSQL Overview]($docs/learning/backend/ExecutingECSQL)\n * - [Code Examples]($docs/learning/backend/ECSQLCodeExamples)\n * - [ECSQL Row Format]($docs/learning/ECSQLRowFormat)\n *\n * @param params The values to bind to the parameters (if the ECSQL has any).\n * @param config Allow to specify certain flags which control how query is executed.\n * @returns Returns an [ECSqlReader]($common) which helps iterate over the result set and also give access to metadata.\n * @public\n * */\n public createQueryReader(ecsql: string, params?: QueryBinder, config?: QueryOptions): ECSqlReader {\n if (!this._nativeDb || !this._nativeDb.isOpen()) {\n throw new IModelError(DbResult.BE_SQLITE_ERROR_NOTOPEN, \"db not open\");\n }\n const executor = {\n execute: async (request: DbQueryRequest) => {\n return ConcurrentQuery.executeQueryRequest(this[_nativeDb], request);\n },\n };\n return new ECSqlReader(executor, ecsql, params, config);\n }\n\n /** Allow to execute query and read results along with meta data. The result are stepped one by one.\n *\n * See also:\n * - [ECSQL Overview]($docs/learning/backend/ExecutingECSQL)\n * - [Code Examples]($docs/learning/backend/ECSQLCodeExamples)\n * - [ECSQL Row Format]($docs/learning/ECSQLRowFormat)\n * @param ecsql The ECSQL query to execute.\n * @param callback the callback to invoke on the prepared ECSqlSyncReader\n * @param params The values to bind to the parameters (if the ECSQL has any).\n * @param config Optional flags which control how query is executed.\n * @returns the value returned by `callback`.\n * @throws IModelError if db is not open or if error occurs during statement execution\n * @beta\n * */\n public withQueryReader<T>(ecsql: string, callback: (reader: ECSqlSyncReader) => T, params?: QueryBinder, config?: SynchronousQueryOptions): T {\n if (!this[_nativeDb].isOpen())\n throw new IModelError(DbResult.BE_SQLITE_ERROR_NOTOPEN, \"db not open\");\n\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const stmt = this._statementCache.findAndRemove(ecsql) ?? new ECSqlStatement();\n const executor = new ECSqlRowExecutor(this, stmt, loggerCategory);\n const release = () => {\n executor[Symbol.dispose]();\n releaseECSqlStatement(stmt, this._statementCache, loggerCategory, executor.canCacheStatement);\n };\n try {\n const reader = new ECSqlSyncReader(executor, ecsql, params, config);\n const val = callback(reader);\n if (val instanceof Promise) {\n val.then(release, release);\n } else {\n release();\n }\n return val;\n } catch (err: any) {\n release();\n throw err;\n }\n }\n}\n"]}
@@ -1,7 +1,13 @@
1
1
  import { QueryPropertyMetaData } from "@itwin/core-common";
2
- import { IModelDb } from "./IModelDb";
2
+ import type { IModelDb } from "./IModelDb";
3
+ import { ECSqlStatement } from "./ECSqlStatement";
3
4
  import { IModelJsNative } from "@bentley/imodeljs-native";
4
- import { ECDb } from "./ECDb";
5
+ import type { ECDb } from "./ECDb";
6
+ import type { StatementCache } from "./SqliteStatement";
7
+ /** Returns a statement to its cache, falling back to direct disposal without throwing.
8
+ * @internal
9
+ */
10
+ export declare function releaseECSqlStatement(stmt: ECSqlStatement, cache: StatementCache<ECSqlStatement>, loggerCategory: string, canCache: boolean): void;
5
11
  /**
6
12
  * Executes ECSql queries one row at a time against an IModelDb, maintaining statement state between
7
13
  * successive calls so the caller can page through results via offset-based requests.
@@ -9,15 +15,23 @@ import { ECDb } from "./ECDb";
9
15
  */
10
16
  export declare class ECSqlRowExecutor implements Disposable {
11
17
  private readonly _db;
12
- private _stmt;
18
+ private readonly _stmt;
19
+ private readonly _loggerCategory;
13
20
  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.
21
+ private _isDisposed;
22
+ private _canCacheStatement;
23
+ /** Whether the statement completed preparation and can be returned to its cache.
24
+ * @internal
25
+ */
26
+ get canCacheStatement(): boolean;
27
+ constructor(_db: IModelDb | ECDb, _stmt: ECSqlStatement, _loggerCategory: string);
28
+ /** Disposes the currently held statement without returning it to the cache.
29
+ * Invoked when the db signals it is closing (the statement cache is cleared on close, so the
30
+ * checked-out statement must be disposed directly to avoid a use-after-free or double dispose).
17
31
  * @internal
18
32
  */
19
33
  private cleanup;
20
- /** Call this function to dispose the row executor off.
34
+ /** Removes the database-close listener owned by this row executor.
21
35
  * @internal
22
36
  */
23
37
  [Symbol.dispose](): void;
@@ -49,14 +63,13 @@ export declare class ECSqlRowExecutor implements Disposable {
49
63
  * @internal
50
64
  */
51
65
  fetchMetadata(options: IModelJsNative.ECSqlRowAdaptorOptions): QueryPropertyMetaData[];
52
- /** Prepares the ECSql statement against the native database and records the elapsed preparation time.
66
+ /** Prepares the ECSql statement when the caller did not supply one from its cache.
53
67
  * @param ecsql - The ECSql text to prepare.
54
68
  * @returns An `OperationResult` indicating success or failure.
55
69
  * @internal
56
70
  */
57
71
  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.
72
+ /** Binds the supplied parameter values to the prepared statement.
60
73
  * @param args - The parameter object to bind, or `undefined` when no parameters are needed.
61
74
  * @returns An `OperationResult` indicating success or failure.
62
75
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"ECSqlRowExecutor.d.ts","sourceRoot":"","sources":["../../src/ECSqlRowExecutor.ts"],"names":[],"mappings":"AAKA,OAAO,EAAe,qBAAq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AAmB,CAAC;AAYxD;;GAEG;AAEH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,cAAc,CAAC,cAAc,CAAC,EAAE,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,IAAI,CAoBlJ;AAkBD;;;;GAIG;AACH,qBAAa,gBAAiB,YAAW,UAAU;IAW9B,OAAO,CAAC,QAAQ,CAAC,GAAG;IAAmB,OAAO,CAAC,QAAQ,CAAC,KAAK;IAAkB,OAAO,CAAC,QAAQ,CAAC,eAAe;IAVlI,OAAO,CAAC,eAAe,CAAa;IACpC,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,kBAAkB,CAAQ;IAElC;;OAEG;IACH,IAAW,iBAAiB,IAAI,OAAO,CAAoC;gBAGvC,GAAG,EAAE,QAAQ,GAAG,IAAI,EAAmB,KAAK,EAAE,cAAc,EAAmB,eAAe,EAAE,MAAM;IAQ1I;;;;OAIG;IACH,OAAO,CAAC,OAAO;IASf;;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;IAU7F;;;;OAIG;IACH,OAAO,CAAC,WAAW;IAkBnB;;;;OAIG;IACH,OAAO,CAAC,UAAU;CAcnB"}
@@ -3,9 +3,44 @@
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import { IModelError } from "@itwin/core-common";
6
- import { ECSqlStatement } from "./ECSqlStatement";
7
- import { DbResult } from "@itwin/core-bentley";
6
+ import { BentleyError, DbResult, Logger } from "@itwin/core-bentley";
8
7
  import { _nativeDb } from "./internal/Symbols";
8
+ const statementNotPreparedMessage = "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.";
9
+ function logStatementCleanupError(loggerCategory, message, error) {
10
+ try {
11
+ Logger.logTrace(loggerCategory, message, () => ({ error: BentleyError.getErrorMessage(error) }));
12
+ }
13
+ catch {
14
+ // Cleanup diagnostics must not replace the original query error.
15
+ }
16
+ }
17
+ /** Returns a statement to its cache, falling back to direct disposal without throwing.
18
+ * @internal
19
+ */
20
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
21
+ export function releaseECSqlStatement(stmt, cache, loggerCategory, canCache) {
22
+ if (!canCache || !stmt.isPrepared) {
23
+ try {
24
+ stmt[Symbol.dispose]();
25
+ }
26
+ catch (error) {
27
+ logStatementCleanupError(loggerCategory, "Failed to dispose an ECSQL statement that could not be cached.", error);
28
+ }
29
+ return;
30
+ }
31
+ try {
32
+ cache.addOrDispose(stmt);
33
+ }
34
+ catch (error) {
35
+ try {
36
+ stmt[Symbol.dispose]();
37
+ }
38
+ catch (disposeError) {
39
+ logStatementCleanupError(loggerCategory, "Failed to dispose an ECSQL statement after it could not be returned to the statement cache.", disposeError);
40
+ }
41
+ logStatementCleanupError(loggerCategory, "Failed to return an ECSQL statement to the statement cache; attempted direct disposal instead.", error);
42
+ }
43
+ }
9
44
  // --------------------------------------------------------------------------------------------
10
45
  // ECSqlRowExecutor
11
46
  // --------------------------------------------------------------------------------------------
@@ -16,31 +51,45 @@ import { _nativeDb } from "./internal/Symbols";
16
51
  */
17
52
  export class ECSqlRowExecutor {
18
53
  _db;
19
- // eslint-disable-next-line @typescript-eslint/no-deprecated
20
54
  _stmt;
55
+ _loggerCategory;
21
56
  _removeListener;
22
- constructor(_db) {
57
+ _isDisposed = false;
58
+ _canCacheStatement = true;
59
+ /** Whether the statement completed preparation and can be returned to its cache.
60
+ * @internal
61
+ */
62
+ get canCacheStatement() { return this._canCacheStatement; }
63
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
64
+ constructor(_db, _stmt, _loggerCategory) {
23
65
  this._db = _db;
24
- // eslint-disable-next-line @typescript-eslint/no-deprecated
25
- this._stmt = new ECSqlStatement();
66
+ this._stmt = _stmt;
67
+ this._loggerCategory = _loggerCategory;
26
68
  this._removeListener = this._db.onBeforeClose.addListener(() => this.cleanup());
27
69
  }
28
70
  // --------------------------------------------------------------------------------------------
29
71
  // Lifecycle
30
72
  // --------------------------------------------------------------------------------------------
31
- /** Disposes the current statement and resets all internal state.
32
- * Invoked when the db signals that the executor must be recycled.
73
+ /** Disposes the currently held statement without returning it to the cache.
74
+ * Invoked when the db signals it is closing (the statement cache is cleared on close, so the
75
+ * checked-out statement must be disposed directly to avoid a use-after-free or double dispose).
33
76
  * @internal
34
77
  */
35
78
  cleanup() {
36
- this._stmt[Symbol.dispose]();
79
+ this._isDisposed = true;
80
+ try {
81
+ this._stmt[Symbol.dispose]();
82
+ }
83
+ catch (error) {
84
+ logStatementCleanupError(this._loggerCategory, "Failed to dispose an ECSQL statement while closing its database.", error);
85
+ }
37
86
  }
38
- /** Call this function to dispose the row executor off.
87
+ /** Removes the database-close listener owned by this row executor.
39
88
  * @internal
40
89
  */
41
90
  [Symbol.dispose]() {
91
+ this._isDisposed = true;
42
92
  this._removeListener();
43
- this.cleanup();
44
93
  }
45
94
  // --------------------------------------------------------------------------------------------
46
95
  // Core execution
@@ -75,8 +124,8 @@ export class ECSqlRowExecutor {
75
124
  * @internal
76
125
  */
77
126
  stepNextRow(options) {
78
- if (!this._stmt.isPrepared)
79
- 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.");
127
+ if (this._isDisposed || !this._stmt.isPrepared)
128
+ throw new IModelError(DbResult.BE_SQLITE_ERROR, statementNotPreparedMessage);
80
129
  const stepResult = this._stmt.step();
81
130
  if (stepResult === DbResult.BE_SQLITE_ROW)
82
131
  return this._stmt.toRow(options).data;
@@ -91,27 +140,37 @@ export class ECSqlRowExecutor {
91
140
  * @internal
92
141
  */
93
142
  fetchMetadata(options) {
143
+ if (this._isDisposed || !this._stmt.isPrepared)
144
+ throw new IModelError(DbResult.BE_SQLITE_ERROR, statementNotPreparedMessage);
94
145
  return this._stmt.getMetadata(options).properties;
95
146
  }
96
147
  // --------------------------------------------------------------------------------------------
97
148
  // Execution phases
98
149
  // --------------------------------------------------------------------------------------------
99
- /** Prepares the ECSql statement against the native database and records the elapsed preparation time.
150
+ /** Prepares the ECSql statement when the caller did not supply one from its cache.
100
151
  * @param ecsql - The ECSql text to prepare.
101
152
  * @returns An `OperationResult` indicating success or failure.
102
153
  * @internal
103
154
  */
104
155
  prepareStmt(ecsql) {
156
+ if (this._stmt.isPrepared)
157
+ return { isSuccessful: true };
105
158
  try {
106
159
  this._stmt.prepare(this._db[_nativeDb], ecsql);
107
160
  return { isSuccessful: true };
108
161
  }
109
162
  catch (error) {
163
+ this._canCacheStatement = false;
164
+ try {
165
+ this._stmt[Symbol.dispose]();
166
+ }
167
+ catch (disposeError) {
168
+ logStatementCleanupError(this._loggerCategory, "Failed to dispose an ECSQL statement after preparation failed.", disposeError);
169
+ }
110
170
  return { isSuccessful: false, message: error.message };
111
171
  }
112
172
  }
113
- /** Resets the statement and binds the given parameter values. Caches the arguments for later
114
- * comparison so that redundant rebinds can be skipped.
173
+ /** Binds the supplied parameter values to the prepared statement.
115
174
  * @param args - The parameter object to bind, or `undefined` when no parameters are needed.
116
175
  * @returns An `OperationResult` indicating success or failure.
117
176
  * @internal
@@ -120,6 +179,8 @@ export class ECSqlRowExecutor {
120
179
  try {
121
180
  if (args === undefined)
122
181
  return { isSuccessful: true };
182
+ if (!this._stmt.isPrepared)
183
+ return { isSuccessful: false, message: statementNotPreparedMessage };
123
184
  this._stmt.bindParams(args);
124
185
  return { isSuccessful: true };
125
186
  }
@@ -1 +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,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;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","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport { IModelError, QueryPropertyMetaData } from \"@itwin/core-common\";\nimport { IModelDb } from \"./IModelDb\";\nimport { ECSqlStatement } from \"./ECSqlStatement\";\nimport { DbResult } from \"@itwin/core-bentley\";\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\nimport { _nativeDb } from \"./internal/Symbols\";\nimport { ECDb } from \"./ECDb\";\n\n// --------------------------------------------------------------------------------------------\n// Internal result types\n// --------------------------------------------------------------------------------------------\n\n/** Result of an internal operation that may fail with a message.\n * @internal\n */\ninterface OperationResult {\n isSuccessful: boolean;\n message?: string;\n}\n\n// --------------------------------------------------------------------------------------------\n// ECSqlRowExecutor\n// --------------------------------------------------------------------------------------------\n\n/**\n * Executes ECSql queries one row at a time against an IModelDb, maintaining statement state between\n * successive calls so the caller can page through results via offset-based requests.\n * @internal\n */\nexport class ECSqlRowExecutor implements Disposable {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n private _stmt: ECSqlStatement;\n private _removeListener: () => void;\n\n public constructor(private readonly _db: IModelDb | ECDb) {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n this._stmt = new ECSqlStatement();\n this._removeListener = this._db.onBeforeClose.addListener(() => this.cleanup());\n }\n\n // --------------------------------------------------------------------------------------------\n // Lifecycle\n // --------------------------------------------------------------------------------------------\n\n /** Disposes the current statement and resets all internal state.\n * Invoked when the db signals that the executor must be recycled.\n * @internal\n */\n private cleanup(): void {\n this._stmt[Symbol.dispose]();\n }\n\n /** Call this function to dispose the row executor off.\n * @internal\n */\n public [Symbol.dispose](): void {\n this._removeListener();\n this.cleanup();\n }\n\n // --------------------------------------------------------------------------------------------\n // Core execution\n // --------------------------------------------------------------------------------------------\n\n /** Prepare the statement and bind parameters in one step.\n * Call once during reader initialization — avoids the per-row `ensureStatementReady` check.\n * @param query - The ECSql text to prepare.\n * @param args - Optional bind parameters.\n * @throws IModelError on preparation or binding failure.\n * @internal\n */\n public prepareAndBind(query: string, args?: object): void {\n\n const prepResult = this.prepareStmt(query);\n if (!prepResult.isSuccessful)\n throw new IModelError(DbResult.BE_SQLITE_ERROR, prepResult.message ?? `Failed to prepare statement: ${query}`);\n\n if (args) {\n const bindResult = this.bindValues(args);\n if (!bindResult.isSuccessful)\n throw new IModelError(DbResult.BE_SQLITE_ERROR, bindResult.message ?? `Failed to bind values: ${query}`);\n }\n }\n\n /** Fast-path: step the cursor once and return row data directly.\n *\n * Returns the row data array if a row is available.\n * Returns `undefined` if the result set is exhausted (DONE).\n *\n * This avoids all intermediate object allocations (StepResult, RowDataResult,\n * DbRuntimeStats, DbQueryResponse) that the general `execute()` path creates per row.\n *\n * @param options - Native row-adaptor options (should be cached and reused across rows).\n * @throws IModelError on step failure or row extraction failure.\n * @internal\n */\n public stepNextRow(options: IModelJsNative.ECSqlRowAdaptorOptions): any {\n if (!this._stmt.isPrepared)\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.\");\n const stepResult = this._stmt.step();\n if (stepResult === DbResult.BE_SQLITE_ROW)\n return this._stmt.toRow(options).data;\n if (stepResult === DbResult.BE_SQLITE_DONE)\n return undefined;\n throw new IModelError(stepResult, `Step failed with code ${stepResult}`);\n }\n\n /** Get column metadata directly from the prepared statement.\n * Call once after `prepareAndBind` — the metadata does not change between rows.\n * @param options - Native row-adaptor options that influence property naming.\n * @returns Array of column metadata.\n * @internal\n */\n public fetchMetadata(options: IModelJsNative.ECSqlRowAdaptorOptions): QueryPropertyMetaData[] {\n return this._stmt.getMetadata(options).properties;\n }\n\n // --------------------------------------------------------------------------------------------\n // Execution phases\n // --------------------------------------------------------------------------------------------\n\n /** Prepares the ECSql statement against the native database and records the elapsed preparation time.\n * @param ecsql - The ECSql text to prepare.\n * @returns An `OperationResult` indicating success or failure.\n * @internal\n */\n private prepareStmt(ecsql: string): OperationResult {\n try {\n this._stmt.prepare(this._db[_nativeDb], ecsql);\n return { isSuccessful: true };\n } catch (error: any) {\n return { isSuccessful: false, message: error.message };\n }\n }\n\n /** Resets the statement and binds the given parameter values. Caches the arguments for later\n * comparison so that redundant rebinds can be skipped.\n * @param args - The parameter object to bind, or `undefined` when no parameters are needed.\n * @returns An `OperationResult` indicating success or failure.\n * @internal\n */\n private bindValues(args: object | undefined): OperationResult {\n try {\n if (args === undefined)\n return { isSuccessful: true };\n\n this._stmt.bindParams(args);\n return { isSuccessful: true };\n } catch (error: any) {\n return { isSuccessful: false, message: error.message };\n }\n }\n}"]}
1
+ {"version":3,"file":"ECSqlRowExecutor.js","sourceRoot":"","sources":["../../src/ECSqlRowExecutor.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,WAAW,EAAyB,MAAM,oBAAoB,CAAC;AAGxE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE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esContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport { IModelError, QueryPropertyMetaData } from \"@itwin/core-common\";\nimport type { IModelDb } from \"./IModelDb\";\nimport { ECSqlStatement } from \"./ECSqlStatement\";\nimport { BentleyError, DbResult, Logger } from \"@itwin/core-bentley\";\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\nimport { _nativeDb } from \"./internal/Symbols\";\nimport type { ECDb } from \"./ECDb\";\nimport type { StatementCache } from \"./SqliteStatement\";\n\nconst statementNotPreparedMessage = \"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.\";\n\nfunction logStatementCleanupError(loggerCategory: string, message: string, error: unknown): void {\n try {\n Logger.logTrace(loggerCategory, message, () => ({ error: BentleyError.getErrorMessage(error) }));\n } catch {\n // Cleanup diagnostics must not replace the original query error.\n }\n}\n\n/** Returns a statement to its cache, falling back to direct disposal without throwing.\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport function releaseECSqlStatement(stmt: ECSqlStatement, cache: StatementCache<ECSqlStatement>, loggerCategory: string, canCache: boolean): void {\n if (!canCache || !stmt.isPrepared) {\n try {\n stmt[Symbol.dispose]();\n } catch (error) {\n logStatementCleanupError(loggerCategory, \"Failed to dispose an ECSQL statement that could not be cached.\", error);\n }\n return;\n }\n\n try {\n cache.addOrDispose(stmt);\n } catch (error) {\n try {\n stmt[Symbol.dispose]();\n } catch (disposeError) {\n logStatementCleanupError(loggerCategory, \"Failed to dispose an ECSQL statement after it could not be returned to the statement cache.\", disposeError);\n }\n logStatementCleanupError(loggerCategory, \"Failed to return an ECSQL statement to the statement cache; attempted direct disposal instead.\", error);\n }\n}\n\n// --------------------------------------------------------------------------------------------\n// Internal result types\n// --------------------------------------------------------------------------------------------\n\n/** Result of an internal operation that may fail with a message.\n * @internal\n */\ninterface OperationResult {\n isSuccessful: boolean;\n message?: string;\n}\n\n// --------------------------------------------------------------------------------------------\n// ECSqlRowExecutor\n// --------------------------------------------------------------------------------------------\n\n/**\n * Executes ECSql queries one row at a time against an IModelDb, maintaining statement state between\n * successive calls so the caller can page through results via offset-based requests.\n * @internal\n */\nexport class ECSqlRowExecutor implements Disposable {\n private _removeListener: () => void;\n private _isDisposed = false;\n private _canCacheStatement = true;\n\n /** Whether the statement completed preparation and can be returned to its cache.\n * @internal\n */\n public get canCacheStatement(): boolean { return this._canCacheStatement; }\n\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public constructor(private readonly _db: IModelDb | ECDb, private readonly _stmt: ECSqlStatement, private readonly _loggerCategory: string) {\n this._removeListener = this._db.onBeforeClose.addListener(() => this.cleanup());\n }\n\n // --------------------------------------------------------------------------------------------\n // Lifecycle\n // --------------------------------------------------------------------------------------------\n\n /** Disposes the currently held statement without returning it to the cache.\n * Invoked when the db signals it is closing (the statement cache is cleared on close, so the\n * checked-out statement must be disposed directly to avoid a use-after-free or double dispose).\n * @internal\n */\n private cleanup(): void {\n this._isDisposed = true;\n try {\n this._stmt[Symbol.dispose]();\n } catch (error) {\n logStatementCleanupError(this._loggerCategory, \"Failed to dispose an ECSQL statement while closing its database.\", error);\n }\n }\n\n /** Removes the database-close listener owned by this row executor.\n * @internal\n */\n public [Symbol.dispose](): void {\n this._isDisposed = true;\n this._removeListener();\n }\n\n // --------------------------------------------------------------------------------------------\n // Core execution\n // --------------------------------------------------------------------------------------------\n\n /** Prepare the statement and bind parameters in one step.\n * Call once during reader initialization — avoids the per-row `ensureStatementReady` check.\n * @param query - The ECSql text to prepare.\n * @param args - Optional bind parameters.\n * @throws IModelError on preparation or binding failure.\n * @internal\n */\n public prepareAndBind(query: string, args?: object): void {\n\n const prepResult = this.prepareStmt(query);\n if (!prepResult.isSuccessful)\n throw new IModelError(DbResult.BE_SQLITE_ERROR, prepResult.message ?? `Failed to prepare statement: ${query}`);\n\n if (args) {\n const bindResult = this.bindValues(args);\n if (!bindResult.isSuccessful)\n throw new IModelError(DbResult.BE_SQLITE_ERROR, bindResult.message ?? `Failed to bind values: ${query}`);\n }\n }\n\n /** Fast-path: step the cursor once and return row data directly.\n *\n * Returns the row data array if a row is available.\n * Returns `undefined` if the result set is exhausted (DONE).\n *\n * This avoids all intermediate object allocations (StepResult, RowDataResult,\n * DbRuntimeStats, DbQueryResponse) that the general `execute()` path creates per row.\n *\n * @param options - Native row-adaptor options (should be cached and reused across rows).\n * @throws IModelError on step failure or row extraction failure.\n * @internal\n */\n public stepNextRow(options: IModelJsNative.ECSqlRowAdaptorOptions): any {\n if (this._isDisposed || !this._stmt.isPrepared)\n throw new IModelError(DbResult.BE_SQLITE_ERROR, statementNotPreparedMessage);\n const stepResult = this._stmt.step();\n if (stepResult === DbResult.BE_SQLITE_ROW)\n return this._stmt.toRow(options).data;\n if (stepResult === DbResult.BE_SQLITE_DONE)\n return undefined;\n throw new IModelError(stepResult, `Step failed with code ${stepResult}`);\n }\n\n /** Get column metadata directly from the prepared statement.\n * Call once after `prepareAndBind` — the metadata does not change between rows.\n * @param options - Native row-adaptor options that influence property naming.\n * @returns Array of column metadata.\n * @internal\n */\n public fetchMetadata(options: IModelJsNative.ECSqlRowAdaptorOptions): QueryPropertyMetaData[] {\n if (this._isDisposed || !this._stmt.isPrepared)\n throw new IModelError(DbResult.BE_SQLITE_ERROR, statementNotPreparedMessage);\n return this._stmt.getMetadata(options).properties;\n }\n\n // --------------------------------------------------------------------------------------------\n // Execution phases\n // --------------------------------------------------------------------------------------------\n\n /** Prepares the ECSql statement when the caller did not supply one from its cache.\n * @param ecsql - The ECSql text to prepare.\n * @returns An `OperationResult` indicating success or failure.\n * @internal\n */\n private prepareStmt(ecsql: string): OperationResult {\n if (this._stmt.isPrepared)\n return { isSuccessful: true };\n\n try {\n this._stmt.prepare(this._db[_nativeDb], ecsql);\n return { isSuccessful: true };\n } catch (error: any) {\n this._canCacheStatement = false;\n try {\n this._stmt[Symbol.dispose]();\n } catch (disposeError) {\n logStatementCleanupError(this._loggerCategory, \"Failed to dispose an ECSQL statement after preparation failed.\", disposeError);\n }\n return { isSuccessful: false, message: error.message };\n }\n }\n\n /** Binds the supplied parameter values to the prepared statement.\n * @param args - The parameter object to bind, or `undefined` when no parameters are needed.\n * @returns An `OperationResult` indicating success or failure.\n * @internal\n */\n private bindValues(args: object | undefined): OperationResult {\n try {\n if (args === undefined)\n return { isSuccessful: true };\n\n if (!this._stmt.isPrepared)\n return { isSuccessful: false, message: statementNotPreparedMessage };\n\n this._stmt.bindParams(args);\n return { isSuccessful: true };\n } catch (error: any) {\n return { isSuccessful: false, message: error.message };\n }\n }\n}"]}
@@ -32,7 +32,7 @@ import { LockControl } from "./LockControl";
32
32
  import type { BlobContainer } from "./BlobContainerService";
33
33
  import { IModelDbFonts } from "./IModelDbFonts";
34
34
  import { _activeTxn, _cache, _implicitTxn, _instanceKeyCache, _nativeDb, _resetIModelDb } from "./internal/Symbols";
35
- import { ECSpecVersion, ECVersion, SchemaContext, SchemaView } from "@itwin/ecschema-metadata";
35
+ import { ECSpecVersion, ECVersion, type GetSchemaViewArgs, SchemaContext, SchemaView } from "@itwin/ecschema-metadata";
36
36
  import { SchemaMap } from "./Schema";
37
37
  import { ElementLRUCache, InstanceKeyLRUCache } from "./internal/ElementLRUCache";
38
38
  import { IntegrityCheckResult } from "./internal/IntegrityCheck";
@@ -332,7 +332,7 @@ export declare abstract class IModelDb extends IModel {
332
332
  private _jsClassMap?;
333
333
  private _schemaMap?;
334
334
  private _schemaContext?;
335
- private _schemasPromise?;
335
+ private _schemaViewManager?;
336
336
  /** @deprecated in 5.0.0 - might be removed in next major version. Use [[fonts]]. */
337
337
  protected _fontMap?: FontMap;
338
338
  private readonly _fonts;
@@ -580,7 +580,8 @@ export declare abstract class IModelDb extends IModel {
580
580
  * @param config Allow to specify certain flags which control how query is executed.
581
581
  * @returns the value returned by `callback`.
582
582
  * @throws IModelError if db is not open.
583
- * Should be used when we want true step by step behaviour from the reader without any intermediate caching involved.
583
+ * Use this method for true step-by-step row consumption without intermediate result or page caching.
584
+ * The prepared ECSQL statement may be reused from the statement cache between completed calls.
584
585
  * @beta
585
586
  * */
586
587
  withQueryReader<T>(ecsql: string, callback: (reader: ECSqlSyncReader) => T, params?: QueryBinder, config?: SynchronousQueryOptions): T;
@@ -828,19 +829,30 @@ export declare abstract class IModelDb extends IModel {
828
829
  */
829
830
  get schemaContext(): SchemaContext;
830
831
  /** Get the schema view for this iModel. The view is built lazily on
831
- * first call by fetching compact binary schema data via `PRAGMA schema_view` through
832
- * the ConcurrentQuery thread pool. Subsequent calls return the cached view. Multiple
833
- * concurrent callers share a single in-flight build.
832
+ * first call by fetching compact binary schema data through
833
+ * the ConcurrentQuery thread pool.
834
834
  *
835
835
  * The returned `SchemaView` is a lightweight, read-only, synchronous API for
836
836
  * navigating schema metadata - classes, properties, relationships, enumerations, etc.
837
837
  * It is the recommended default for runtime read-only metadata access and is significantly
838
838
  * faster and lower-memory than [[schemaContext]]. Use [[schemaContext]] for schema authoring,
839
839
  * custom-attribute deserialization, or anywhere you need the full ecschema-metadata object graph.
840
+ *
841
+ * Every call shares one accumulating view instance and concurrent calls are serialized, so a
842
+ * caller never observes a partially loaded view. The instance is discarded by [[clearCaches]],
843
+ * for example after a schema import; the next call builds a new one. See
844
+ * [GetSchemaViewArgs]($ecschema-metadata) for the arguments.
840
845
  * @beta
841
846
  */
842
- getSchemaView(): Promise<SchemaView>;
843
- private _hydrateSchemas;
847
+ getSchemaView(args?: GetSchemaViewArgs): Promise<SchemaView>;
848
+ /** The [SchemaViewDataProvider]($ecschema-metadata) backing this iModel's [[getSchemaView]]: the
849
+ * transport-specific half of schema-view loading. The backend always uses the latest blob version
850
+ * since it is strictly coupled with native code.
851
+ */
852
+ private _createSchemaViewDataProvider;
853
+ /** Fetch one schema-view blob (full or fragment). Both `PRAGMA schema_view` and
854
+ * `PRAGMA schema_view_fragment` return a single row with the same columns. */
855
+ private _fetchSchemaBlob;
844
856
  /** Get the linkTableRelationships for this IModel */
845
857
  get relationships(): Relationships;
846
858
  /** Get the CodeSpecs in this IModel. */