@itwin/core-backend 4.11.0-dev.2 → 4.11.0-dev.4
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 +42 -1
- package/lib/cjs/BisCoreSchema.d.ts.map +1 -1
- package/lib/cjs/BisCoreSchema.js +2 -0
- package/lib/cjs/BisCoreSchema.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.map +1 -1
- package/lib/cjs/CheckpointManager.js +2 -0
- package/lib/cjs/CheckpointManager.js.map +1 -1
- package/lib/cjs/ECDb.d.ts +46 -1
- package/lib/cjs/ECDb.d.ts.map +1 -1
- package/lib/cjs/ECDb.js +90 -0
- package/lib/cjs/ECDb.js.map +1 -1
- package/lib/cjs/ECSqlStatement.d.ts +200 -2
- package/lib/cjs/ECSqlStatement.d.ts.map +1 -1
- package/lib/cjs/ECSqlStatement.js +237 -5
- package/lib/cjs/ECSqlStatement.js.map +1 -1
- package/lib/cjs/ElementAspect.d.ts.map +1 -1
- package/lib/cjs/ElementAspect.js +2 -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/IModelDb.d.ts +13 -1
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +41 -5
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/IModelHost.d.ts.map +1 -1
- package/lib/cjs/IModelHost.js +1 -1
- package/lib/cjs/IModelHost.js.map +1 -1
- package/lib/cjs/Relationship.d.ts.map +1 -1
- package/lib/cjs/Relationship.js +3 -1
- 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/rpc/multipart.d.ts.map +1 -1
- package/lib/cjs/rpc/multipart.js +2 -1
- package/lib/cjs/rpc/multipart.js.map +1 -1
- package/lib/cjs/rpc/web/request.d.ts.map +1 -1
- package/lib/cjs/rpc/web/request.js +2 -1
- package/lib/cjs/rpc/web/request.js.map +1 -1
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts.map +1 -1
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +3 -2
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
- package/package.json +18 -15
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @module ECSQL
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.ECSqlValueIterator = exports.ECSqlValue = exports.ECSqlBinder = exports.ECSqlStatement = exports.ECSqlInsertResult = void 0;
|
|
10
|
+
exports.ECSqlValueIterator = exports.ECSqlValue = exports.ECSqlBinder = exports.ECSqlWriteStatement = exports.ECSqlStatement = exports.ECSqlInsertResult = void 0;
|
|
11
11
|
const core_bentley_1 = require("@itwin/core-bentley");
|
|
12
12
|
const core_geometry_1 = require("@itwin/core-geometry");
|
|
13
13
|
const core_common_1 = require("@itwin/core-common");
|
|
@@ -52,6 +52,10 @@ exports.ECSqlInsertResult = ECSqlInsertResult;
|
|
|
52
52
|
* - [Executing ECSQL]($docs/learning/backend/ExecutingECSQL) provides more background on ECSQL and an introduction on how to execute ECSQL with the iTwin.js API.
|
|
53
53
|
* - [Code Examples]($docs/learning/backend/ECSQLCodeExamples) illustrate the use of the iTwin.js API for executing and working with ECSQL
|
|
54
54
|
* @public
|
|
55
|
+
* @deprecated in 4.11. Use [IModelDb.createQueryReader]($backend) or [ECDb.createQueryReader]($backend) to query.
|
|
56
|
+
* For ECDb, use [ECDb.withCachedWriteStatement]($backend) or [ECDb.withWriteStatement]($backend) to Insert/Update/Delete.
|
|
57
|
+
* [IModelDb.createQueryReader]($backend) is an asynchronous API. If you encounter a use case that cannot be converted to async, please report an issue at https://github.com/iTwin/itwinjs-core/issues.
|
|
58
|
+
* Mean while use [IModelDb.withPreparedStatement]($backend) for synchronous API calls where conversion to async is not possible.
|
|
55
59
|
*/
|
|
56
60
|
class ECSqlStatement {
|
|
57
61
|
constructor() {
|
|
@@ -356,12 +360,216 @@ class ECSqlStatement {
|
|
|
356
360
|
*
|
|
357
361
|
* See also: [Code Samples]($docs/learning/backend/ECSQLCodeExamples#working-with-the-query-result)
|
|
358
362
|
*/
|
|
363
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
359
364
|
getValue(columnIx) {
|
|
360
365
|
(0, core_bentley_1.assert)(undefined !== this._stmt);
|
|
366
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
361
367
|
return new ECSqlValue(this._stmt.getValue(columnIx));
|
|
362
368
|
}
|
|
363
369
|
}
|
|
364
370
|
exports.ECSqlStatement = ECSqlStatement;
|
|
371
|
+
/** Executes ECSQL INSERT/UPDATE/DELETE statements.
|
|
372
|
+
*
|
|
373
|
+
* A statement must be prepared before it can be executed, and it must be released when no longer needed.
|
|
374
|
+
* See [ECDb.withCachedWriteStatement]($backend) for a convenient and
|
|
375
|
+
* reliable way to prepare, execute, and then release a statement.
|
|
376
|
+
*
|
|
377
|
+
* A statement may contain parameters that must be filled in before use by the **bind** methods.
|
|
378
|
+
*
|
|
379
|
+
* Once prepared (and parameters are bound, if any), the statement is executed by calling [ECSqlStatement.stepForInsert]($backend).
|
|
380
|
+
*
|
|
381
|
+
* > Preparing a statement can be time-consuming. The best way to reduce the effect of this overhead is to cache and reuse prepared
|
|
382
|
+
* > statements. A cached prepared statement may be used in different places in an app, as long as the statement is general enough.
|
|
383
|
+
* > 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.
|
|
384
|
+
*
|
|
385
|
+
* See also
|
|
386
|
+
* - [Executing ECSQL]($docs/learning/backend/ExecutingECSQL) provides more background on ECSQL and an introduction on how to execute ECSQL with the iTwin.js API.
|
|
387
|
+
* - [Code Examples]($docs/learning/backend/ECSQLCodeExamples) illustrate the use of the iTwin.js API for executing and working with ECSQL
|
|
388
|
+
* @public
|
|
389
|
+
*/
|
|
390
|
+
class ECSqlWriteStatement {
|
|
391
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
392
|
+
constructor(stmt) {
|
|
393
|
+
if (stmt)
|
|
394
|
+
this._stmt = stmt;
|
|
395
|
+
else {
|
|
396
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
397
|
+
this._stmt = new ECSqlStatement();
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
get sql() { return this._stmt.sql; }
|
|
401
|
+
/** Check if this statement has been prepared successfully or not */
|
|
402
|
+
get isPrepared() { return this._stmt.isPrepared; }
|
|
403
|
+
/** Get the underlying ECSqlStatement. Needed until we remove ECSqlStatement.
|
|
404
|
+
* @param
|
|
405
|
+
* @internal
|
|
406
|
+
*/
|
|
407
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
408
|
+
get stmt() { return this._stmt; }
|
|
409
|
+
/** Prepare this statement prior to first use.
|
|
410
|
+
* @param db The ECDb to prepare the statement against
|
|
411
|
+
* @param ecsql The ECSQL statement string to prepare
|
|
412
|
+
* @param logErrors Determine if errors are logged or not
|
|
413
|
+
* @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.
|
|
414
|
+
* The error.message property will provide details.
|
|
415
|
+
* @internal
|
|
416
|
+
*/
|
|
417
|
+
prepare(db, ecsql, logErrors = true) {
|
|
418
|
+
this._stmt.prepare(db, ecsql, logErrors);
|
|
419
|
+
}
|
|
420
|
+
/** Prepare this statement prior to first use.
|
|
421
|
+
* @param db The DgnDb or ECDb to prepare the statement against
|
|
422
|
+
* @param ecsql The ECSQL statement string to prepare
|
|
423
|
+
* @param logErrors Determine if errors are logged or not, its set to false by default for tryPrepare()
|
|
424
|
+
* @returns An object with a `status` member equal to [DbResult.BE_SQLITE_OK]($bentley) on success. Upon error, the `message` member will provide details.
|
|
425
|
+
* @internal
|
|
426
|
+
*/
|
|
427
|
+
tryPrepare(db, ecsql, logErrors = false) {
|
|
428
|
+
return this.tryPrepare(db, ecsql, logErrors);
|
|
429
|
+
}
|
|
430
|
+
/** Reset this statement so that the next call to step will return the first row, if any. */
|
|
431
|
+
reset() {
|
|
432
|
+
this._stmt.reset();
|
|
433
|
+
}
|
|
434
|
+
/** Get the Native SQL statement
|
|
435
|
+
* @internal
|
|
436
|
+
*/
|
|
437
|
+
getNativeSql() {
|
|
438
|
+
return this._stmt.getNativeSql();
|
|
439
|
+
}
|
|
440
|
+
/** Call this function when finished with this statement. This releases the native resources held by the statement.
|
|
441
|
+
*
|
|
442
|
+
* > Do not call this method directly on a statement that is being managed by a statement cache.
|
|
443
|
+
*/
|
|
444
|
+
dispose() {
|
|
445
|
+
this._stmt.dispose(); // free native statement
|
|
446
|
+
}
|
|
447
|
+
/** Binds the specified value to the specified ECSQL parameter.
|
|
448
|
+
* The section "[iTwin.js Types used in ECSQL Parameter Bindings]($docs/learning/ECSQLParameterTypes)" describes the
|
|
449
|
+
* iTwin.js types to be used for the different ECSQL parameter types.
|
|
450
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
451
|
+
*/
|
|
452
|
+
bindValue(parameter, val) { this.getBinder(parameter).bind(val); }
|
|
453
|
+
/** Binds null to the specified ECSQL parameter.
|
|
454
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
455
|
+
*/
|
|
456
|
+
bindNull(parameter) { this.getBinder(parameter).bindNull(); }
|
|
457
|
+
/** Binds a BLOB value to the specified ECSQL parameter.
|
|
458
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
459
|
+
* @param BLOB value as either a Uint8Array, ArrayBuffer or a Base64 string
|
|
460
|
+
*/
|
|
461
|
+
bindBlob(parameter, blob) { this.getBinder(parameter).bindBlob(blob); }
|
|
462
|
+
/** Binds a boolean value to the specified ECSQL parameter.
|
|
463
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
464
|
+
* @param val Boolean value
|
|
465
|
+
*/
|
|
466
|
+
bindBoolean(parameter, val) { this.getBinder(parameter).bindBoolean(val); }
|
|
467
|
+
/** Binds a DateTime value to the specified ECSQL parameter.
|
|
468
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
469
|
+
* @param isoDateTimeString DateTime value as ISO8601 string
|
|
470
|
+
*/
|
|
471
|
+
bindDateTime(parameter, isoDateTimeString) { this.getBinder(parameter).bindDateTime(isoDateTimeString); }
|
|
472
|
+
/** Binds a double value to the specified ECSQL parameter.
|
|
473
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
474
|
+
* @param val Double value
|
|
475
|
+
*/
|
|
476
|
+
bindDouble(parameter, val) { this.getBinder(parameter).bindDouble(val); }
|
|
477
|
+
/** Binds an GUID value to the specified ECSQL parameter.
|
|
478
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
479
|
+
* @param val GUID value
|
|
480
|
+
*/
|
|
481
|
+
bindGuid(parameter, val) { this.getBinder(parameter).bindGuid(val); }
|
|
482
|
+
/** Binds an Id value to the specified ECSQL parameter.
|
|
483
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
484
|
+
* @param val Id value
|
|
485
|
+
*/
|
|
486
|
+
bindId(parameter, val) { this.getBinder(parameter).bindId(val); }
|
|
487
|
+
/** Binds an integer value to the specified ECSQL parameter.
|
|
488
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
489
|
+
* @param val Integer value as number, decimal string or hexadecimal string.
|
|
490
|
+
*/
|
|
491
|
+
bindInteger(parameter, val) { this.getBinder(parameter).bindInteger(val); }
|
|
492
|
+
/** Binds an Point2d value to the specified ECSQL parameter.
|
|
493
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
494
|
+
* @param val Point2d value
|
|
495
|
+
*/
|
|
496
|
+
bindPoint2d(parameter, val) { this.getBinder(parameter).bindPoint2d(val); }
|
|
497
|
+
/** Binds an Point3d value to the specified ECSQL parameter.
|
|
498
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
499
|
+
* @param val Point3d value
|
|
500
|
+
*/
|
|
501
|
+
bindPoint3d(parameter, val) { this.getBinder(parameter).bindPoint3d(val); }
|
|
502
|
+
/** Binds a Range3d as a blob to the specified ECSQL parameter
|
|
503
|
+
* @param parameter Index(1-based) or name of the parameter
|
|
504
|
+
* @param val Range3d value
|
|
505
|
+
*/
|
|
506
|
+
bindRange3d(parameter, val) { this.getBinder(parameter).bindRange3d(val); }
|
|
507
|
+
/** Binds an string to the specified ECSQL parameter.
|
|
508
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
509
|
+
* @param val String value
|
|
510
|
+
*/
|
|
511
|
+
bindString(parameter, val) { this.getBinder(parameter).bindString(val); }
|
|
512
|
+
/** Binds a navigation property value to the specified ECSQL parameter.
|
|
513
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
514
|
+
* @param val Navigation property value
|
|
515
|
+
*/
|
|
516
|
+
bindNavigation(parameter, val) { this.getBinder(parameter).bindNavigation(val); }
|
|
517
|
+
/** Binds a struct property value to the specified ECSQL parameter.
|
|
518
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
519
|
+
* @param val Struct value. The struct value is an object composed of pairs of a struct member property name and its value
|
|
520
|
+
* (of one of the supported types)
|
|
521
|
+
*/
|
|
522
|
+
bindStruct(parameter, val) { this.getBinder(parameter).bindStruct(val); }
|
|
523
|
+
/** Binds an array value to the specified ECSQL parameter.
|
|
524
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
525
|
+
* @param val Array value. The array value is an array of values of the supported types
|
|
526
|
+
*/
|
|
527
|
+
bindArray(parameter, val) { this.getBinder(parameter).bindArray(val); }
|
|
528
|
+
bindIdSet(parameter, val) { this.getBinder(parameter).bindIdSet(val); }
|
|
529
|
+
/**
|
|
530
|
+
* Gets a binder to bind a value for an ECSQL parameter
|
|
531
|
+
* > This is the most low-level API to bind a value to a specific parameter. Alternatively you can use the ECSqlStatement.bindXX methods
|
|
532
|
+
* > or [ECSqlStatement.bindValues]($backend).
|
|
533
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
534
|
+
*/
|
|
535
|
+
getBinder(parameter) {
|
|
536
|
+
return this._stmt.getBinder(parameter);
|
|
537
|
+
}
|
|
538
|
+
/** Bind values to all parameters in the statement.
|
|
539
|
+
* @param values The values to bind to the parameters.
|
|
540
|
+
* Pass an *array* of values if the parameters are *positional*.
|
|
541
|
+
* Pass an *object of the values keyed on the parameter name* for *named parameters*.
|
|
542
|
+
* The values in either the array or object must match the respective types of the parameter.
|
|
543
|
+
*
|
|
544
|
+
* The section "[iTwin.js Types used in ECSQL Parameter Bindings]($docs/learning/ECSQLParameterTypes)" describes the
|
|
545
|
+
* iTwin.js types to be used for the different ECSQL parameter types.
|
|
546
|
+
*
|
|
547
|
+
* See also these [Code Samples]($docs/learning/backend/ECSQLCodeExamples#binding-to-all-parameters-at-once)
|
|
548
|
+
*/
|
|
549
|
+
bindValues(values) {
|
|
550
|
+
this._stmt.bindValues(values);
|
|
551
|
+
}
|
|
552
|
+
/** Clear any bindings that were previously set on this statement.
|
|
553
|
+
* @throws [IModelError]($common) in case of errors
|
|
554
|
+
*/
|
|
555
|
+
clearBindings() {
|
|
556
|
+
this._stmt.clearBindings();
|
|
557
|
+
}
|
|
558
|
+
/** Step this INSERT statement and returns status and the ECInstanceId of the newly
|
|
559
|
+
* created instance.
|
|
560
|
+
*
|
|
561
|
+
* > Insert statements can be used with ECDb only, not with IModelDb.
|
|
562
|
+
*
|
|
563
|
+
* @returns Returns the generated ECInstanceId in case of success and the status of the step
|
|
564
|
+
* call. In case of error, the respective error code is returned.
|
|
565
|
+
*/
|
|
566
|
+
stepForInsert() {
|
|
567
|
+
return this._stmt.stepForInsert();
|
|
568
|
+
}
|
|
569
|
+
/** Get the query result's column count (only for ECSQL SELECT statements). */
|
|
570
|
+
getColumnCount() { return this._stmt.getColumnCount(); }
|
|
571
|
+
}
|
|
572
|
+
exports.ECSqlWriteStatement = ECSqlWriteStatement;
|
|
365
573
|
/** Binds a value to an ECSQL parameter.
|
|
366
574
|
*
|
|
367
575
|
* See also:
|
|
@@ -522,11 +730,16 @@ exports.ECSqlBinder = ECSqlBinder;
|
|
|
522
730
|
* - [ECSqlStatement.getValue]($backend)
|
|
523
731
|
* - [Code Samples]($docs/learning/backend/ECSQLCodeExamples#working-with-the-query-result)
|
|
524
732
|
* @public
|
|
525
|
-
|
|
733
|
+
* @deprecated in 4.11. Use [IModelDb.createQueryReader]($backend) or [ECDb.createQueryReader]($backend) to query.
|
|
734
|
+
* For ECDb, use [ECDb.withCachedWriteStatement]($backend) or [ECDb.withWriteStatement]($backend) to Insert/Update/Delete.
|
|
735
|
+
* [IModelDb.createQueryReader]($backend) is an asynchronous API. If you encounter a use case that cannot be converted to async, please report an issue at https://github.com/iTwin/itwinjs-core/issues.
|
|
736
|
+
* Mean while use [IModelDb.withPreparedStatement]($backend) for synchronous API calls where conversion to async is not possible.
|
|
737
|
+
*/
|
|
526
738
|
class ECSqlValue {
|
|
527
739
|
/** @internal */
|
|
528
740
|
constructor(val) { this._val = val; }
|
|
529
741
|
/** Get information about the query result's column this value refers to. */
|
|
742
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
530
743
|
get columnInfo() { return this._val.getColumnInfo(); }
|
|
531
744
|
/** Get the value of this ECSQL value */
|
|
532
745
|
get value() { return ECSqlValueHelper.getValue(this); }
|
|
@@ -571,14 +784,17 @@ class ECSqlValue {
|
|
|
571
784
|
* @return ECEnumeration value(s) or undefined if the ECSqlValue does not represent an ECEnumeration.
|
|
572
785
|
* or is not a strict match of an ECEnumerator or a combination of them.
|
|
573
786
|
*/
|
|
787
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
574
788
|
getEnum() { return this._val.getEnum(); }
|
|
575
789
|
/** Get the value as [NavigationValue]($common) */
|
|
576
790
|
getNavigation() { return this._val.getNavigation(); }
|
|
577
791
|
/** Get an iterator for iterating the struct members of this struct value. */
|
|
792
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
578
793
|
getStructIterator() { return new ECSqlValueIterator(this._val.getStructIterator()); }
|
|
579
794
|
/** Get this struct value's content as object literal */
|
|
580
795
|
getStruct() { return ECSqlValueHelper.getStruct(this); }
|
|
581
796
|
/** Get an iterator for iterating the array elements of this array value. */
|
|
797
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
582
798
|
getArrayIterator() { return new ECSqlValueIterator(this._val.getArrayIterator()); }
|
|
583
799
|
/** Get this array value as JavaScript array */
|
|
584
800
|
getArray() { return ECSqlValueHelper.getArray(this); }
|
|
@@ -587,15 +803,23 @@ exports.ECSqlValue = ECSqlValue;
|
|
|
587
803
|
/** Iterator over members of a struct [ECSqlValue]($backend) or the elements of an array [ECSqlValue]($backend).
|
|
588
804
|
* See [ECSqlValue.getStructIterator]($backend) or [ECSqlValue.getArrayIterator]($backend).
|
|
589
805
|
* @public
|
|
590
|
-
|
|
806
|
+
* @deprecated in 4.11. Use [IModelDb.createQueryReader]($backend) or [ECDb.createQueryReader]($backend) to query.
|
|
807
|
+
* For ECDb, use [ECDb.withCachedWriteStatement]($backend) or [ECDb.withWriteStatement]($backend) to Insert/Update/Delete.
|
|
808
|
+
* [IModelDb.createQueryReader]($backend) is an asynchronous API. If you encounter a use case that cannot be converted to async, please report an issue at https://github.com/iTwin/itwinjs-core/issues.
|
|
809
|
+
* Mean while use [IModelDb.withPreparedStatement]($backend) for synchronous API calls where conversion to async is not possible.
|
|
810
|
+
*/
|
|
591
811
|
class ECSqlValueIterator {
|
|
592
812
|
/** @internal */
|
|
593
813
|
constructor(it) { this._it = it; }
|
|
814
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
594
815
|
next() {
|
|
595
|
-
if (this._it.moveNext())
|
|
816
|
+
if (this._it.moveNext()) {
|
|
817
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
596
818
|
return { done: false, value: new ECSqlValue(this._it.getCurrent()) };
|
|
819
|
+
}
|
|
597
820
|
return { done: true, value: undefined };
|
|
598
821
|
}
|
|
822
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
599
823
|
[Symbol.iterator]() { return this; }
|
|
600
824
|
}
|
|
601
825
|
exports.ECSqlValueIterator = ECSqlValueIterator;
|
|
@@ -706,6 +930,7 @@ class ECSqlBindingHelper {
|
|
|
706
930
|
}
|
|
707
931
|
}
|
|
708
932
|
class ECSqlValueHelper {
|
|
933
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
709
934
|
static getValue(ecsqlValue) {
|
|
710
935
|
if (ecsqlValue.isNull)
|
|
711
936
|
return undefined;
|
|
@@ -722,6 +947,7 @@ class ECSqlValueHelper {
|
|
|
722
947
|
return ECSqlValueHelper.getPrimitiveValue(ecsqlValue);
|
|
723
948
|
}
|
|
724
949
|
}
|
|
950
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
725
951
|
static getStruct(ecsqlValue) {
|
|
726
952
|
if (ecsqlValue.isNull)
|
|
727
953
|
return undefined;
|
|
@@ -740,6 +966,7 @@ class ECSqlValueHelper {
|
|
|
740
966
|
}
|
|
741
967
|
return structVal;
|
|
742
968
|
}
|
|
969
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
743
970
|
static getArray(ecsqlValue) {
|
|
744
971
|
const arrayVal = [];
|
|
745
972
|
const it = ecsqlValue.getArrayIterator();
|
|
@@ -753,9 +980,11 @@ class ECSqlValueHelper {
|
|
|
753
980
|
}
|
|
754
981
|
return arrayVal;
|
|
755
982
|
}
|
|
983
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
756
984
|
static getPrimitiveValue(ecsqlValue) {
|
|
757
985
|
if (ecsqlValue.isNull)
|
|
758
986
|
return undefined;
|
|
987
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
759
988
|
const colInfo = ecsqlValue.columnInfo;
|
|
760
989
|
switch (colInfo.getType()) {
|
|
761
990
|
case core_common_1.ECSqlValueType.Blob:
|
|
@@ -791,7 +1020,10 @@ class ECSqlValueHelper {
|
|
|
791
1020
|
static queryClassName(ecdb, classId, tableSpace) {
|
|
792
1021
|
if (!tableSpace)
|
|
793
1022
|
tableSpace = "main";
|
|
794
|
-
|
|
1023
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1024
|
+
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=?`,
|
|
1025
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1026
|
+
(stmt) => {
|
|
795
1027
|
stmt.bindId(1, classId);
|
|
796
1028
|
if (stmt.step() !== core_bentley_1.DbResult.BE_SQLITE_ROW)
|
|
797
1029
|
throw new core_common_1.IModelError(core_bentley_1.DbResult.BE_SQLITE_ERROR, `No class found with ECClassId ${classId} in table space ${tableSpace}.`);
|