@itwin/core-backend 3.0.0-dev.100
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.
- package/CHANGELOG.md +1525 -0
- package/LICENSE.md +9 -0
- package/README.md +11 -0
- package/lib/cjs/AliCloudStorageService.d.ts +12 -0
- package/lib/cjs/AliCloudStorageService.d.ts.map +1 -0
- package/lib/cjs/AliCloudStorageService.js +70 -0
- package/lib/cjs/AliCloudStorageService.js.map +1 -0
- package/lib/cjs/BackendHubAccess.d.ts +208 -0
- package/lib/cjs/BackendHubAccess.d.ts.map +1 -0
- package/lib/cjs/BackendHubAccess.js +42 -0
- package/lib/cjs/BackendHubAccess.js.map +1 -0
- package/lib/cjs/BackendLoggerCategory.d.ts +83 -0
- package/lib/cjs/BackendLoggerCategory.d.ts.map +1 -0
- package/lib/cjs/BackendLoggerCategory.js +91 -0
- package/lib/cjs/BackendLoggerCategory.js.map +1 -0
- package/lib/cjs/BisCoreSchema.d.ts +22 -0
- package/lib/cjs/BisCoreSchema.d.ts.map +1 -0
- package/lib/cjs/BisCoreSchema.js +61 -0
- package/lib/cjs/BisCoreSchema.js.map +1 -0
- package/lib/cjs/BriefcaseManager.d.ts +167 -0
- package/lib/cjs/BriefcaseManager.d.ts.map +1 -0
- package/lib/cjs/BriefcaseManager.js +406 -0
- package/lib/cjs/BriefcaseManager.js.map +1 -0
- package/lib/cjs/Category.d.ts +154 -0
- package/lib/cjs/Category.d.ts.map +1 -0
- package/lib/cjs/Category.js +244 -0
- package/lib/cjs/Category.js.map +1 -0
- package/lib/cjs/ChangeSummaryManager.d.ts +188 -0
- package/lib/cjs/ChangeSummaryManager.d.ts.map +1 -0
- package/lib/cjs/ChangeSummaryManager.js +444 -0
- package/lib/cjs/ChangeSummaryManager.js.map +1 -0
- package/lib/cjs/ChangedElementsDb.d.ts +97 -0
- package/lib/cjs/ChangedElementsDb.d.ts.map +1 -0
- package/lib/cjs/ChangedElementsDb.js +166 -0
- package/lib/cjs/ChangedElementsDb.js.map +1 -0
- package/lib/cjs/ChangedElementsManager.d.ts +40 -0
- package/lib/cjs/ChangedElementsManager.d.ts.map +1 -0
- package/lib/cjs/ChangedElementsManager.js +89 -0
- package/lib/cjs/ChangedElementsManager.js.map +1 -0
- package/lib/cjs/CheckpointManager.d.ts +101 -0
- package/lib/cjs/CheckpointManager.d.ts.map +1 -0
- package/lib/cjs/CheckpointManager.js +257 -0
- package/lib/cjs/CheckpointManager.js.map +1 -0
- package/lib/cjs/ClassRegistry.d.ts +72 -0
- package/lib/cjs/ClassRegistry.d.ts.map +1 -0
- package/lib/cjs/ClassRegistry.js +154 -0
- package/lib/cjs/ClassRegistry.js.map +1 -0
- package/lib/cjs/CloudStorageBackend.d.ts +46 -0
- package/lib/cjs/CloudStorageBackend.d.ts.map +1 -0
- package/lib/cjs/CloudStorageBackend.js +157 -0
- package/lib/cjs/CloudStorageBackend.js.map +1 -0
- package/lib/cjs/CodeSpecs.d.ts +51 -0
- package/lib/cjs/CodeSpecs.d.ts.map +1 -0
- package/lib/cjs/CodeSpecs.js +113 -0
- package/lib/cjs/CodeSpecs.js.map +1 -0
- package/lib/cjs/ConcurrentQuery.d.ts +12 -0
- package/lib/cjs/ConcurrentQuery.d.ts.map +1 -0
- package/lib/cjs/ConcurrentQuery.js +24 -0
- package/lib/cjs/ConcurrentQuery.js.map +1 -0
- package/lib/cjs/DevTools.d.ts +72 -0
- package/lib/cjs/DevTools.d.ts.map +1 -0
- package/lib/cjs/DevTools.js +155 -0
- package/lib/cjs/DevTools.js.map +1 -0
- package/lib/cjs/DisplayStyle.d.ts +107 -0
- package/lib/cjs/DisplayStyle.d.ts.map +1 -0
- package/lib/cjs/DisplayStyle.js +292 -0
- package/lib/cjs/DisplayStyle.js.map +1 -0
- package/lib/cjs/ECDb.d.ts +196 -0
- package/lib/cjs/ECDb.d.ts.map +1 -0
- package/lib/cjs/ECDb.js +354 -0
- package/lib/cjs/ECDb.js.map +1 -0
- package/lib/cjs/ECSchemaXmlContext.d.ts +18 -0
- package/lib/cjs/ECSchemaXmlContext.d.ts.map +1 -0
- package/lib/cjs/ECSchemaXmlContext.js +36 -0
- package/lib/cjs/ECSchemaXmlContext.js.map +1 -0
- package/lib/cjs/ECSqlStatement.d.ts +467 -0
- package/lib/cjs/ECSqlStatement.d.ts.map +1 -0
- package/lib/cjs/ECSqlStatement.js +783 -0
- package/lib/cjs/ECSqlStatement.js.map +1 -0
- package/lib/cjs/Element.d.ts +1082 -0
- package/lib/cjs/Element.d.ts.map +1 -0
- package/lib/cjs/Element.js +1392 -0
- package/lib/cjs/Element.js.map +1 -0
- package/lib/cjs/ElementAspect.d.ts +157 -0
- package/lib/cjs/ElementAspect.d.ts.map +1 -0
- package/lib/cjs/ElementAspect.js +179 -0
- package/lib/cjs/ElementAspect.js.map +1 -0
- package/lib/cjs/ElementGraphics.d.ts +10 -0
- package/lib/cjs/ElementGraphics.d.ts.map +1 -0
- package/lib/cjs/ElementGraphics.js +42 -0
- package/lib/cjs/ElementGraphics.js.map +1 -0
- package/lib/cjs/Entity.d.ts +57 -0
- package/lib/cjs/Entity.d.ts.map +1 -0
- package/lib/cjs/Entity.js +63 -0
- package/lib/cjs/Entity.js.map +1 -0
- package/lib/cjs/ExportGraphics.d.ts +302 -0
- package/lib/cjs/ExportGraphics.d.ts.map +1 -0
- package/lib/cjs/ExportGraphics.js +206 -0
- package/lib/cjs/ExportGraphics.js.map +1 -0
- package/lib/cjs/ExternalSource.d.ts +95 -0
- package/lib/cjs/ExternalSource.d.ts.map +1 -0
- package/lib/cjs/ExternalSource.js +126 -0
- package/lib/cjs/ExternalSource.js.map +1 -0
- package/lib/cjs/GeometrySummary.d.ts +5 -0
- package/lib/cjs/GeometrySummary.d.ts.map +1 -0
- package/lib/cjs/GeometrySummary.js +378 -0
- package/lib/cjs/GeometrySummary.js.map +1 -0
- package/lib/cjs/IModelCloneContext.d.ts +74 -0
- package/lib/cjs/IModelCloneContext.d.ts.map +1 -0
- package/lib/cjs/IModelCloneContext.js +130 -0
- package/lib/cjs/IModelCloneContext.js.map +1 -0
- package/lib/cjs/IModelDb.d.ts +1107 -0
- package/lib/cjs/IModelDb.d.ts.map +1 -0
- package/lib/cjs/IModelDb.js +2161 -0
- package/lib/cjs/IModelDb.js.map +1 -0
- package/lib/cjs/IModelHost.d.ts +284 -0
- package/lib/cjs/IModelHost.d.ts.map +1 -0
- package/lib/cjs/IModelHost.js +411 -0
- package/lib/cjs/IModelHost.js.map +1 -0
- package/lib/cjs/IModelJsFs.d.ts +63 -0
- package/lib/cjs/IModelJsFs.d.ts.map +1 -0
- package/lib/cjs/IModelJsFs.js +141 -0
- package/lib/cjs/IModelJsFs.js.map +1 -0
- package/lib/cjs/IModelSchemaLoader.d.ts +26 -0
- package/lib/cjs/IModelSchemaLoader.d.ts.map +1 -0
- package/lib/cjs/IModelSchemaLoader.js +95 -0
- package/lib/cjs/IModelSchemaLoader.js.map +1 -0
- package/lib/cjs/IpcHost.d.ts +99 -0
- package/lib/cjs/IpcHost.d.ts.map +1 -0
- package/lib/cjs/IpcHost.js +234 -0
- package/lib/cjs/IpcHost.js.map +1 -0
- package/lib/cjs/LineStyle.d.ts +312 -0
- package/lib/cjs/LineStyle.d.ts.map +1 -0
- package/lib/cjs/LineStyle.js +296 -0
- package/lib/cjs/LineStyle.js.map +1 -0
- package/lib/cjs/LocalhostIpcHost.d.ts +19 -0
- package/lib/cjs/LocalhostIpcHost.d.ts.map +1 -0
- package/lib/cjs/LocalhostIpcHost.js +52 -0
- package/lib/cjs/LocalhostIpcHost.js.map +1 -0
- package/lib/cjs/Material.d.ts +102 -0
- package/lib/cjs/Material.d.ts.map +1 -0
- package/lib/cjs/Material.js +146 -0
- package/lib/cjs/Material.js.map +1 -0
- package/lib/cjs/Model.d.ts +387 -0
- package/lib/cjs/Model.d.ts.map +1 -0
- package/lib/cjs/Model.js +469 -0
- package/lib/cjs/Model.js.map +1 -0
- package/lib/cjs/NativeAppStorage.d.ts +52 -0
- package/lib/cjs/NativeAppStorage.d.ts.map +1 -0
- package/lib/cjs/NativeAppStorage.js +203 -0
- package/lib/cjs/NativeAppStorage.js.map +1 -0
- package/lib/cjs/NativeHost.d.ts +71 -0
- package/lib/cjs/NativeHost.d.ts.map +1 -0
- package/lib/cjs/NativeHost.js +221 -0
- package/lib/cjs/NativeHost.js.map +1 -0
- package/lib/cjs/NavigationRelationship.d.ts +157 -0
- package/lib/cjs/NavigationRelationship.d.ts.map +1 -0
- package/lib/cjs/NavigationRelationship.js +226 -0
- package/lib/cjs/NavigationRelationship.js.map +1 -0
- package/lib/cjs/PromiseMemoizer.d.ts +52 -0
- package/lib/cjs/PromiseMemoizer.d.ts.map +1 -0
- package/lib/cjs/PromiseMemoizer.js +93 -0
- package/lib/cjs/PromiseMemoizer.js.map +1 -0
- package/lib/cjs/Relationship.d.ts +400 -0
- package/lib/cjs/Relationship.d.ts.map +1 -0
- package/lib/cjs/Relationship.js +460 -0
- package/lib/cjs/Relationship.js.map +1 -0
- package/lib/cjs/RpcBackend.d.ts +23 -0
- package/lib/cjs/RpcBackend.d.ts.map +1 -0
- package/lib/cjs/RpcBackend.js +94 -0
- package/lib/cjs/RpcBackend.js.map +1 -0
- package/lib/cjs/SQLiteDb.d.ts +66 -0
- package/lib/cjs/SQLiteDb.d.ts.map +1 -0
- package/lib/cjs/SQLiteDb.js +140 -0
- package/lib/cjs/SQLiteDb.js.map +1 -0
- package/lib/cjs/Schema.d.ts +56 -0
- package/lib/cjs/Schema.d.ts.map +1 -0
- package/lib/cjs/Schema.js +84 -0
- package/lib/cjs/Schema.js.map +1 -0
- package/lib/cjs/ServerBasedLocks.d.ts +64 -0
- package/lib/cjs/ServerBasedLocks.d.ts.map +1 -0
- package/lib/cjs/ServerBasedLocks.js +177 -0
- package/lib/cjs/ServerBasedLocks.js.map +1 -0
- package/lib/cjs/SqliteStatement.d.ts +264 -0
- package/lib/cjs/SqliteStatement.d.ts.map +1 -0
- package/lib/cjs/SqliteStatement.js +417 -0
- package/lib/cjs/SqliteStatement.js.map +1 -0
- package/lib/cjs/Texture.d.ts +59 -0
- package/lib/cjs/Texture.d.ts.map +1 -0
- package/lib/cjs/Texture.js +83 -0
- package/lib/cjs/Texture.js.map +1 -0
- package/lib/cjs/TxnManager.d.ts +203 -0
- package/lib/cjs/TxnManager.d.ts.map +1 -0
- package/lib/cjs/TxnManager.js +354 -0
- package/lib/cjs/TxnManager.js.map +1 -0
- package/lib/cjs/ViewDefinition.d.ts +432 -0
- package/lib/cjs/ViewDefinition.d.ts.map +1 -0
- package/lib/cjs/ViewDefinition.js +623 -0
- package/lib/cjs/ViewDefinition.js.map +1 -0
- package/lib/cjs/assets/IModelChange.02.00.00.ecschema.xml +90 -0
- package/lib/cjs/core-backend.d.ts +162 -0
- package/lib/cjs/core-backend.d.ts.map +1 -0
- package/lib/cjs/core-backend.js +181 -0
- package/lib/cjs/core-backend.js.map +1 -0
- package/lib/cjs/domains/FunctionalElements.d.ts +102 -0
- package/lib/cjs/domains/FunctionalElements.d.ts.map +1 -0
- package/lib/cjs/domains/FunctionalElements.js +146 -0
- package/lib/cjs/domains/FunctionalElements.js.map +1 -0
- package/lib/cjs/domains/FunctionalSchema.d.ts +14 -0
- package/lib/cjs/domains/FunctionalSchema.d.ts.map +1 -0
- package/lib/cjs/domains/FunctionalSchema.js +41 -0
- package/lib/cjs/domains/FunctionalSchema.js.map +1 -0
- package/lib/cjs/domains/GenericElements.d.ts +178 -0
- package/lib/cjs/domains/GenericElements.d.ts.map +1 -0
- package/lib/cjs/domains/GenericElements.js +264 -0
- package/lib/cjs/domains/GenericElements.js.map +1 -0
- package/lib/cjs/domains/GenericSchema.d.ts +11 -0
- package/lib/cjs/domains/GenericSchema.d.ts.map +1 -0
- package/lib/cjs/domains/GenericSchema.js +29 -0
- package/lib/cjs/domains/GenericSchema.js.map +1 -0
- package/lib/cjs/rpc-impl/DevToolsRpcImpl.d.ts +16 -0
- package/lib/cjs/rpc-impl/DevToolsRpcImpl.d.ts.map +1 -0
- package/lib/cjs/rpc-impl/DevToolsRpcImpl.js +33 -0
- package/lib/cjs/rpc-impl/DevToolsRpcImpl.js.map +1 -0
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts +40 -0
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts.map +1 -0
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +207 -0
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -0
- package/lib/cjs/rpc-impl/IModelTileRpcImpl.d.ts +21 -0
- package/lib/cjs/rpc-impl/IModelTileRpcImpl.d.ts.map +1 -0
- package/lib/cjs/rpc-impl/IModelTileRpcImpl.js +193 -0
- package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -0
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts +37 -0
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts.map +1 -0
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js +162 -0
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -0
- package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.d.ts +17 -0
- package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.d.ts.map +1 -0
- package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js +44 -0
- package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -0
- package/lib/cjs/rpc-impl/WipRpcImpl.d.ts +16 -0
- package/lib/cjs/rpc-impl/WipRpcImpl.d.ts.map +1 -0
- package/lib/cjs/rpc-impl/WipRpcImpl.js +35 -0
- package/lib/cjs/rpc-impl/WipRpcImpl.js.map +1 -0
- package/package.json +101 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServerBasedLocks.js","sourceRoot":"","sources":["../../src/ServerBasedLocks.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,sDAAkG;AAClG,oDAAyD;AACzD,yDAAwD;A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AAE;YACnC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC;gBAC3B,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,4BAAS,CAAC,MAAM,CAAC,CAAC;SACnC;QACD,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IAED,wGAAwG;IACjG,iBAAiB,CAAC,EAAc;QACrC,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE,4BAAS,CAAC,SAAS,qBAAwB,CAAC;QAChE,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;IAC5B,CAAC;IAED,yDAAyD;IACzD,IAAY,iBAAiB,KAAK,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAElF,uGAAuG;IAChG,kBAAkB,CAAC,EAAc,EAAE,IAAY,EAAE,SAAiB;QACvE,IAAI,IAAI,CAAC,iBAAiB,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAAE,CAAC;YACxD,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,WAAW,EAAE,8BAA8B,IAAI,QAAQ,SAAS,QAAQ,EAAE,GAAG,CAAC,CAAC;IACtH,CAAC;IAED,kGAAkG;IAC3F,eAAe,CAAC,EAAc,EAAE,IAAY,EAAE,SAAiB;QACpE,IAAI,IAAI,CAAC,iBAAiB,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC;YACrD,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,WAAW,EAAE,2BAA2B,IAAI,QAAQ,SAAS,QAAQ,EAAE,GAAG,CAAC,CAAC;IACnH,CAAC;CAEF;AA3LD,4CA2LC","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\n/** @packageDocumentation\r\n * @module iModels\r\n */\r\n\r\nimport { DbResult, Id64, Id64Arg, Id64String, IModelStatus, OpenMode } from \"@itwin/core-bentley\";\r\nimport { IModel, IModelError } from \"@itwin/core-common\";\r\nimport { LockMap, LockState } from \"./BackendHubAccess\";\r\nimport { BriefcaseDb, LockControl } from \"./IModelDb\";\r\nimport { IModelHost } from \"./IModelHost\";\r\nimport { SQLiteDb } from \"./SQLiteDb\";\r\n\r\n/**\r\n * Both the Model and Parent of an element are considered \"owners\" of their member elements. That means:\r\n * 1) they must hold at least a shared lock before an exclusive lock can be acquired for their members\r\n * 2) if they hold an exclusive lock, then all of their members are exclusively locked implicitly.\r\n * @internal\r\n */\r\nexport interface ElementOwners {\r\n readonly modelId: Id64String;\r\n readonly parentId: Id64String | undefined;\r\n}\r\n\r\n// eslint-disable-next-line no-restricted-syntax\r\nconst enum LockOrigin {\r\n Acquired = 0,\r\n NewElement = 1,\r\n Discovered = 2,\r\n}\r\n\r\n/** @internal */\r\nexport class ServerBasedLocks implements LockControl {\r\n public get isServerBased() { return true; }\r\n protected readonly lockDb = new SQLiteDb();\r\n protected readonly briefcase: BriefcaseDb;\r\n\r\n public constructor(iModel: BriefcaseDb) {\r\n this.briefcase = iModel;\r\n const dbName = `${iModel.nativeDb.getTempFileBaseName()}-locks`;\r\n try {\r\n this.lockDb.openDb(dbName, OpenMode.ReadWrite);\r\n } catch (_e) {\r\n this.lockDb.createDb(dbName);\r\n this.lockDb.executeSQL(\"CREATE TABLE locks(id INTEGER PRIMARY KEY NOT NULL,state INTEGER NOT NULL,origin INTEGER)\");\r\n this.lockDb.saveChanges();\r\n }\r\n }\r\n\r\n public close() {\r\n if (this.lockDb.isOpen)\r\n this.lockDb.closeDb();\r\n }\r\n\r\n private getOwners(id: Id64String): ElementOwners {\r\n return this.briefcase.withPreparedSqliteStatement(\"SELECT ModelId,ParentId FROM bis_Element WHERE id=?\", (stmt) => {\r\n stmt.bindId(1, id);\r\n const rc = stmt.step();\r\n if (DbResult.BE_SQLITE_ROW !== rc)\r\n throw new IModelError(rc, `element ${id} not found`);\r\n\r\n return { modelId: stmt.getValueId(0), parentId: stmt.getValueId(1) };\r\n });\r\n }\r\n\r\n private getLockState(id?: Id64String): LockState | undefined {\r\n return (id === undefined || !Id64.isValid(id)) ? undefined : this.lockDb.withPreparedSqliteStatement(\"SELECT state FROM locks WHERE id=?\", (stmt) => {\r\n stmt.bindId(1, id);\r\n return (DbResult.BE_SQLITE_ROW === stmt.step()) ? stmt.getValueInteger(0) : undefined;\r\n });\r\n }\r\n\r\n /** Clear the cache of locally held locks.\r\n * Note: does *not* release locks from server.\r\n */\r\n private clearAllLocks() {\r\n this.lockDb.executeSQL(\"DELETE FROM locks\");\r\n this.lockDb.saveChanges();\r\n }\r\n\r\n /** only for tests */\r\n public getLockCount(state: LockState): number {\r\n return this.lockDb.withSqliteStatement(\"SELECT count(*) FROM locks WHERE state=?\", (stmt) => {\r\n stmt.bindInteger(1, state);\r\n stmt.step();\r\n return stmt.getValueInteger(0);\r\n });\r\n }\r\n\r\n public async releaseAllLocks(): Promise<void> {\r\n await IModelHost.hubAccess.releaseAllLocks(this.briefcase); // throws if unsuccessful\r\n this.clearAllLocks();\r\n }\r\n\r\n private insertLock(id: Id64String, state: LockState, origin: LockOrigin): true {\r\n this.lockDb.withPreparedSqliteStatement(\"INSERT INTO locks(id,state,origin) VALUES (?,?,?) ON CONFLICT(id) DO UPDATE SET state=excluded.state,origin=excluded.origin\", (stmt) => {\r\n stmt.bindId(1, id);\r\n stmt.bindInteger(2, state);\r\n stmt.bindInteger(3, origin);\r\n const rc = stmt.step();\r\n if (DbResult.BE_SQLITE_DONE !== rc)\r\n throw new IModelError(rc, \"can't insert lock into database\");\r\n });\r\n return true;\r\n }\r\n\r\n private ownerHoldsExclusiveLock(id: Id64String | undefined): boolean {\r\n if (id === undefined || id === IModel.rootSubjectId)\r\n return false; // has no owners\r\n\r\n const { modelId, parentId } = this.getOwners(id);\r\n if (this.getLockState(modelId) === LockState.Exclusive || this.getLockState(parentId) === LockState.Exclusive)\r\n return true;\r\n\r\n // see if this model is exclusively locked by one of its owners. If so, save that fact on modelId so future tests won't have to descend.\r\n if (this.ownerHoldsExclusiveLock(modelId))\r\n return this.insertLock(modelId, LockState.Exclusive, LockOrigin.Discovered);\r\n\r\n // see if the parent is exclusively locked by one of its owners. If so, save that fact on parentId so future tests won't have to descend.\r\n return this.ownerHoldsExclusiveLock(parentId) ? this.insertLock(parentId!, LockState.Exclusive, LockOrigin.Discovered) : false;\r\n }\r\n\r\n /** Determine whether an the exclusive lock is already held by an element (or one of its owners) */\r\n public holdsExclusiveLock(id: Id64String): boolean {\r\n // see if we hold the exclusive lock. or if one of the element's owners is exclusively locked (recursively)\r\n return this.getLockState(id) === LockState.Exclusive || this.ownerHoldsExclusiveLock(id);\r\n }\r\n\r\n public holdsSharedLock(id: Id64String): boolean {\r\n const state = this.getLockState(id);\r\n // see if we hold shared or exclusive lock, or if an owner has exclusive lock. If so we implicitly have shared lock, but owner holding shared lock doesn't help.\r\n return (state === LockState.Shared || state === LockState.Exclusive) || this.ownerHoldsExclusiveLock(id);\r\n }\r\n\r\n /** if the shared lock on the element supplied is not already held, add it to the set of shared locks required. Then, check owners. */\r\n private addSharedLock(id: Id64String | undefined, locks: Set<Id64String>) {\r\n // if the id is not valid, or of the lock is already in the set, or if we already hold a shared lock, we're done\r\n // Note: if we hold a shared lock, it is guaranteed that we also hold all required shared locks on owners.\r\n if (id === undefined || !Id64.isValid(id) || locks.has(id) || this.holdsSharedLock(id))\r\n return;\r\n\r\n locks.add(id); // add to set of needed shared locks\r\n this.addOwnerSharedLocks(id, locks); // check parent models and groups\r\n }\r\n\r\n /** add owners (recursively) of an element to a list of required shared locks, if not already held. */\r\n private addOwnerSharedLocks(id: Id64String, locks: Set<Id64String>) {\r\n const el = this.getOwners(id);\r\n this.addSharedLock(el.parentId, locks); // if this element is in a group\r\n this.addSharedLock(el.modelId, locks); // check its model\r\n }\r\n\r\n /** attempt to acquire all necessary locks for a set of elements */\r\n private async acquireAllLocks(locks: LockMap) {\r\n if (locks.size === 0) // no locks are required.\r\n return;\r\n\r\n const sharedLocks = new Set<Id64String>();\r\n for (const lock of locks)\r\n this.addOwnerSharedLocks(lock[0], sharedLocks);\r\n\r\n for (const shared of sharedLocks) {\r\n if (!locks.has(shared)) // we may already be asking for exclusive lock\r\n locks.set(shared, LockState.Shared);\r\n }\r\n\r\n await IModelHost.hubAccess.acquireLocks(this.briefcase, locks); // throws if unsuccessful\r\n for (const lock of locks)\r\n this.insertLock(lock[0], lock[1], LockOrigin.Acquired);\r\n this.lockDb.saveChanges();\r\n }\r\n\r\n /**\r\n * Acquire the exclusive lock on one or more elements. This also attempts to acquire a shared lock on all of the element's owners, recursively.\r\n * If *any* lock cannot be obtained, no locks are acquired.\r\n */\r\n public async acquireExclusiveLock(ids: Id64Arg): Promise<void> {\r\n const locks = new Map<Id64String, LockState>();\r\n for (const id of Id64.iterable(ids)) {\r\n if (!this.holdsExclusiveLock(id))\r\n locks.set(id, LockState.Exclusive);\r\n }\r\n return this.acquireAllLocks(locks);\r\n }\r\n\r\n /**\r\n * Acquire a shared lock on one or more elements. This also attempts to acquire a shared lock on all of the element's owners, recursively.\r\n * If *any* lock cannot be obtained, no locks are acquired.\r\n */\r\n public async acquireSharedLock(ids: Id64Arg): Promise<void> {\r\n const locks = new Map<Id64String, LockState>();\r\n for (const id of Id64.iterable(ids)) {\r\n if (!this.holdsSharedLock(id))\r\n locks.set(id, LockState.Shared);\r\n }\r\n return this.acquireAllLocks(locks);\r\n }\r\n\r\n /** When an element is newly created in a session, we hold the lock on it implicitly. Save that fact. */\r\n public elementWasCreated(id: Id64String) {\r\n this.insertLock(id, LockState.Exclusive, LockOrigin.NewElement);\r\n this.lockDb.saveChanges();\r\n }\r\n\r\n /** locks are not necessary during change propagation. */\r\n private get _locksAreRequired() { return !this.briefcase.txns.isIndirectChanges; }\r\n\r\n /** throw if locks are currently required and the exclusive lock is not held on the supplied element */\r\n public checkExclusiveLock(id: Id64String, type: string, operation: string) {\r\n if (this._locksAreRequired && !this.holdsExclusiveLock(id))\r\n throw new IModelError(IModelStatus.LockNotHeld, `exclusive lock not held on ${type} for ${operation} (id=${id})`);\r\n }\r\n\r\n /** throw if locks are currently required and a shared lock is not held on the supplied element */\r\n public checkSharedLock(id: Id64String, type: string, operation: string) {\r\n if (this._locksAreRequired && !this.holdsSharedLock(id))\r\n throw new IModelError(IModelStatus.LockNotHeld, `shared lock not held on ${type} for ${operation} (id=${id})`);\r\n }\r\n\r\n}\r\n\r\n"]}
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module SQLite
|
|
3
|
+
*/
|
|
4
|
+
import { DbResult, GuidString, Id64String, IDisposable } from "@itwin/core-bentley";
|
|
5
|
+
import { IModelJsNative } from "@bentley/imodeljs-native";
|
|
6
|
+
/** Marks a string as either an [Id64String]($core-bentley) or [GuidString]($core-bentley), so
|
|
7
|
+
* that it can be passed to the [bindValue]($backend.SqliteStatement) or [bindValues]($backend.SqliteStatement)
|
|
8
|
+
* methods of [SqliteStatement]($backend).
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export interface StringParam {
|
|
12
|
+
id?: Id64String;
|
|
13
|
+
guid?: GuidString;
|
|
14
|
+
}
|
|
15
|
+
/** parameter Index (1-based), or name of the parameter (including the initial ':', '@' or '$')
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
export declare type BindParameter = number | string;
|
|
19
|
+
/** Executes SQLite SQL statements.
|
|
20
|
+
*
|
|
21
|
+
* A statement must be prepared before it can be executed, and it must be released when no longer needed.
|
|
22
|
+
* See [IModelDb.withPreparedSqliteStatement]($backend) or
|
|
23
|
+
* [ECDb.withPreparedSqliteStatement]($backend) for a convenient and
|
|
24
|
+
* reliable way to prepare, execute, and then release a statement.
|
|
25
|
+
*
|
|
26
|
+
* A statement may contain parameters that must be filled in before use by calling [SqliteStatement.bindValue]($backend)
|
|
27
|
+
* or [SqliteStatement.bindValues]($backend).
|
|
28
|
+
*
|
|
29
|
+
* Once prepared (and parameters are bound, if any), the statement is executed by calling [SqliteStatement.step]($backend).
|
|
30
|
+
* In case of an **SQL SELECT** statement, the current row can be retrieved with [SqliteStatement.getRow]($backend) as
|
|
31
|
+
* a whole, or with [SqliteStatement.getValue]($backend) when individual values are needed.
|
|
32
|
+
* Alternatively, query results of an **SQL SELECT** statement can be stepped through by using
|
|
33
|
+
* standard iteration syntax, such as `for of`.
|
|
34
|
+
*
|
|
35
|
+
* > Preparing a statement can be time-consuming. The best way to reduce the effect of this overhead is to cache and reuse prepared
|
|
36
|
+
* > statements. A cached prepared statement may be used in different places in an app, as long as the statement is general enough.
|
|
37
|
+
* > The key to making this strategy work is to phrase a statement in a general way and use placeholders to represent parameters that will vary on each use.
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
40
|
+
export declare class SqliteStatement implements IterableIterator<any>, IDisposable {
|
|
41
|
+
private _sql;
|
|
42
|
+
private _stmt;
|
|
43
|
+
constructor(_sql: string);
|
|
44
|
+
get stmt(): IModelJsNative.SqliteStatement | undefined;
|
|
45
|
+
get sql(): string;
|
|
46
|
+
/** Check if this statement has been prepared successfully or not */
|
|
47
|
+
get isPrepared(): boolean;
|
|
48
|
+
/** Prepare this statement prior to first use.
|
|
49
|
+
* @param db The DgnDb or ECDb to prepare the statement against
|
|
50
|
+
* @param sql The SQL statement string to prepare
|
|
51
|
+
* @param logErrors Determine if errors are logged or not
|
|
52
|
+
* @throws if the SQL statement cannot be prepared. Normally, prepare fails due to SQL syntax errors or references to tables or properties that do not exist.
|
|
53
|
+
* The error.message property will provide details.
|
|
54
|
+
*/
|
|
55
|
+
prepare(db: IModelJsNative.DgnDb | IModelJsNative.ECDb | IModelJsNative.SQLiteDb, logErrors?: boolean): void;
|
|
56
|
+
/** Indicates whether the prepared statement makes no **direct* changes to the content of the file
|
|
57
|
+
* or not. See [SQLite docs](https://www.sqlite.org/c3ref/stmt_readonly.html) for details.
|
|
58
|
+
*/
|
|
59
|
+
get isReadonly(): boolean;
|
|
60
|
+
/** Reset this statement so that the next call to step will return the first row, if any.
|
|
61
|
+
*/
|
|
62
|
+
reset(): void;
|
|
63
|
+
/** Call this function when finished with this statement. This releases the native resources held by the statement. */
|
|
64
|
+
dispose(): void;
|
|
65
|
+
/** Binds a value to the specified SQL parameter.
|
|
66
|
+
* The value must be of one of these types:
|
|
67
|
+
* JavaScript Type | SQLite Type
|
|
68
|
+
* --- | ---
|
|
69
|
+
* undefined | NULL
|
|
70
|
+
* boolean | INTEGER with true being bound as 1 and false as 0
|
|
71
|
+
* number | INTEGER if number is integral or REAL if number is not integral
|
|
72
|
+
* string | TEXT
|
|
73
|
+
* Uint8Array or ArrayBuffer | BLOB
|
|
74
|
+
* [StringParam]($backend) where member **id** is set | INTEGER
|
|
75
|
+
* [StringParam]($backend) where member **guid** is set | BLOB
|
|
76
|
+
*
|
|
77
|
+
* @param parameter Index (1-based) or name of the parameter (including the initial ':', '@' or '$')
|
|
78
|
+
* @param value Value to bind.
|
|
79
|
+
* @throws [IModelError]($common) if the value is of an unsupported type or in
|
|
80
|
+
* case of other binding errors.
|
|
81
|
+
*/
|
|
82
|
+
bindValue(parameter: BindParameter, value: any): void;
|
|
83
|
+
private checkBind;
|
|
84
|
+
/** Bind an integer parameter
|
|
85
|
+
* @param parameter Index (1-based) or name of the parameter (including the initial ':', '@' or '$')
|
|
86
|
+
* @param val integer to bind.
|
|
87
|
+
*/
|
|
88
|
+
bindInteger(parameter: BindParameter, val: number): void;
|
|
89
|
+
/** Bind a double parameter
|
|
90
|
+
* @param parameter Index (1-based) or name of the parameter (including the initial ':', '@' or '$')
|
|
91
|
+
* @param val double to bind.
|
|
92
|
+
*/
|
|
93
|
+
bindDouble(parameter: BindParameter, val: number): void;
|
|
94
|
+
/** Bind a string parameter
|
|
95
|
+
* @param parameter Index (1-based) or name of the parameter (including the initial ':', '@' or '$')
|
|
96
|
+
* @param val string to bind.
|
|
97
|
+
*/
|
|
98
|
+
bindString(parameter: BindParameter, val: string): void;
|
|
99
|
+
/** Bind an Id64String parameter as a 64-bit integer
|
|
100
|
+
* @param parameter Index (1-based) or name of the parameter (including the initial ':', '@' or '$')
|
|
101
|
+
* @param val Id to bind.
|
|
102
|
+
*/
|
|
103
|
+
bindId(parameter: BindParameter, id: Id64String): void;
|
|
104
|
+
/** Bind a Guid parameter
|
|
105
|
+
* @param parameter Index (1-based) or name of the parameter (including the initial ':', '@' or '$')
|
|
106
|
+
* @param val Guid to bind.
|
|
107
|
+
*/
|
|
108
|
+
bindGuid(parameter: BindParameter, guid: GuidString): void;
|
|
109
|
+
/** Bind a blob parameter
|
|
110
|
+
* @param parameter Index (1-based) or name of the parameter (including the initial ':', '@' or '$')
|
|
111
|
+
* @param val blob to bind.
|
|
112
|
+
*/
|
|
113
|
+
bindBlob(parameter: BindParameter, blob: Uint8Array): void;
|
|
114
|
+
/** Bind values to all parameters in the statement.
|
|
115
|
+
* @param values The values to bind to the parameters.
|
|
116
|
+
* Pass an *array* of values if the parameters are *positional*.
|
|
117
|
+
* Pass an *object of the values keyed on the parameter name* for *named parameters*.
|
|
118
|
+
* The values in either the array or object must match the respective types of the parameter.
|
|
119
|
+
* See [[SqliteStatement.bindValue]] for details on the supported types.
|
|
120
|
+
*/
|
|
121
|
+
bindValues(values: any[] | object): void;
|
|
122
|
+
/** Clear any bindings that were previously set on this statement.
|
|
123
|
+
* @throws [IModelError]($common) in case of errors
|
|
124
|
+
*/
|
|
125
|
+
clearBindings(): void;
|
|
126
|
+
/** Step this statement to the next row.
|
|
127
|
+
*
|
|
128
|
+
* For **SQL SELECT** statements the method returns
|
|
129
|
+
* - [DbResult.BE_SQLITE_ROW]($core-bentley) if the statement now points successfully to the next row.
|
|
130
|
+
* - [DbResult.BE_SQLITE_DONE]($core-bentley) if the statement has no more rows.
|
|
131
|
+
* - Error status in case of errors.
|
|
132
|
+
*
|
|
133
|
+
* For **SQL INSERT, UPDATE, DELETE** statements the method returns
|
|
134
|
+
* - [DbResult.BE_SQLITE_DONE]($core-bentley) if the statement has been executed successfully.
|
|
135
|
+
* - Error status in case of errors.
|
|
136
|
+
*/
|
|
137
|
+
step(): DbResult;
|
|
138
|
+
/** Get the query result's column count (only for SQL SELECT statements). */
|
|
139
|
+
getColumnCount(): number;
|
|
140
|
+
/** Get the value for the column at the given index in the query result.
|
|
141
|
+
* @param columnIx Index of SQL column in query result (0-based)
|
|
142
|
+
*/
|
|
143
|
+
getValue(columnIx: number): SqliteValue;
|
|
144
|
+
/** Get a value as a blob
|
|
145
|
+
* @param colIndex Index of SQL column in query result (0-based)
|
|
146
|
+
*/
|
|
147
|
+
getValueBlob(colIndex: number): Uint8Array;
|
|
148
|
+
/** Get a value as a double
|
|
149
|
+
* @param colIndex Index of SQL column in query result (0-based)
|
|
150
|
+
*/
|
|
151
|
+
getValueDouble(colIndex: number): number;
|
|
152
|
+
/** Get a value as a integer
|
|
153
|
+
* @param colIndex Index of SQL column in query result (0-based)
|
|
154
|
+
*/
|
|
155
|
+
getValueInteger(colIndex: number): number;
|
|
156
|
+
/** Get a value as a string
|
|
157
|
+
* @param colIndex Index of SQL column in query result (0-based)
|
|
158
|
+
*/
|
|
159
|
+
getValueString(colIndex: number): string;
|
|
160
|
+
/** Get a value as an Id
|
|
161
|
+
* @param colIndex Index of SQL column in query result (0-based)
|
|
162
|
+
*/
|
|
163
|
+
getValueId(colIndex: number): Id64String;
|
|
164
|
+
/** Get a value as a Guid
|
|
165
|
+
* @param colIndex Index of SQL column in query result (0-based)
|
|
166
|
+
*/
|
|
167
|
+
getValueGuid(colIndex: number): GuidString;
|
|
168
|
+
/** Get the current row.
|
|
169
|
+
* The returned row is formatted as JavaScript object where every SELECT clause item becomes a property in the JavaScript object.
|
|
170
|
+
*
|
|
171
|
+
* The SQL select clause item's name becomes the member name of the JavaScript object, **with the first character lowered**.
|
|
172
|
+
*
|
|
173
|
+
* SQLite Type | JavaScript Type
|
|
174
|
+
* --- | ---
|
|
175
|
+
* [SqliteValueType.Null]($backend) | undefined
|
|
176
|
+
* [SqliteValueType.Integer]($backend) | number
|
|
177
|
+
* [SqliteValueType.Double]($backend) | number
|
|
178
|
+
* [SqliteValueType.String]($backend) | string
|
|
179
|
+
* [SqliteValueType.Blob]($backend) | Uint8Array
|
|
180
|
+
*/
|
|
181
|
+
getRow(): any;
|
|
182
|
+
private static determineResultRowPropertyName;
|
|
183
|
+
/** Calls step when called as an iterator.
|
|
184
|
+
*/
|
|
185
|
+
next(): IteratorResult<any>;
|
|
186
|
+
/** The iterator that will step through the results of this statement. */
|
|
187
|
+
[Symbol.iterator](): IterableIterator<any>;
|
|
188
|
+
}
|
|
189
|
+
/** Data type of a value in in an SQLite SQL query result.
|
|
190
|
+
* See also:
|
|
191
|
+
* - [SqliteValue]($backend)
|
|
192
|
+
* - [SqliteStatement]($backend)
|
|
193
|
+
* - [SqliteStatement.getValue]($backend)
|
|
194
|
+
* @public
|
|
195
|
+
*/
|
|
196
|
+
export declare enum SqliteValueType {
|
|
197
|
+
Integer = 1,
|
|
198
|
+
Double = 2,
|
|
199
|
+
String = 3,
|
|
200
|
+
Blob = 4,
|
|
201
|
+
Null = 5
|
|
202
|
+
}
|
|
203
|
+
/** Value of a column in a row of an SQLite SQL query result.
|
|
204
|
+
* See also:
|
|
205
|
+
* - [SqliteStatement]($backend)
|
|
206
|
+
* - [SqliteStatement.getValue]($backend)
|
|
207
|
+
* @public
|
|
208
|
+
*/
|
|
209
|
+
export declare class SqliteValue {
|
|
210
|
+
private readonly _stmt;
|
|
211
|
+
private readonly _colIndex;
|
|
212
|
+
constructor(stmt: IModelJsNative.SqliteStatement, colIndex: number);
|
|
213
|
+
/** Indicates whether the value is NULL or not. */
|
|
214
|
+
get isNull(): boolean;
|
|
215
|
+
/** Gets the data type of the value. */
|
|
216
|
+
get type(): SqliteValueType;
|
|
217
|
+
/** Gets the name of the column of the value. */
|
|
218
|
+
get columnName(): string;
|
|
219
|
+
/** Gets the SqlValue as JavaScript value.
|
|
220
|
+
*
|
|
221
|
+
* SQLite Type | JavaScript Type
|
|
222
|
+
* --- | ---
|
|
223
|
+
* [SqliteValueType.Null]($backend) | undefined
|
|
224
|
+
* [SqliteValueType.Integer]($backend) | number
|
|
225
|
+
* [SqliteValueType.Double]($backend) | number
|
|
226
|
+
* [SqliteValueType.String]($backend) | string
|
|
227
|
+
* [SqliteValueType.Blob]($backend) | Uint8Array
|
|
228
|
+
*/
|
|
229
|
+
get value(): any;
|
|
230
|
+
/** Get the value as BLOB */
|
|
231
|
+
getBlob(): Uint8Array;
|
|
232
|
+
/** Get the value as a double value */
|
|
233
|
+
getDouble(): number;
|
|
234
|
+
/** Get the value as a integer value */
|
|
235
|
+
getInteger(): number;
|
|
236
|
+
/** Get the value as a string value */
|
|
237
|
+
getString(): string;
|
|
238
|
+
/** Get the value as an Id value */
|
|
239
|
+
getId(): Id64String;
|
|
240
|
+
/** Get the value as a Guid value */
|
|
241
|
+
getGuid(): GuidString;
|
|
242
|
+
}
|
|
243
|
+
interface Statement {
|
|
244
|
+
isPrepared: boolean;
|
|
245
|
+
sql: string;
|
|
246
|
+
dispose(): void;
|
|
247
|
+
reset(): void;
|
|
248
|
+
clearBindings(): void;
|
|
249
|
+
}
|
|
250
|
+
/** A cache for previously prepared SqliteStatements.
|
|
251
|
+
* It only holds Statements after they are no longer in use, resetting and clearing their bindings before saving them.
|
|
252
|
+
* When a request to use a statement from the cache is made, it is first removed from the cache.
|
|
253
|
+
* @internal
|
|
254
|
+
*/
|
|
255
|
+
export declare class StatementCache<Stmt extends Statement> {
|
|
256
|
+
private _cache;
|
|
257
|
+
constructor(maxCount?: number);
|
|
258
|
+
get size(): number;
|
|
259
|
+
addOrDispose(stmt: Stmt): void;
|
|
260
|
+
findAndRemove(sql: string): Stmt | undefined;
|
|
261
|
+
clear(): void;
|
|
262
|
+
}
|
|
263
|
+
export {};
|
|
264
|
+
//# sourceMappingURL=SqliteStatement.d.ts.map
|
|
@@ -0,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