@itwin/core-backend 5.0.0-dev.97 → 5.0.0-dev.99
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/lib/cjs/BackendHubAccess.d.ts +2 -8
- package/lib/cjs/BackendHubAccess.d.ts.map +1 -1
- package/lib/cjs/BackendHubAccess.js.map +1 -1
- package/lib/cjs/ChangeSummaryManager.d.ts.map +1 -1
- package/lib/cjs/ChangeSummaryManager.js +12 -5
- package/lib/cjs/ChangeSummaryManager.js.map +1 -1
- package/lib/cjs/ChangesetECAdaptor.d.ts.map +1 -1
- package/lib/cjs/ChangesetECAdaptor.js +1 -0
- package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
- package/lib/cjs/CheckpointManager.d.ts +8 -15
- package/lib/cjs/CheckpointManager.d.ts.map +1 -1
- package/lib/cjs/CheckpointManager.js +23 -54
- package/lib/cjs/CheckpointManager.js.map +1 -1
- package/lib/cjs/ECDb.d.ts +37 -1
- package/lib/cjs/ECDb.d.ts.map +1 -1
- package/lib/cjs/ECDb.js +81 -0
- package/lib/cjs/ECDb.js.map +1 -1
- package/lib/cjs/ECSqlStatement.d.ts +181 -2
- package/lib/cjs/ECSqlStatement.d.ts.map +1 -1
- package/lib/cjs/ECSqlStatement.js +224 -5
- package/lib/cjs/ECSqlStatement.js.map +1 -1
- package/lib/cjs/Element.d.ts +16 -4
- package/lib/cjs/Element.d.ts.map +1 -1
- package/lib/cjs/Element.js +40 -2
- package/lib/cjs/Element.js.map +1 -1
- package/lib/cjs/ElementAspect.d.ts.map +1 -1
- package/lib/cjs/ElementAspect.js +1 -0
- package/lib/cjs/ElementAspect.js.map +1 -1
- package/lib/cjs/ElementTreeWalker.d.ts.map +1 -1
- package/lib/cjs/ElementTreeWalker.js +4 -0
- package/lib/cjs/ElementTreeWalker.js.map +1 -1
- package/lib/cjs/HubMock.d.ts +1 -1
- package/lib/cjs/HubMock.d.ts.map +1 -1
- package/lib/cjs/HubMock.js +13 -2
- package/lib/cjs/HubMock.js.map +1 -1
- package/lib/cjs/IModelDb.d.ts +4 -0
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +33 -3
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/Relationship.d.ts.map +1 -1
- package/lib/cjs/Relationship.js +2 -0
- package/lib/cjs/Relationship.js.map +1 -1
- package/lib/cjs/ViewStore.d.ts.map +1 -1
- package/lib/cjs/ViewStore.js +2 -1
- package/lib/cjs/ViewStore.js.map +1 -1
- package/lib/cjs/internal/ChannelAdmin.d.ts.map +1 -1
- package/lib/cjs/internal/ChannelAdmin.js +2 -0
- package/lib/cjs/internal/ChannelAdmin.js.map +1 -1
- package/lib/cjs/internal/Symbols.d.ts +2 -0
- package/lib/cjs/internal/Symbols.d.ts.map +1 -1
- package/lib/cjs/internal/Symbols.js +3 -1
- package/lib/cjs/internal/Symbols.js.map +1 -1
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts.map +1 -1
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +1 -0
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts.map +1 -1
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js +11 -22
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
- package/lib/esm/BackendHubAccess.d.ts +2 -8
- package/lib/esm/BackendHubAccess.d.ts.map +1 -1
- package/lib/esm/BackendHubAccess.js.map +1 -1
- package/lib/esm/ChangeSummaryManager.d.ts.map +1 -1
- package/lib/esm/ChangeSummaryManager.js +12 -5
- package/lib/esm/ChangeSummaryManager.js.map +1 -1
- package/lib/esm/ChangesetECAdaptor.d.ts.map +1 -1
- package/lib/esm/ChangesetECAdaptor.js +1 -0
- package/lib/esm/ChangesetECAdaptor.js.map +1 -1
- package/lib/esm/CheckpointManager.d.ts +8 -15
- package/lib/esm/CheckpointManager.d.ts.map +1 -1
- package/lib/esm/CheckpointManager.js +22 -52
- package/lib/esm/CheckpointManager.js.map +1 -1
- package/lib/esm/ECDb.d.ts +37 -1
- package/lib/esm/ECDb.d.ts.map +1 -1
- package/lib/esm/ECDb.js +82 -1
- package/lib/esm/ECDb.js.map +1 -1
- package/lib/esm/ECSqlStatement.d.ts +181 -2
- package/lib/esm/ECSqlStatement.d.ts.map +1 -1
- package/lib/esm/ECSqlStatement.js +222 -4
- package/lib/esm/ECSqlStatement.js.map +1 -1
- package/lib/esm/Element.d.ts +16 -4
- package/lib/esm/Element.d.ts.map +1 -1
- package/lib/esm/Element.js +40 -2
- package/lib/esm/Element.js.map +1 -1
- package/lib/esm/ElementAspect.d.ts.map +1 -1
- package/lib/esm/ElementAspect.js +1 -0
- package/lib/esm/ElementAspect.js.map +1 -1
- package/lib/esm/ElementTreeWalker.d.ts.map +1 -1
- package/lib/esm/ElementTreeWalker.js +4 -0
- package/lib/esm/ElementTreeWalker.js.map +1 -1
- package/lib/esm/HubMock.d.ts +1 -1
- package/lib/esm/HubMock.d.ts.map +1 -1
- package/lib/esm/HubMock.js +13 -2
- package/lib/esm/HubMock.js.map +1 -1
- package/lib/esm/IModelDb.d.ts +4 -0
- package/lib/esm/IModelDb.d.ts.map +1 -1
- package/lib/esm/IModelDb.js +33 -3
- package/lib/esm/IModelDb.js.map +1 -1
- package/lib/esm/Relationship.d.ts.map +1 -1
- package/lib/esm/Relationship.js +2 -0
- package/lib/esm/Relationship.js.map +1 -1
- package/lib/esm/ViewStore.d.ts.map +1 -1
- package/lib/esm/ViewStore.js +2 -1
- package/lib/esm/ViewStore.js.map +1 -1
- package/lib/esm/internal/ChannelAdmin.d.ts.map +1 -1
- package/lib/esm/internal/ChannelAdmin.js +2 -0
- package/lib/esm/internal/ChannelAdmin.js.map +1 -1
- package/lib/esm/internal/Symbols.d.ts +2 -0
- package/lib/esm/internal/Symbols.d.ts.map +1 -1
- package/lib/esm/internal/Symbols.js +2 -0
- package/lib/esm/internal/Symbols.js.map +1 -1
- package/lib/esm/rpc-impl/IModelReadRpcImpl.d.ts.map +1 -1
- package/lib/esm/rpc-impl/IModelReadRpcImpl.js +1 -0
- package/lib/esm/rpc-impl/IModelReadRpcImpl.js.map +1 -1
- package/lib/esm/rpc-impl/RpcBriefcaseUtility.d.ts.map +1 -1
- package/lib/esm/rpc-impl/RpcBriefcaseUtility.js +13 -24
- package/lib/esm/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
- package/lib/esm/test/CloudSqliteMock.d.ts +37 -0
- package/lib/esm/test/CloudSqliteMock.d.ts.map +1 -0
- package/lib/esm/test/CloudSqliteMock.js +117 -0
- package/lib/esm/test/CloudSqliteMock.js.map +1 -0
- package/lib/esm/test/IModelTestUtils.d.ts +1 -1
- package/lib/esm/test/IModelTestUtils.d.ts.map +1 -1
- package/lib/esm/test/IModelTestUtils.js +16 -4
- package/lib/esm/test/IModelTestUtils.js.map +1 -1
- package/lib/esm/test/PrintElementTree.js +1 -0
- package/lib/esm/test/PrintElementTree.js.map +1 -1
- package/lib/esm/test/SchemaUtils.test.js +2 -0
- package/lib/esm/test/SchemaUtils.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECDb.test.js +12 -1
- package/lib/esm/test/ecdb/ECDb.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECSqlAst.test.js +1 -0
- package/lib/esm/test/ecdb/ECSqlAst.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECSqlQuery.test.js +6 -0
- package/lib/esm/test/ecdb/ECSqlQuery.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECSqlReader.test.js +1 -1
- package/lib/esm/test/ecdb/ECSqlReader.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECSqlStatement.test.js +253 -163
- package/lib/esm/test/ecdb/ECSqlStatement.test.js.map +1 -1
- package/lib/esm/test/ecdb/SqliteStatement.test.js +2 -0
- package/lib/esm/test/ecdb/SqliteStatement.test.js.map +1 -1
- package/lib/esm/test/ecsql/src/ECSqlTestGenerator.js +1 -0
- package/lib/esm/test/ecsql/src/ECSqlTestGenerator.js.map +1 -1
- package/lib/esm/test/ecsql/src/ECSqlTestRunner.test.js +5 -1
- package/lib/esm/test/ecsql/src/ECSqlTestRunner.test.js.map +1 -1
- package/lib/esm/test/element/ElementRoundTrip.test.js +10 -0
- package/lib/esm/test/element/ElementRoundTrip.test.js.map +1 -1
- package/lib/esm/test/font/IModelDbFonts.test.js +3 -1
- package/lib/esm/test/font/IModelDbFonts.test.js.map +1 -1
- package/lib/esm/test/hubaccess/BriefcaseManager.test.js +18 -7
- package/lib/esm/test/hubaccess/BriefcaseManager.test.js.map +1 -1
- package/lib/esm/test/hubaccess/CheckpointManager.test.js +5 -91
- package/lib/esm/test/hubaccess/CheckpointManager.test.js.map +1 -1
- package/lib/esm/test/imodel/ElementTreeWalker.test.js +1 -0
- package/lib/esm/test/imodel/ElementTreeWalker.test.js.map +1 -1
- package/lib/esm/test/imodel/IModel.test.js +14 -0
- package/lib/esm/test/imodel/IModel.test.js.map +1 -1
- package/lib/esm/test/schema/GenericDomain.test.js +1 -0
- package/lib/esm/test/schema/GenericDomain.test.js.map +1 -1
- package/lib/esm/test/standalone/ChangeMerge.test.js +0 -4
- package/lib/esm/test/standalone/ChangeMerge.test.js.map +1 -1
- package/lib/esm/test/standalone/ChangesetReader.test.js +1 -0
- package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
- package/lib/esm/test/standalone/Drawing.test.d.ts +2 -0
- package/lib/esm/test/standalone/Drawing.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/Drawing.test.js +120 -0
- package/lib/esm/test/standalone/Drawing.test.js.map +1 -0
- package/lib/esm/test/standalone/IModelWrite.test.js +22 -6
- package/lib/esm/test/standalone/IModelWrite.test.js.map +1 -1
- package/lib/esm/test/standalone/RenderMaterialElement.test.js +1 -0
- package/lib/esm/test/standalone/RenderMaterialElement.test.js.map +1 -1
- package/lib/esm/test/standalone/SnapshotDb.test.js +4 -3
- package/lib/esm/test/standalone/SnapshotDb.test.js.map +1 -1
- package/package.json +13 -12
|
@@ -50,6 +50,8 @@ export class ECSqlInsertResult {
|
|
|
50
50
|
* - [Executing ECSQL]($docs/learning/backend/ExecutingECSQL) provides more background on ECSQL and an introduction on how to execute ECSQL with the iTwin.js API.
|
|
51
51
|
* - [Code Examples]($docs/learning/backend/ECSQLCodeExamples) illustrate the use of the iTwin.js API for executing and working with ECSQL
|
|
52
52
|
* @public
|
|
53
|
+
* @deprecated in 4.11. Use [IModelDb.createQueryReader]($backend) or [ECDb.createQueryReader]($backend) to query.
|
|
54
|
+
* For ECDb, use [ECDb.withCachedWriteStatement]($backend) or [ECDb.withWriteStatement]($backend) to Insert/Update/Delete.
|
|
53
55
|
*/
|
|
54
56
|
export class ECSqlStatement {
|
|
55
57
|
_stmt;
|
|
@@ -358,11 +360,209 @@ export class ECSqlStatement {
|
|
|
358
360
|
*
|
|
359
361
|
* See also: [Code Samples]($docs/learning/backend/ECSQLCodeExamples#working-with-the-query-result)
|
|
360
362
|
*/
|
|
363
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
361
364
|
getValue(columnIx) {
|
|
362
365
|
assert(undefined !== this._stmt);
|
|
366
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
363
367
|
return new ECSqlValue(this._stmt.getValue(columnIx));
|
|
364
368
|
}
|
|
365
369
|
}
|
|
370
|
+
/** Executes ECSQL INSERT/UPDATE/DELETE statements.
|
|
371
|
+
*
|
|
372
|
+
* A statement must be prepared before it can be executed, and it must be released when no longer needed.
|
|
373
|
+
* See [ECDb.withCachedWriteStatement]($backend) for a convenient and
|
|
374
|
+
* reliable way to prepare, execute, and then release a statement.
|
|
375
|
+
*
|
|
376
|
+
* A statement may contain parameters that must be filled in before use by the **bind** methods.
|
|
377
|
+
*
|
|
378
|
+
* Once prepared (and parameters are bound, if any), the statement is executed by calling [ECSqlStatement.stepForInsert]($backend).
|
|
379
|
+
*
|
|
380
|
+
* > Preparing a statement can be time-consuming. The best way to reduce the effect of this overhead is to cache and reuse prepared
|
|
381
|
+
* > statements. A cached prepared statement may be used in different places in an app, as long as the statement is general enough.
|
|
382
|
+
* > 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.
|
|
383
|
+
*
|
|
384
|
+
* See also
|
|
385
|
+
* - [Executing ECSQL]($docs/learning/backend/ExecutingECSQL) provides more background on ECSQL and an introduction on how to execute ECSQL with the iTwin.js API.
|
|
386
|
+
* - [Code Examples]($docs/learning/backend/ECSQLCodeExamples) illustrate the use of the iTwin.js API for executing and working with ECSQL
|
|
387
|
+
* @public
|
|
388
|
+
*/
|
|
389
|
+
export class ECSqlWriteStatement {
|
|
390
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
391
|
+
_stmt;
|
|
392
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
393
|
+
constructor(stmt) {
|
|
394
|
+
if (stmt)
|
|
395
|
+
this._stmt = stmt;
|
|
396
|
+
else {
|
|
397
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
398
|
+
this._stmt = new ECSqlStatement();
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
get sql() { return this._stmt.sql; }
|
|
402
|
+
/** Check if this statement has been prepared successfully or not */
|
|
403
|
+
get isPrepared() { return this._stmt.isPrepared; }
|
|
404
|
+
/** Get the underlying ECSqlStatement. Needed until we remove ECSqlStatement.
|
|
405
|
+
* @param
|
|
406
|
+
* @internal
|
|
407
|
+
*/
|
|
408
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
409
|
+
get stmt() { return this._stmt; }
|
|
410
|
+
/** Prepare this statement prior to first use.
|
|
411
|
+
* @param db The ECDb to prepare the statement against
|
|
412
|
+
* @param ecsql The ECSQL statement string to prepare
|
|
413
|
+
* @param logErrors Determine if errors are logged or not
|
|
414
|
+
* @throws [IModelError]($common) if the ECSQL statement cannot be prepared. Normally, prepare fails due to ECSQL syntax errors or references to tables or properties that do not exist.
|
|
415
|
+
* The error.message property will provide details.
|
|
416
|
+
* @internal
|
|
417
|
+
*/
|
|
418
|
+
prepare(db, ecsql, logErrors = true) {
|
|
419
|
+
this._stmt.prepare(db, ecsql, logErrors);
|
|
420
|
+
}
|
|
421
|
+
/** Prepare this statement prior to first use.
|
|
422
|
+
* @param db The DgnDb or ECDb to prepare the statement against
|
|
423
|
+
* @param ecsql The ECSQL statement string to prepare
|
|
424
|
+
* @param logErrors Determine if errors are logged or not, its set to false by default for tryPrepare()
|
|
425
|
+
* @returns An object with a `status` member equal to [DbResult.BE_SQLITE_OK]($bentley) on success. Upon error, the `message` member will provide details.
|
|
426
|
+
* @internal
|
|
427
|
+
*/
|
|
428
|
+
tryPrepare(db, ecsql, logErrors = false) {
|
|
429
|
+
return this.tryPrepare(db, ecsql, logErrors);
|
|
430
|
+
}
|
|
431
|
+
/** Reset this statement so that the next call to step will return the first row, if any. */
|
|
432
|
+
reset() {
|
|
433
|
+
this._stmt.reset();
|
|
434
|
+
}
|
|
435
|
+
/** Get the Native SQL statement
|
|
436
|
+
* @internal
|
|
437
|
+
*/
|
|
438
|
+
getNativeSql() {
|
|
439
|
+
return this._stmt.getNativeSql();
|
|
440
|
+
}
|
|
441
|
+
/** Binds the specified value to the specified ECSQL parameter.
|
|
442
|
+
* The section "[iTwin.js Types used in ECSQL Parameter Bindings]($docs/learning/ECSQLParameterTypes)" describes the
|
|
443
|
+
* iTwin.js types to be used for the different ECSQL parameter types.
|
|
444
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
445
|
+
*/
|
|
446
|
+
bindValue(parameter, val) { this.getBinder(parameter).bind(val); }
|
|
447
|
+
/** Binds null to the specified ECSQL parameter.
|
|
448
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
449
|
+
*/
|
|
450
|
+
bindNull(parameter) { this.getBinder(parameter).bindNull(); }
|
|
451
|
+
/** Binds a BLOB value to the specified ECSQL parameter.
|
|
452
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
453
|
+
* @param BLOB value as either a Uint8Array, ArrayBuffer or a Base64 string
|
|
454
|
+
*/
|
|
455
|
+
bindBlob(parameter, blob) { this.getBinder(parameter).bindBlob(blob); }
|
|
456
|
+
/** Binds a boolean value to the specified ECSQL parameter.
|
|
457
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
458
|
+
* @param val Boolean value
|
|
459
|
+
*/
|
|
460
|
+
bindBoolean(parameter, val) { this.getBinder(parameter).bindBoolean(val); }
|
|
461
|
+
/** Binds a DateTime value to the specified ECSQL parameter.
|
|
462
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
463
|
+
* @param isoDateTimeString DateTime value as ISO8601 string
|
|
464
|
+
*/
|
|
465
|
+
bindDateTime(parameter, isoDateTimeString) { this.getBinder(parameter).bindDateTime(isoDateTimeString); }
|
|
466
|
+
/** Binds a double value to the specified ECSQL parameter.
|
|
467
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
468
|
+
* @param val Double value
|
|
469
|
+
*/
|
|
470
|
+
bindDouble(parameter, val) { this.getBinder(parameter).bindDouble(val); }
|
|
471
|
+
/** Binds an GUID value to the specified ECSQL parameter.
|
|
472
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
473
|
+
* @param val GUID value
|
|
474
|
+
*/
|
|
475
|
+
bindGuid(parameter, val) { this.getBinder(parameter).bindGuid(val); }
|
|
476
|
+
/** Binds an Id value to the specified ECSQL parameter.
|
|
477
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
478
|
+
* @param val Id value
|
|
479
|
+
*/
|
|
480
|
+
bindId(parameter, val) { this.getBinder(parameter).bindId(val); }
|
|
481
|
+
/** Binds an integer value to the specified ECSQL parameter.
|
|
482
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
483
|
+
* @param val Integer value as number, decimal string or hexadecimal string.
|
|
484
|
+
*/
|
|
485
|
+
bindInteger(parameter, val) { this.getBinder(parameter).bindInteger(val); }
|
|
486
|
+
/** Binds an Point2d value to the specified ECSQL parameter.
|
|
487
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
488
|
+
* @param val Point2d value
|
|
489
|
+
*/
|
|
490
|
+
bindPoint2d(parameter, val) { this.getBinder(parameter).bindPoint2d(val); }
|
|
491
|
+
/** Binds an Point3d value to the specified ECSQL parameter.
|
|
492
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
493
|
+
* @param val Point3d value
|
|
494
|
+
*/
|
|
495
|
+
bindPoint3d(parameter, val) { this.getBinder(parameter).bindPoint3d(val); }
|
|
496
|
+
/** Binds a Range3d as a blob to the specified ECSQL parameter
|
|
497
|
+
* @param parameter Index(1-based) or name of the parameter
|
|
498
|
+
* @param val Range3d value
|
|
499
|
+
*/
|
|
500
|
+
bindRange3d(parameter, val) { this.getBinder(parameter).bindRange3d(val); }
|
|
501
|
+
/** Binds an string to the specified ECSQL parameter.
|
|
502
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
503
|
+
* @param val String value
|
|
504
|
+
*/
|
|
505
|
+
bindString(parameter, val) { this.getBinder(parameter).bindString(val); }
|
|
506
|
+
/** Binds a navigation property value to the specified ECSQL parameter.
|
|
507
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
508
|
+
* @param val Navigation property value
|
|
509
|
+
*/
|
|
510
|
+
bindNavigation(parameter, val) { this.getBinder(parameter).bindNavigation(val); }
|
|
511
|
+
/** Binds a struct property value to the specified ECSQL parameter.
|
|
512
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
513
|
+
* @param val Struct value. The struct value is an object composed of pairs of a struct member property name and its value
|
|
514
|
+
* (of one of the supported types)
|
|
515
|
+
*/
|
|
516
|
+
bindStruct(parameter, val) { this.getBinder(parameter).bindStruct(val); }
|
|
517
|
+
/** Binds an array value to the specified ECSQL parameter.
|
|
518
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
519
|
+
* @param val Array value. The array value is an array of values of the supported types
|
|
520
|
+
*/
|
|
521
|
+
bindArray(parameter, val) { this.getBinder(parameter).bindArray(val); }
|
|
522
|
+
bindIdSet(parameter, val) { this.getBinder(parameter).bindIdSet(val); }
|
|
523
|
+
/**
|
|
524
|
+
* Gets a binder to bind a value for an ECSQL parameter
|
|
525
|
+
* > This is the most low-level API to bind a value to a specific parameter. Alternatively you can use the ECSqlStatement.bindXX methods
|
|
526
|
+
* > or [ECSqlStatement.bindValues]($backend).
|
|
527
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
528
|
+
*/
|
|
529
|
+
getBinder(parameter) {
|
|
530
|
+
return this._stmt.getBinder(parameter);
|
|
531
|
+
}
|
|
532
|
+
/** Bind values to all parameters in the statement.
|
|
533
|
+
* @param values The values to bind to the parameters.
|
|
534
|
+
* Pass an *array* of values if the parameters are *positional*.
|
|
535
|
+
* Pass an *object of the values keyed on the parameter name* for *named parameters*.
|
|
536
|
+
* The values in either the array or object must match the respective types of the parameter.
|
|
537
|
+
*
|
|
538
|
+
* The section "[iTwin.js Types used in ECSQL Parameter Bindings]($docs/learning/ECSQLParameterTypes)" describes the
|
|
539
|
+
* iTwin.js types to be used for the different ECSQL parameter types.
|
|
540
|
+
*
|
|
541
|
+
* See also these [Code Samples]($docs/learning/backend/ECSQLCodeExamples#binding-to-all-parameters-at-once)
|
|
542
|
+
*/
|
|
543
|
+
bindValues(values) {
|
|
544
|
+
this._stmt.bindValues(values);
|
|
545
|
+
}
|
|
546
|
+
/** Clear any bindings that were previously set on this statement.
|
|
547
|
+
* @throws [IModelError]($common) in case of errors
|
|
548
|
+
*/
|
|
549
|
+
clearBindings() {
|
|
550
|
+
this._stmt.clearBindings();
|
|
551
|
+
}
|
|
552
|
+
/** Step this INSERT statement and returns status and the ECInstanceId of the newly
|
|
553
|
+
* created instance.
|
|
554
|
+
*
|
|
555
|
+
* > Insert statements can be used with ECDb only, not with IModelDb.
|
|
556
|
+
*
|
|
557
|
+
* @returns Returns the generated ECInstanceId in case of success and the status of the step
|
|
558
|
+
* call. In case of error, the respective error code is returned.
|
|
559
|
+
*/
|
|
560
|
+
stepForInsert() {
|
|
561
|
+
return this._stmt.stepForInsert();
|
|
562
|
+
}
|
|
563
|
+
/** Get the query result's column count (only for ECSQL SELECT statements). */
|
|
564
|
+
getColumnCount() { return this._stmt.getColumnCount(); }
|
|
565
|
+
}
|
|
366
566
|
/** Binds a value to an ECSQL parameter.
|
|
367
567
|
*
|
|
368
568
|
* See also:
|
|
@@ -523,12 +723,14 @@ export class ECSqlBinder {
|
|
|
523
723
|
* - [ECSqlStatement.getValue]($backend)
|
|
524
724
|
* - [Code Samples]($docs/learning/backend/ECSQLCodeExamples#working-with-the-query-result)
|
|
525
725
|
* @public
|
|
526
|
-
|
|
726
|
+
* @deprecated in 4.11. Use [IModelDb.createQueryReader]($backend) or [ECDb.createQueryReader]($backend) instead.
|
|
727
|
+
*/
|
|
527
728
|
export class ECSqlValue {
|
|
528
729
|
_val;
|
|
529
730
|
/** @internal */
|
|
530
731
|
constructor(val) { this._val = val; }
|
|
531
732
|
/** Get information about the query result's column this value refers to. */
|
|
733
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
532
734
|
get columnInfo() { return this._val.getColumnInfo(); }
|
|
533
735
|
/** Get the value of this ECSQL value */
|
|
534
736
|
get value() { return ECSqlValueHelper.getValue(this); }
|
|
@@ -573,14 +775,17 @@ export class ECSqlValue {
|
|
|
573
775
|
* @return ECEnumeration value(s) or undefined if the ECSqlValue does not represent an ECEnumeration.
|
|
574
776
|
* or is not a strict match of an ECEnumerator or a combination of them.
|
|
575
777
|
*/
|
|
778
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
576
779
|
getEnum() { return this._val.getEnum(); }
|
|
577
780
|
/** Get the value as [NavigationValue]($common) */
|
|
578
781
|
getNavigation() { return this._val.getNavigation(); }
|
|
579
782
|
/** Get an iterator for iterating the struct members of this struct value. */
|
|
783
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
580
784
|
getStructIterator() { return new ECSqlValueIterator(this._val.getStructIterator()); }
|
|
581
785
|
/** Get this struct value's content as object literal */
|
|
582
786
|
getStruct() { return ECSqlValueHelper.getStruct(this); }
|
|
583
787
|
/** Get an iterator for iterating the array elements of this array value. */
|
|
788
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
584
789
|
getArrayIterator() { return new ECSqlValueIterator(this._val.getArrayIterator()); }
|
|
585
790
|
/** Get this array value as JavaScript array */
|
|
586
791
|
getArray() { return ECSqlValueHelper.getArray(this); }
|
|
@@ -588,16 +793,21 @@ export class ECSqlValue {
|
|
|
588
793
|
/** Iterator over members of a struct [ECSqlValue]($backend) or the elements of an array [ECSqlValue]($backend).
|
|
589
794
|
* See [ECSqlValue.getStructIterator]($backend) or [ECSqlValue.getArrayIterator]($backend).
|
|
590
795
|
* @public
|
|
591
|
-
|
|
796
|
+
* @deprecated in 4.11. Use [IModelDb.createQueryReader]($backend) or [ECDb.createQueryReader]($backend) instead.
|
|
797
|
+
*/
|
|
592
798
|
export class ECSqlValueIterator {
|
|
593
799
|
_it;
|
|
594
800
|
/** @internal */
|
|
595
801
|
constructor(it) { this._it = it; }
|
|
802
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
596
803
|
next() {
|
|
597
|
-
if (this._it.moveNext())
|
|
804
|
+
if (this._it.moveNext()) {
|
|
805
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
598
806
|
return { done: false, value: new ECSqlValue(this._it.getCurrent()) };
|
|
807
|
+
}
|
|
599
808
|
return { done: true, value: undefined };
|
|
600
809
|
}
|
|
810
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
601
811
|
[Symbol.iterator]() { return this; }
|
|
602
812
|
}
|
|
603
813
|
class ECSqlBindingHelper {
|
|
@@ -707,6 +917,7 @@ class ECSqlBindingHelper {
|
|
|
707
917
|
}
|
|
708
918
|
}
|
|
709
919
|
class ECSqlValueHelper {
|
|
920
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
710
921
|
static getValue(ecsqlValue) {
|
|
711
922
|
if (ecsqlValue.isNull)
|
|
712
923
|
return undefined;
|
|
@@ -723,6 +934,7 @@ class ECSqlValueHelper {
|
|
|
723
934
|
return ECSqlValueHelper.getPrimitiveValue(ecsqlValue);
|
|
724
935
|
}
|
|
725
936
|
}
|
|
937
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
726
938
|
static getStruct(ecsqlValue) {
|
|
727
939
|
if (ecsqlValue.isNull)
|
|
728
940
|
return undefined;
|
|
@@ -741,6 +953,7 @@ class ECSqlValueHelper {
|
|
|
741
953
|
}
|
|
742
954
|
return structVal;
|
|
743
955
|
}
|
|
956
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
744
957
|
static getArray(ecsqlValue) {
|
|
745
958
|
const arrayVal = [];
|
|
746
959
|
const it = ecsqlValue.getArrayIterator();
|
|
@@ -754,9 +967,11 @@ class ECSqlValueHelper {
|
|
|
754
967
|
}
|
|
755
968
|
return arrayVal;
|
|
756
969
|
}
|
|
970
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
757
971
|
static getPrimitiveValue(ecsqlValue) {
|
|
758
972
|
if (ecsqlValue.isNull)
|
|
759
973
|
return undefined;
|
|
974
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
760
975
|
const colInfo = ecsqlValue.columnInfo;
|
|
761
976
|
switch (colInfo.getType()) {
|
|
762
977
|
case ECSqlValueType.Blob:
|
|
@@ -792,7 +1007,10 @@ class ECSqlValueHelper {
|
|
|
792
1007
|
static queryClassName(ecdb, classId, tableSpace) {
|
|
793
1008
|
if (!tableSpace)
|
|
794
1009
|
tableSpace = "main";
|
|
795
|
-
|
|
1010
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1011
|
+
return ecdb.withPreparedStatement(`SELECT s.Name, c.Name FROM [${tableSpace}].meta.ECSchemaDef s, JOIN [${tableSpace}].meta.ECClassDef c ON s.ECInstanceId=c.SchemaId WHERE c.ECInstanceId=?`,
|
|
1012
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1013
|
+
(stmt) => {
|
|
796
1014
|
stmt.bindId(1, classId);
|
|
797
1015
|
if (stmt.step() !== DbResult.BE_SQLITE_ROW)
|
|
798
1016
|
throw new IModelError(DbResult.BE_SQLITE_ERROR, `No class found with ECClassId ${classId} in table space ${tableSpace}.`);
|