@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
|
@@ -115,7 +115,7 @@ describe("ECSqlStatement", () => {
|
|
|
115
115
|
</ECEntityClass>
|
|
116
116
|
</ECSchema>`), false);
|
|
117
117
|
assert.isTrue(ecdb.isOpen);
|
|
118
|
-
const r = await ecdb.
|
|
118
|
+
const r = await ecdb.withCachedWriteStatement("INSERT INTO ts.Foo(n,dt,fooId) VALUES(20,TIMESTAMP '2018-10-18T12:00:00Z',20)", async (stmt) => {
|
|
119
119
|
return stmt.stepForInsert();
|
|
120
120
|
});
|
|
121
121
|
ecdb.saveChanges();
|
|
@@ -141,10 +141,10 @@ describe("ECSqlStatement", () => {
|
|
|
141
141
|
</ECEntityClass>
|
|
142
142
|
</ECSchema>`), false);
|
|
143
143
|
assert.isTrue(ecdb.isOpen);
|
|
144
|
-
await ecdb.
|
|
144
|
+
await ecdb.withCachedWriteStatement("INSERT INTO ts.Foo(n,dt,fooId) VALUES(20,TIMESTAMP '2018-10-18T12:00:00Z',20)", async (stmt) => {
|
|
145
145
|
stmt.stepForInsert();
|
|
146
146
|
});
|
|
147
|
-
await ecdb.
|
|
147
|
+
await ecdb.withCachedWriteStatement("INSERT INTO ts.Foo(n,dt,fooId) VALUES(30,TIMESTAMP '2019-10-18T12:00:00Z',30)", async (stmt) => {
|
|
148
148
|
stmt.stepForInsert();
|
|
149
149
|
});
|
|
150
150
|
ecdb.saveChanges();
|
|
@@ -172,6 +172,7 @@ describe("ECSqlStatement", () => {
|
|
|
172
172
|
try {
|
|
173
173
|
const ecdb = __addDisposableResource(env_3, ECDbTestHelper.createECDb(outDir, "nullstring.ecdb"), false);
|
|
174
174
|
assert.isTrue(ecdb.isOpen);
|
|
175
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
175
176
|
await ecdb.withPreparedStatement(`VALUES(NULL)`, async (stmt) => {
|
|
176
177
|
stmt.step();
|
|
177
178
|
const str = stmt.getValue(0).getString();
|
|
@@ -198,7 +199,7 @@ describe("ECSqlStatement", () => {
|
|
|
198
199
|
const ROW_COUNT = 27;
|
|
199
200
|
// insert test rows
|
|
200
201
|
for (let i = 1; i <= ROW_COUNT; i++) {
|
|
201
|
-
const r = await ecdb.
|
|
202
|
+
const r = await ecdb.withCachedWriteStatement(`insert into ts.Foo(n) values(${i})`, async (stmt) => {
|
|
202
203
|
return stmt.stepForInsert();
|
|
203
204
|
});
|
|
204
205
|
assert.equal(r.status, DbResult.BE_SQLITE_DONE);
|
|
@@ -244,7 +245,7 @@ describe("ECSqlStatement", () => {
|
|
|
244
245
|
const ROW_COUNT = 100;
|
|
245
246
|
// insert test rows
|
|
246
247
|
for (let i = 1; i <= ROW_COUNT; i++) {
|
|
247
|
-
const r = await ecdb.
|
|
248
|
+
const r = await ecdb.withCachedWriteStatement(`insert into ts.Foo(n) values(${i})`, async (stmt) => {
|
|
248
249
|
return stmt.stepForInsert();
|
|
249
250
|
});
|
|
250
251
|
assert.equal(r.status, DbResult.BE_SQLITE_DONE);
|
|
@@ -283,7 +284,7 @@ describe("ECSqlStatement", () => {
|
|
|
283
284
|
const ROW_COUNT = 100;
|
|
284
285
|
// insert test rows
|
|
285
286
|
for (let i = 1; i <= ROW_COUNT; i++) {
|
|
286
|
-
const r = await ecdb.
|
|
287
|
+
const r = await ecdb.withCachedWriteStatement(`insert into ts.Foo(n) values(${i})`, async (stmt) => {
|
|
287
288
|
return stmt.stepForInsert();
|
|
288
289
|
});
|
|
289
290
|
assert.equal(r.status, DbResult.BE_SQLITE_DONE);
|
|
@@ -347,7 +348,7 @@ describe("ECSqlStatement", () => {
|
|
|
347
348
|
const ROW_COUNT = 27;
|
|
348
349
|
// insert test rows
|
|
349
350
|
for (let i = 1; i <= ROW_COUNT; i++) {
|
|
350
|
-
const r = await ecdb.
|
|
351
|
+
const r = await ecdb.withCachedWriteStatement(`insert into ts.Foo(n) values(${i})`, async (stmt) => {
|
|
351
352
|
return stmt.stepForInsert();
|
|
352
353
|
});
|
|
353
354
|
assert.equal(r.status, DbResult.BE_SQLITE_DONE);
|
|
@@ -383,7 +384,7 @@ describe("ECSqlStatement", () => {
|
|
|
383
384
|
</ECSchema>`), false);
|
|
384
385
|
assert.isTrue(ecdb.isOpen);
|
|
385
386
|
for (let i = 1; i <= 5; i++) {
|
|
386
|
-
const r = await ecdb.
|
|
387
|
+
const r = await ecdb.withCachedWriteStatement(`insert into ts.Foo(n) values(${i})`, async (stmt) => {
|
|
387
388
|
return stmt.stepForInsert();
|
|
388
389
|
});
|
|
389
390
|
assert.equal(r.status, DbResult.BE_SQLITE_DONE);
|
|
@@ -426,7 +427,7 @@ describe("ECSqlStatement", () => {
|
|
|
426
427
|
</ECSchema>`), false);
|
|
427
428
|
assert.isTrue(ecdb.isOpen);
|
|
428
429
|
for (let i = 1; i <= 2; i++) {
|
|
429
|
-
const r = await ecdb.
|
|
430
|
+
const r = await ecdb.withCachedWriteStatement(`insert into ts.Foo(n) values(${i})`, async (stmt) => {
|
|
430
431
|
return stmt.stepForInsert();
|
|
431
432
|
});
|
|
432
433
|
assert.equal(r.status, DbResult.BE_SQLITE_DONE);
|
|
@@ -457,7 +458,7 @@ describe("ECSqlStatement", () => {
|
|
|
457
458
|
const maxRows = 10;
|
|
458
459
|
const guids = [];
|
|
459
460
|
for (let i = 0; i < maxRows; i++) {
|
|
460
|
-
const r = await ecdb.
|
|
461
|
+
const r = await ecdb.withCachedWriteStatement(`insert into ts.Foo(guid) values(?)`, async (stmt) => {
|
|
461
462
|
guids.push(Guid.createValue());
|
|
462
463
|
stmt.bindGuid(1, guids[i]);
|
|
463
464
|
return stmt.stepForInsert();
|
|
@@ -548,6 +549,7 @@ describe("ECSqlStatement", () => {
|
|
|
548
549
|
assert.equal(actualRes.status, DbResult.BE_SQLITE_DONE);
|
|
549
550
|
assert.isDefined(actualRes.id);
|
|
550
551
|
assert.equal(actualRes.id, expectedECInstanceId);
|
|
552
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
551
553
|
ecdbToVerify.withPreparedStatement("SELECT ECInstanceId, ECClassId, Name FROM ecdbf.ExternalFileInfo WHERE ECInstanceId=?", (stmt) => {
|
|
552
554
|
stmt.bindId(1, expectedId);
|
|
553
555
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
@@ -563,27 +565,27 @@ describe("ECSqlStatement", () => {
|
|
|
563
565
|
}), 1);
|
|
564
566
|
};
|
|
565
567
|
let expectedId = Id64.fromLocalAndBriefcaseIds(4444, 0);
|
|
566
|
-
let r = ecdb.
|
|
568
|
+
let r = ecdb.withCachedWriteStatement("INSERT INTO ecdbf.ExternalFileInfo(ECInstanceId,Name) VALUES(?,?)", (stmt) => {
|
|
567
569
|
stmt.bindId(1, expectedId);
|
|
568
570
|
stmt.bindString(2, "4444.txt");
|
|
569
571
|
return stmt.stepForInsert();
|
|
570
572
|
});
|
|
571
573
|
await verify(ecdb, r, expectedId);
|
|
572
574
|
expectedId = Id64.fromLocalAndBriefcaseIds(4445, 0);
|
|
573
|
-
r = ecdb.
|
|
575
|
+
r = ecdb.withCachedWriteStatement("INSERT INTO ecdbf.ExternalFileInfo(ECInstanceId,Name) VALUES(:id,:name)", (stmt) => {
|
|
574
576
|
stmt.bindId("id", expectedId);
|
|
575
577
|
stmt.bindString("name", "4445.txt");
|
|
576
578
|
return stmt.stepForInsert();
|
|
577
579
|
});
|
|
578
580
|
await verify(ecdb, r, expectedId);
|
|
579
581
|
expectedId = Id64.fromLocalAndBriefcaseIds(4446, 0);
|
|
580
|
-
r = ecdb.
|
|
582
|
+
r = ecdb.withCachedWriteStatement("INSERT INTO ecdbf.ExternalFileInfo(ECInstanceId,Name) VALUES(?,?)", (stmt) => {
|
|
581
583
|
stmt.bindValues([expectedId, "4446.txt"]);
|
|
582
584
|
return stmt.stepForInsert();
|
|
583
585
|
});
|
|
584
586
|
await verify(ecdb, r, expectedId);
|
|
585
587
|
expectedId = Id64.fromLocalAndBriefcaseIds(4447, 0);
|
|
586
|
-
r = ecdb.
|
|
588
|
+
r = ecdb.withCachedWriteStatement("INSERT INTO ecdbf.ExternalFileInfo(ECInstanceId,Name) VALUES(:id,:name)", (stmt) => {
|
|
587
589
|
stmt.bindValues({ id: expectedId, name: "4447.txt" });
|
|
588
590
|
return stmt.stepForInsert();
|
|
589
591
|
});
|
|
@@ -627,12 +629,13 @@ describe("ECSqlStatement", () => {
|
|
|
627
629
|
</ECEntityClass>
|
|
628
630
|
</ECSchema>`), false);
|
|
629
631
|
assert.isTrue(ecdb.isOpen);
|
|
630
|
-
const r = ecdb.
|
|
632
|
+
const r = ecdb.withCachedWriteStatement("INSERT INTO ts.Foo(n,dt,fooId) VALUES(20,TIMESTAMP '2018-10-18T12:00:00Z',20)", (stmt) => {
|
|
631
633
|
return stmt.stepForInsert();
|
|
632
634
|
});
|
|
633
635
|
ecdb.saveChanges();
|
|
634
636
|
assert.equal(r.status, DbResult.BE_SQLITE_DONE);
|
|
635
637
|
const ecsqln = "SELECT 1 FROM ts.Foo WHERE n=?";
|
|
638
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
636
639
|
await ecdb.withPreparedStatement(ecsqln, async (stmt) => {
|
|
637
640
|
const nNum = 20;
|
|
638
641
|
const nStr = "20";
|
|
@@ -708,6 +711,7 @@ describe("ECSqlStatement", () => {
|
|
|
708
711
|
stmt.clearBindings();
|
|
709
712
|
});
|
|
710
713
|
const ecsqldt = "SELECT 1 FROM ts.Foo WHERE dt=?";
|
|
714
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
711
715
|
await ecdb.withPreparedStatement(ecsqldt, async (stmt) => {
|
|
712
716
|
const dtStr = "2018-10-18T12:00:00Z";
|
|
713
717
|
const num = 2458410;
|
|
@@ -763,6 +767,7 @@ describe("ECSqlStatement", () => {
|
|
|
763
767
|
stmt.clearBindings();
|
|
764
768
|
});
|
|
765
769
|
const ecsqlfooId = "SELECT 1 FROM ts.Foo WHERE fooId=?";
|
|
770
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
766
771
|
await ecdb.withPreparedStatement(ecsqlfooId, async (stmt) => {
|
|
767
772
|
const num = 20;
|
|
768
773
|
const str = "20";
|
|
@@ -869,7 +874,7 @@ describe("ECSqlStatement", () => {
|
|
|
869
874
|
</ECSchema>`), false);
|
|
870
875
|
assert.isTrue(ecdb.isOpen);
|
|
871
876
|
const doubleVal = 3.5;
|
|
872
|
-
let id = await ecdb.
|
|
877
|
+
let id = await ecdb.withCachedWriteStatement("INSERT INTO Test.Foo(D,I,L,S,Description) VALUES(?,?,?,?,'bindDouble')", async (stmt) => {
|
|
873
878
|
stmt.bindDouble(1, doubleVal);
|
|
874
879
|
stmt.bindDouble(2, doubleVal);
|
|
875
880
|
stmt.bindDouble(3, doubleVal);
|
|
@@ -878,6 +883,7 @@ describe("ECSqlStatement", () => {
|
|
|
878
883
|
assert.equal(r.status, DbResult.BE_SQLITE_DONE);
|
|
879
884
|
return r.id;
|
|
880
885
|
});
|
|
886
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
881
887
|
await ecdb.withPreparedStatement("SELECT D,I,L,S FROM Test.Foo WHERE ECInstanceId=?", async (stmt) => {
|
|
882
888
|
stmt.bindId(1, id);
|
|
883
889
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
@@ -894,7 +900,7 @@ describe("ECSqlStatement", () => {
|
|
|
894
900
|
assert.equal(row.s, "3.5");
|
|
895
901
|
}), 1);
|
|
896
902
|
const smallIntVal = 3;
|
|
897
|
-
id = ecdb.
|
|
903
|
+
id = ecdb.withCachedWriteStatement("INSERT INTO Test.Foo(D,I,L,S,Description) VALUES(?,?,?,?,'bindInteger, small int')", (stmt) => {
|
|
898
904
|
stmt.bindInteger(1, smallIntVal);
|
|
899
905
|
stmt.bindInteger(2, smallIntVal);
|
|
900
906
|
stmt.bindInteger(3, smallIntVal);
|
|
@@ -903,6 +909,7 @@ describe("ECSqlStatement", () => {
|
|
|
903
909
|
assert.equal(r.status, DbResult.BE_SQLITE_DONE);
|
|
904
910
|
return r.id;
|
|
905
911
|
});
|
|
912
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
906
913
|
ecdb.withPreparedStatement("SELECT D,I,L,S FROM Test.Foo WHERE ECInstanceId=?", (stmt) => {
|
|
907
914
|
stmt.bindId(1, id);
|
|
908
915
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
@@ -922,7 +929,7 @@ describe("ECSqlStatement", () => {
|
|
|
922
929
|
assert.isFalse(Number.isSafeInteger(largeUnsafeNumber));
|
|
923
930
|
const largeUnsafeNumberStr = "12312312312312323654";
|
|
924
931
|
const largeUnsafeNumberHexStr = "0xaade1ed08b0b5e46";
|
|
925
|
-
id = ecdb.
|
|
932
|
+
id = ecdb.withCachedWriteStatement("INSERT INTO Test.Foo(D,I,L,S,Description) VALUES(?,?,?,?,'bindInteger, large unsafe number as string')", (stmt) => {
|
|
926
933
|
stmt.bindInteger(1, largeUnsafeNumberStr);
|
|
927
934
|
stmt.bindInteger(2, largeUnsafeNumberStr);
|
|
928
935
|
stmt.bindInteger(3, largeUnsafeNumberStr);
|
|
@@ -931,6 +938,7 @@ describe("ECSqlStatement", () => {
|
|
|
931
938
|
assert.equal(r.status, DbResult.BE_SQLITE_DONE);
|
|
932
939
|
return r.id;
|
|
933
940
|
});
|
|
941
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
934
942
|
ecdb.withPreparedStatement("SELECT Str(I) si, HexStr(I) hi, Str(L) sl, HexStr(L) hl FROM Test.Foo WHERE ECInstanceId=?", (stmt) => {
|
|
935
943
|
stmt.bindId(1, id);
|
|
936
944
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
@@ -946,7 +954,7 @@ describe("ECSqlStatement", () => {
|
|
|
946
954
|
// assert.equal(row.sl, largeUnsafeNumberStr);
|
|
947
955
|
// assert.equal(row.hl, largeUnsafeNumberHexStr);
|
|
948
956
|
// }), 1);
|
|
949
|
-
id = ecdb.
|
|
957
|
+
id = ecdb.withCachedWriteStatement("INSERT INTO Test.Foo(D,I,L,S,Description) VALUES(?,?,?,?,'bindInteger, large unsafe number as hexstring')", (stmt) => {
|
|
950
958
|
stmt.bindInteger(1, largeUnsafeNumberHexStr);
|
|
951
959
|
stmt.bindInteger(2, largeUnsafeNumberHexStr);
|
|
952
960
|
stmt.bindInteger(3, largeUnsafeNumberHexStr);
|
|
@@ -955,6 +963,7 @@ describe("ECSqlStatement", () => {
|
|
|
955
963
|
assert.equal(r.status, DbResult.BE_SQLITE_DONE);
|
|
956
964
|
return r.id;
|
|
957
965
|
});
|
|
966
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
958
967
|
ecdb.withPreparedStatement("SELECT Str(I) si, HexStr(I) hi, Str(L) sl, HexStr(L) hl FROM Test.Foo WHERE ECInstanceId=?", (stmt) => {
|
|
959
968
|
stmt.bindId(1, id);
|
|
960
969
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
@@ -970,7 +979,7 @@ describe("ECSqlStatement", () => {
|
|
|
970
979
|
// assert.equal(row.sl, largeUnsafeNumberStr);
|
|
971
980
|
// assert.equal(row.hl, largeUnsafeNumberHexStr);
|
|
972
981
|
// }), 1);
|
|
973
|
-
id = ecdb.
|
|
982
|
+
id = ecdb.withCachedWriteStatement("INSERT INTO Test.Foo(D,I,L,S,Description) VALUES(?,?,?,?,'bindString, large unsafe number as string')", (stmt) => {
|
|
974
983
|
stmt.bindString(1, largeUnsafeNumberStr);
|
|
975
984
|
stmt.bindString(2, largeUnsafeNumberStr);
|
|
976
985
|
stmt.bindString(3, largeUnsafeNumberStr);
|
|
@@ -980,6 +989,7 @@ describe("ECSqlStatement", () => {
|
|
|
980
989
|
return r.id;
|
|
981
990
|
});
|
|
982
991
|
// uint64 cannot be bound as string in SQLite. They get converted to reals
|
|
992
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
983
993
|
ecdb.withPreparedStatement("SELECT D,I,L,S FROM Test.Foo WHERE ECInstanceId=?", (stmt) => {
|
|
984
994
|
stmt.bindId(1, id);
|
|
985
995
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
@@ -995,7 +1005,7 @@ describe("ECSqlStatement", () => {
|
|
|
995
1005
|
assert.isNumber(row.l);
|
|
996
1006
|
assert.equal(row.s, largeUnsafeNumberStr);
|
|
997
1007
|
}), 1);
|
|
998
|
-
id = ecdb.
|
|
1008
|
+
id = ecdb.withCachedWriteStatement("INSERT INTO Test.Foo(D,I,L,S,Description) VALUES(?,?,?,?,'bindString, large unsafe number as hexstring')", (stmt) => {
|
|
999
1009
|
stmt.bindString(1, largeUnsafeNumberHexStr);
|
|
1000
1010
|
stmt.bindString(2, largeUnsafeNumberHexStr);
|
|
1001
1011
|
stmt.bindString(3, largeUnsafeNumberHexStr);
|
|
@@ -1004,6 +1014,7 @@ describe("ECSqlStatement", () => {
|
|
|
1004
1014
|
assert.equal(r.status, DbResult.BE_SQLITE_DONE);
|
|
1005
1015
|
return r.id;
|
|
1006
1016
|
});
|
|
1017
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1007
1018
|
ecdb.withPreparedStatement("SELECT CAST(D AS TEXT) d,CAST(I AS TEXT) i,CAST(L AS TEXT) l,S FROM Test.Foo WHERE ECInstanceId=?", (stmt) => {
|
|
1008
1019
|
stmt.bindId(1, id);
|
|
1009
1020
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
@@ -1022,7 +1033,7 @@ describe("ECSqlStatement", () => {
|
|
|
1022
1033
|
const largeNegUnsafeNumber = -123123123123123236;
|
|
1023
1034
|
assert.isFalse(Number.isSafeInteger(largeNegUnsafeNumber));
|
|
1024
1035
|
const largeNegUnsafeNumberStr = "-123123123123123236";
|
|
1025
|
-
id = ecdb.
|
|
1036
|
+
id = ecdb.withCachedWriteStatement("INSERT INTO Test.Foo(D,I,L,S,Description) VALUES(?,?,?,?,'bindInteger, large negative unsafe number as string')", (stmt) => {
|
|
1026
1037
|
stmt.bindInteger(1, largeNegUnsafeNumberStr);
|
|
1027
1038
|
stmt.bindInteger(2, largeNegUnsafeNumberStr);
|
|
1028
1039
|
stmt.bindInteger(3, largeNegUnsafeNumberStr);
|
|
@@ -1031,6 +1042,7 @@ describe("ECSqlStatement", () => {
|
|
|
1031
1042
|
assert.equal(r.status, DbResult.BE_SQLITE_DONE);
|
|
1032
1043
|
return r.id;
|
|
1033
1044
|
});
|
|
1045
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1034
1046
|
ecdb.withPreparedStatement("SELECT CAST(I AS TEXT) i, CAST(L AS TEXT) l,S FROM Test.Foo WHERE ECInstanceId=?", (stmt) => {
|
|
1035
1047
|
stmt.bindId(1, id);
|
|
1036
1048
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
@@ -1044,7 +1056,7 @@ describe("ECSqlStatement", () => {
|
|
|
1044
1056
|
assert.equal(row.l, largeNegUnsafeNumberStr);
|
|
1045
1057
|
assert.equal(row.s, largeNegUnsafeNumberStr);
|
|
1046
1058
|
}), 1);
|
|
1047
|
-
id = ecdb.
|
|
1059
|
+
id = ecdb.withCachedWriteStatement("INSERT INTO Test.Foo(D,I,L,S,Description) VALUES(?,?,?,?,'bindString, large negative unsafe number as string')", (stmt) => {
|
|
1048
1060
|
stmt.bindString(1, largeNegUnsafeNumberStr);
|
|
1049
1061
|
stmt.bindString(2, largeNegUnsafeNumberStr);
|
|
1050
1062
|
stmt.bindString(3, largeNegUnsafeNumberStr);
|
|
@@ -1053,6 +1065,7 @@ describe("ECSqlStatement", () => {
|
|
|
1053
1065
|
assert.equal(r.status, DbResult.BE_SQLITE_DONE);
|
|
1054
1066
|
return r.id;
|
|
1055
1067
|
});
|
|
1068
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1056
1069
|
ecdb.withPreparedStatement("SELECT CAST(I AS TEXT) i, CAST(L AS TEXT) l,S FROM Test.Foo WHERE ECInstanceId=?", (stmt) => {
|
|
1057
1070
|
stmt.bindId(1, id);
|
|
1058
1071
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
@@ -1070,7 +1083,7 @@ describe("ECSqlStatement", () => {
|
|
|
1070
1083
|
assert.isTrue(Number.isSafeInteger(largeSafeNumber));
|
|
1071
1084
|
const largeSafeNumberStr = largeSafeNumber.toString();
|
|
1072
1085
|
const largeSafeNumberHexStr = "0x45fcc5c2c8500";
|
|
1073
|
-
id = ecdb.
|
|
1086
|
+
id = ecdb.withCachedWriteStatement("INSERT INTO Test.Foo(D,I,L,S,Description) VALUES(?,?,?,?,'bindInteger, large safe number')", (stmt) => {
|
|
1074
1087
|
stmt.bindInteger(1, largeSafeNumber);
|
|
1075
1088
|
stmt.bindInteger(2, largeSafeNumber);
|
|
1076
1089
|
stmt.bindInteger(3, largeSafeNumber);
|
|
@@ -1079,6 +1092,7 @@ describe("ECSqlStatement", () => {
|
|
|
1079
1092
|
assert.equal(r.status, DbResult.BE_SQLITE_DONE);
|
|
1080
1093
|
return r.id;
|
|
1081
1094
|
});
|
|
1095
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1082
1096
|
ecdb.withPreparedStatement("SELECT D,I, Str(I) si, HexStr(I) hi, L, Str(L) sl, HexStr(L) hl,S FROM Test.Foo WHERE ECInstanceId=?", (stmt) => {
|
|
1083
1097
|
stmt.bindId(1, id);
|
|
1084
1098
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
@@ -1102,7 +1116,7 @@ describe("ECSqlStatement", () => {
|
|
|
1102
1116
|
// assert.equal(row.hl, largeSafeNumberHexStr);
|
|
1103
1117
|
// assert.equal(row.s, largeSafeNumberStr);
|
|
1104
1118
|
// });
|
|
1105
|
-
id = ecdb.
|
|
1119
|
+
id = ecdb.withCachedWriteStatement("INSERT INTO Test.Foo(D,I,L,S,Description) VALUES(?,?,?,?,'bindInteger, large safe number as string')", (stmt) => {
|
|
1106
1120
|
stmt.bindInteger(1, largeSafeNumberStr);
|
|
1107
1121
|
stmt.bindInteger(2, largeSafeNumberStr);
|
|
1108
1122
|
stmt.bindInteger(3, largeSafeNumberStr);
|
|
@@ -1111,6 +1125,7 @@ describe("ECSqlStatement", () => {
|
|
|
1111
1125
|
assert.equal(r.status, DbResult.BE_SQLITE_DONE);
|
|
1112
1126
|
return r.id;
|
|
1113
1127
|
});
|
|
1128
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1114
1129
|
ecdb.withPreparedStatement("SELECT D,I,L,S FROM Test.Foo WHERE ECInstanceId=?", (stmt) => {
|
|
1115
1130
|
stmt.bindId(1, id);
|
|
1116
1131
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
@@ -1126,7 +1141,7 @@ describe("ECSqlStatement", () => {
|
|
|
1126
1141
|
assert.equal(row.l, largeSafeNumber);
|
|
1127
1142
|
assert.equal(row.s, largeSafeNumberStr);
|
|
1128
1143
|
}), 1);
|
|
1129
|
-
id = ecdb.
|
|
1144
|
+
id = ecdb.withCachedWriteStatement("INSERT INTO Test.Foo(D,I,L,S,Description) VALUES(?,?,?,?,'bindInteger, large safe number as hexstring')", (stmt) => {
|
|
1130
1145
|
stmt.bindInteger(1, largeSafeNumberHexStr);
|
|
1131
1146
|
stmt.bindInteger(2, largeSafeNumberHexStr);
|
|
1132
1147
|
stmt.bindInteger(3, largeSafeNumberHexStr);
|
|
@@ -1135,6 +1150,7 @@ describe("ECSqlStatement", () => {
|
|
|
1135
1150
|
assert.equal(r.status, DbResult.BE_SQLITE_DONE);
|
|
1136
1151
|
return r.id;
|
|
1137
1152
|
});
|
|
1153
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1138
1154
|
ecdb.withPreparedStatement("SELECT D,I,L,S FROM Test.Foo WHERE ECInstanceId=?", (stmt) => {
|
|
1139
1155
|
stmt.bindId(1, id);
|
|
1140
1156
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
@@ -1150,7 +1166,7 @@ describe("ECSqlStatement", () => {
|
|
|
1150
1166
|
assert.equal(row.l, largeSafeNumber);
|
|
1151
1167
|
assert.equal(row.s, largeSafeNumberStr); // even though it was bound as hex str, it gets converted to int64 before persisting
|
|
1152
1168
|
}), 1);
|
|
1153
|
-
id = ecdb.
|
|
1169
|
+
id = ecdb.withCachedWriteStatement("INSERT INTO Test.Foo(D,I,L,S,Description) VALUES(?,?,?,?,'bindString, large safe number as string')", (stmt) => {
|
|
1154
1170
|
stmt.bindString(1, largeSafeNumberStr);
|
|
1155
1171
|
stmt.bindString(2, largeSafeNumberStr);
|
|
1156
1172
|
stmt.bindString(3, largeSafeNumberStr);
|
|
@@ -1159,6 +1175,7 @@ describe("ECSqlStatement", () => {
|
|
|
1159
1175
|
assert.equal(r.status, DbResult.BE_SQLITE_DONE);
|
|
1160
1176
|
return r.id;
|
|
1161
1177
|
});
|
|
1178
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1162
1179
|
ecdb.withPreparedStatement("SELECT D,I,L,S FROM Test.Foo WHERE ECInstanceId=?", (stmt) => {
|
|
1163
1180
|
stmt.bindId(1, id);
|
|
1164
1181
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
@@ -1175,7 +1192,7 @@ describe("ECSqlStatement", () => {
|
|
|
1175
1192
|
assert.equal(row.s, largeSafeNumberStr); // even though it was bound as hex str, it gets converted to int64 before persisting
|
|
1176
1193
|
}), 1);
|
|
1177
1194
|
// SQLite does not parse hex strs bound as strings.
|
|
1178
|
-
id = ecdb.
|
|
1195
|
+
id = ecdb.withCachedWriteStatement("INSERT INTO Test.Foo(D,I,L,S,Description) VALUES(?,?,?,?,'bindString, large safe number as hexstring')", (stmt) => {
|
|
1179
1196
|
stmt.bindString(1, largeSafeNumberHexStr);
|
|
1180
1197
|
stmt.bindString(2, largeSafeNumberHexStr);
|
|
1181
1198
|
stmt.bindString(3, largeSafeNumberHexStr);
|
|
@@ -1184,6 +1201,7 @@ describe("ECSqlStatement", () => {
|
|
|
1184
1201
|
assert.equal(r.status, DbResult.BE_SQLITE_DONE);
|
|
1185
1202
|
return r.id;
|
|
1186
1203
|
});
|
|
1204
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1187
1205
|
ecdb.withPreparedStatement("SELECT CAST(D AS TEXT) d,CAST(I AS TEXT) i,CAST(L AS TEXT) l,S FROM Test.Foo WHERE ECInstanceId=?", (stmt) => {
|
|
1188
1206
|
stmt.bindId(1, id);
|
|
1189
1207
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
@@ -1202,7 +1220,7 @@ describe("ECSqlStatement", () => {
|
|
|
1202
1220
|
const largeNegSafeNumber = -1231231231231232;
|
|
1203
1221
|
assert.isTrue(Number.isSafeInteger(largeNegSafeNumber));
|
|
1204
1222
|
const largeNegSafeNumberStr = largeNegSafeNumber.toString();
|
|
1205
|
-
id = ecdb.
|
|
1223
|
+
id = ecdb.withCachedWriteStatement("INSERT INTO Test.Foo(D,I,L,S,Description) VALUES(?,?,?,?,'bindInteger, large negative safe number')", (stmt) => {
|
|
1206
1224
|
stmt.bindInteger(1, largeNegSafeNumber);
|
|
1207
1225
|
stmt.bindInteger(2, largeNegSafeNumber);
|
|
1208
1226
|
stmt.bindInteger(3, largeNegSafeNumber);
|
|
@@ -1211,6 +1229,7 @@ describe("ECSqlStatement", () => {
|
|
|
1211
1229
|
assert.equal(r.status, DbResult.BE_SQLITE_DONE);
|
|
1212
1230
|
return r.id;
|
|
1213
1231
|
});
|
|
1232
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1214
1233
|
ecdb.withPreparedStatement("SELECT D,I,L,S FROM Test.Foo WHERE ECInstanceId=?", (stmt) => {
|
|
1215
1234
|
stmt.bindId(1, id);
|
|
1216
1235
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
@@ -1226,7 +1245,7 @@ describe("ECSqlStatement", () => {
|
|
|
1226
1245
|
assert.equal(row.l, largeNegSafeNumber);
|
|
1227
1246
|
assert.equal(row.s, largeNegSafeNumberStr);
|
|
1228
1247
|
}), 1);
|
|
1229
|
-
id = ecdb.
|
|
1248
|
+
id = ecdb.withCachedWriteStatement("INSERT INTO Test.Foo(D,I,L,S,Description) VALUES(?,?,?,?,'bindInteger, large negative safe number as string')", (stmt) => {
|
|
1230
1249
|
stmt.bindInteger(1, largeNegSafeNumberStr);
|
|
1231
1250
|
stmt.bindInteger(2, largeNegSafeNumberStr);
|
|
1232
1251
|
stmt.bindInteger(3, largeNegSafeNumberStr);
|
|
@@ -1235,6 +1254,7 @@ describe("ECSqlStatement", () => {
|
|
|
1235
1254
|
assert.equal(r.status, DbResult.BE_SQLITE_DONE);
|
|
1236
1255
|
return r.id;
|
|
1237
1256
|
});
|
|
1257
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1238
1258
|
ecdb.withPreparedStatement("SELECT D,I,L,S FROM Test.Foo WHERE ECInstanceId=?", (stmt) => {
|
|
1239
1259
|
stmt.bindId(1, id);
|
|
1240
1260
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
@@ -1250,7 +1270,7 @@ describe("ECSqlStatement", () => {
|
|
|
1250
1270
|
assert.equal(row.l, largeNegSafeNumber);
|
|
1251
1271
|
assert.equal(row.s, largeNegSafeNumberStr);
|
|
1252
1272
|
});
|
|
1253
|
-
id = ecdb.
|
|
1273
|
+
id = ecdb.withCachedWriteStatement("INSERT INTO Test.Foo(D,I,L,S,Description) VALUES(?,?,?,?,'bindString, large negative safe number as string')", (stmt) => {
|
|
1254
1274
|
stmt.bindString(1, largeNegSafeNumberStr);
|
|
1255
1275
|
stmt.bindString(2, largeNegSafeNumberStr);
|
|
1256
1276
|
stmt.bindString(3, largeNegSafeNumberStr);
|
|
@@ -1259,6 +1279,7 @@ describe("ECSqlStatement", () => {
|
|
|
1259
1279
|
assert.equal(r.status, DbResult.BE_SQLITE_DONE);
|
|
1260
1280
|
return r.id;
|
|
1261
1281
|
});
|
|
1282
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1262
1283
|
ecdb.withPreparedStatement("SELECT D,I,L,S FROM Test.Foo WHERE ECInstanceId=?", (stmt) => {
|
|
1263
1284
|
stmt.bindId(1, id);
|
|
1264
1285
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
@@ -1322,6 +1343,7 @@ describe("ECSqlStatement", () => {
|
|
|
1322
1343
|
const p3dVal = new Point3d(1, 2, 3);
|
|
1323
1344
|
const strVal = "Hello world";
|
|
1324
1345
|
const verify = async (expectedId) => {
|
|
1346
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1325
1347
|
await ecdb.withPreparedStatement("SELECT Bl,Bo,D,Dt,I,P2d,P3d,S,Struct.Bl s_bl,Struct.Bo s_bo,Struct.D s_d,Struct.Dt s_dt,Struct.I s_i,Struct.P2d s_p2d,Struct.P3d s_p3d,Struct.S s_s FROM test.Foo WHERE ECInstanceId=?", async (stmt) => {
|
|
1326
1348
|
stmt.bindId(1, expectedId);
|
|
1327
1349
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
@@ -1381,6 +1403,7 @@ describe("ECSqlStatement", () => {
|
|
|
1381
1403
|
});
|
|
1382
1404
|
};
|
|
1383
1405
|
const ids = new Array();
|
|
1406
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1384
1407
|
ecdb.withPreparedStatement("INSERT INTO test.Foo(Bl,Bo,D,Dt,I,P2d,P3d,S,Struct.Bl,Struct.Bo,Struct.D,Struct.Dt,Struct.I,Struct.P2d,Struct.P3d,Struct.S) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", (stmt) => {
|
|
1385
1408
|
stmt.bindBlob(1, blobVal);
|
|
1386
1409
|
stmt.bindBoolean(2, boolVal);
|
|
@@ -1408,6 +1431,7 @@ describe("ECSqlStatement", () => {
|
|
|
1408
1431
|
assert.equal(res.status, DbResult.BE_SQLITE_DONE);
|
|
1409
1432
|
ids.push(res.id);
|
|
1410
1433
|
});
|
|
1434
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1411
1435
|
ecdb.withPreparedStatement("INSERT INTO test.Foo(Bl,Bo,D,Dt,I,P2d,P3d,S,Struct.Bl,Struct.Bo,Struct.D,Struct.Dt,Struct.I,Struct.P2d,Struct.P3d,Struct.S) VALUES(:bl,:bo,:d,:dt,:i,:p2d,:p3d,:s,:s_bl,:s_bo,:s_d,:s_dt,:s_i,:s_p2d,:s_p3d,:s_s)", (stmt) => {
|
|
1412
1436
|
stmt.bindBlob("bl", blobVal);
|
|
1413
1437
|
stmt.bindBoolean("bo", boolVal);
|
|
@@ -1479,6 +1503,7 @@ describe("ECSqlStatement", () => {
|
|
|
1479
1503
|
i: 3, p2d: new Point2d(1, 2), p3d: new Point3d(1, 2, 3), s: "Hello World",
|
|
1480
1504
|
};
|
|
1481
1505
|
const verify = async (expectedId) => {
|
|
1506
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1482
1507
|
await ecdb.withPreparedStatement("SELECT Struct FROM test.Foo WHERE ECInstanceId=?", async (stmt) => {
|
|
1483
1508
|
stmt.bindId(1, expectedId);
|
|
1484
1509
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
@@ -1509,28 +1534,28 @@ describe("ECSqlStatement", () => {
|
|
|
1509
1534
|
}), 1);
|
|
1510
1535
|
});
|
|
1511
1536
|
};
|
|
1512
|
-
await ecdb.
|
|
1537
|
+
await ecdb.withCachedWriteStatement("INSERT INTO test.Foo(Struct) VALUES(?)", async (stmt) => {
|
|
1513
1538
|
stmt.bindStruct(1, structVal);
|
|
1514
1539
|
const res = stmt.stepForInsert();
|
|
1515
1540
|
assert.equal(res.status, DbResult.BE_SQLITE_DONE);
|
|
1516
1541
|
assert.isDefined(res.id);
|
|
1517
1542
|
await verify(res.id);
|
|
1518
1543
|
});
|
|
1519
|
-
await ecdb.
|
|
1544
|
+
await ecdb.withCachedWriteStatement("INSERT INTO test.Foo(Struct) VALUES(?)", async (stmt) => {
|
|
1520
1545
|
stmt.bindValues([structVal]);
|
|
1521
1546
|
const res = stmt.stepForInsert();
|
|
1522
1547
|
assert.equal(res.status, DbResult.BE_SQLITE_DONE);
|
|
1523
1548
|
assert.isDefined(res.id);
|
|
1524
1549
|
await verify(res.id);
|
|
1525
1550
|
});
|
|
1526
|
-
await ecdb.
|
|
1551
|
+
await ecdb.withCachedWriteStatement("INSERT INTO test.Foo(Struct) VALUES(:str)", async (stmt) => {
|
|
1527
1552
|
stmt.bindStruct("str", structVal);
|
|
1528
1553
|
const res = stmt.stepForInsert();
|
|
1529
1554
|
assert.equal(res.status, DbResult.BE_SQLITE_DONE);
|
|
1530
1555
|
assert.isDefined(res.id);
|
|
1531
1556
|
await verify(res.id);
|
|
1532
1557
|
});
|
|
1533
|
-
await ecdb.
|
|
1558
|
+
await ecdb.withCachedWriteStatement("INSERT INTO test.Foo(Struct) VALUES(:str)", async (stmt) => {
|
|
1534
1559
|
stmt.bindValues({ str: structVal });
|
|
1535
1560
|
const res = stmt.stepForInsert();
|
|
1536
1561
|
assert.equal(res.status, DbResult.BE_SQLITE_DONE);
|
|
@@ -1565,6 +1590,7 @@ describe("ECSqlStatement", () => {
|
|
|
1565
1590
|
const dtArray = ["2018-01-23T00:00:00.000", "2018-01-23T16:39:00.000"];
|
|
1566
1591
|
const addressArray = [{ city: "London", zip: 10000 }, { city: "Manchester", zip: 20000 }, { city: "Edinburgh", zip: 30000 }];
|
|
1567
1592
|
const verify = async (expectedId) => {
|
|
1593
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1568
1594
|
await ecdb.withPreparedStatement("SELECT I_Array, Dt_Array, Addresses FROM test.Foo WHERE ECInstanceId=?", async (stmt) => {
|
|
1569
1595
|
stmt.bindId(1, expectedId);
|
|
1570
1596
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
@@ -1601,7 +1627,7 @@ describe("ECSqlStatement", () => {
|
|
|
1601
1627
|
}
|
|
1602
1628
|
}), 1);
|
|
1603
1629
|
};
|
|
1604
|
-
await ecdb.
|
|
1630
|
+
await ecdb.withCachedWriteStatement("INSERT INTO test.Foo(I_Array,Dt_Array,Addresses) VALUES(?,?,?)", async (stmt) => {
|
|
1605
1631
|
stmt.bindArray(1, intArray);
|
|
1606
1632
|
stmt.bindArray(2, dtArray);
|
|
1607
1633
|
stmt.bindArray(3, addressArray);
|
|
@@ -1610,14 +1636,14 @@ describe("ECSqlStatement", () => {
|
|
|
1610
1636
|
assert.isDefined(res.id);
|
|
1611
1637
|
await verify(res.id);
|
|
1612
1638
|
});
|
|
1613
|
-
await ecdb.
|
|
1639
|
+
await ecdb.withCachedWriteStatement("INSERT INTO test.Foo(I_Array,Dt_Array,Addresses) VALUES(?,?,?)", async (stmt) => {
|
|
1614
1640
|
stmt.bindValues([intArray, dtArray, addressArray]);
|
|
1615
1641
|
const res = stmt.stepForInsert();
|
|
1616
1642
|
assert.equal(res.status, DbResult.BE_SQLITE_DONE);
|
|
1617
1643
|
assert.isDefined(res.id);
|
|
1618
1644
|
await verify(res.id);
|
|
1619
1645
|
});
|
|
1620
|
-
await ecdb.
|
|
1646
|
+
await ecdb.withCachedWriteStatement("INSERT INTO test.Foo(I_Array,Dt_Array,Addresses) VALUES(:iarray,:dtarray,:addresses)", async (stmt) => {
|
|
1621
1647
|
stmt.bindArray("iarray", intArray);
|
|
1622
1648
|
stmt.bindArray("dtarray", dtArray);
|
|
1623
1649
|
stmt.bindArray("addresses", addressArray);
|
|
@@ -1626,7 +1652,7 @@ describe("ECSqlStatement", () => {
|
|
|
1626
1652
|
assert.isDefined(res.id);
|
|
1627
1653
|
await verify(res.id);
|
|
1628
1654
|
});
|
|
1629
|
-
await ecdb.
|
|
1655
|
+
await ecdb.withCachedWriteStatement("INSERT INTO test.Foo(I_Array,Dt_Array,Addresses) VALUES(:iarray,:dtarray,:addresses)", async (stmt) => {
|
|
1630
1656
|
stmt.bindValues({ iarray: intArray, dtarray: dtArray, addresses: addressArray });
|
|
1631
1657
|
const res = stmt.stepForInsert();
|
|
1632
1658
|
assert.equal(res.status, DbResult.BE_SQLITE_DONE);
|
|
@@ -1663,14 +1689,14 @@ describe("ECSqlStatement", () => {
|
|
|
1663
1689
|
</ECRelationshipClass>
|
|
1664
1690
|
</ECSchema>`), false);
|
|
1665
1691
|
assert.isTrue(ecdb.isOpen);
|
|
1666
|
-
const parentId = ecdb.
|
|
1692
|
+
const parentId = ecdb.withCachedWriteStatement("INSERT INTO test.Parent(Code) VALUES('Parent 1')", (stmt) => {
|
|
1667
1693
|
const res = stmt.stepForInsert();
|
|
1668
1694
|
assert.equal(res.status, DbResult.BE_SQLITE_DONE);
|
|
1669
1695
|
assert.isDefined(res.id);
|
|
1670
1696
|
return res.id;
|
|
1671
1697
|
});
|
|
1672
1698
|
const childIds = new Array();
|
|
1673
|
-
ecdb.
|
|
1699
|
+
ecdb.withCachedWriteStatement("INSERT INTO test.Child(Name,Parent) VALUES(?,?)", (stmt) => {
|
|
1674
1700
|
stmt.bindString(1, "Child 1");
|
|
1675
1701
|
stmt.bindNavigation(2, { id: parentId, relClassName: "Test.ParentHasChildren" });
|
|
1676
1702
|
let res = stmt.stepForInsert();
|
|
@@ -1685,7 +1711,7 @@ describe("ECSqlStatement", () => {
|
|
|
1685
1711
|
assert.isDefined(res.id);
|
|
1686
1712
|
childIds.push(res.id);
|
|
1687
1713
|
});
|
|
1688
|
-
ecdb.
|
|
1714
|
+
ecdb.withCachedWriteStatement("INSERT INTO test.Child(Name,Parent) VALUES(:name,:parent)", (stmt) => {
|
|
1689
1715
|
stmt.bindString("name", "Child 3");
|
|
1690
1716
|
stmt.bindNavigation("parent", { id: parentId, relClassName: "Test.ParentHasChildren" });
|
|
1691
1717
|
let res = stmt.stepForInsert();
|
|
@@ -1700,6 +1726,7 @@ describe("ECSqlStatement", () => {
|
|
|
1700
1726
|
assert.isDefined(res.id);
|
|
1701
1727
|
childIds.push(res.id);
|
|
1702
1728
|
});
|
|
1729
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1703
1730
|
ecdb.withPreparedStatement("SELECT Name,Parent FROM test.Child ORDER BY Name", (stmt) => {
|
|
1704
1731
|
let rowCount = 0;
|
|
1705
1732
|
while (stmt.step() === DbResult.BE_SQLITE_ROW) {
|
|
@@ -1732,11 +1759,17 @@ describe("ECSqlStatement", () => {
|
|
|
1732
1759
|
it("should bind Range3d for parameter in spatial sql function", async () => {
|
|
1733
1760
|
const iModel = SnapshotDb.createEmpty(IModelTestUtils.prepareOutputFile("ECSqlStatement", "BindRange3d.bim"), { rootSubject: { name: "BindRange3d" } });
|
|
1734
1761
|
try {
|
|
1735
|
-
|
|
1762
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1763
|
+
iModel.withPreparedStatement("SELECT e.ECInstanceId FROM bis.Element e, bis.SpatialIndex rt WHERE rt.ECInstanceId MATCH DGN_spatial_overlap_aabb(?) AND e.ECInstanceId=rt.ECInstanceId",
|
|
1764
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1765
|
+
(stmt) => {
|
|
1736
1766
|
stmt.bindRange3d(1, new Range3d(0.0, 0.0, 0.0, 1000.0, 1000.0, 1000.0));
|
|
1737
1767
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_DONE);
|
|
1738
1768
|
});
|
|
1739
|
-
|
|
1769
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1770
|
+
iModel.withPreparedStatement("SELECT e.ECInstanceId FROM bis.Element e, bis.SpatialIndex rt WHERE rt.ECInstanceId MATCH DGN_spatial_overlap_aabb(?) AND e.ECInstanceId=rt.ECInstanceId",
|
|
1771
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1772
|
+
(stmt) => {
|
|
1740
1773
|
stmt.bindValues([new Range3d(0.0, 0.0, 0.0, 1000.0, 1000.0, 1000.0)]);
|
|
1741
1774
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_DONE);
|
|
1742
1775
|
});
|
|
@@ -1755,7 +1788,7 @@ describe("ECSqlStatement", () => {
|
|
|
1755
1788
|
</ECEntityClass>
|
|
1756
1789
|
</ECSchema>`), false);
|
|
1757
1790
|
assert.isTrue(ecdb.isOpen);
|
|
1758
|
-
const id = ecdb.
|
|
1791
|
+
const id = ecdb.withCachedWriteStatement("INSERT INTO test.Foo([Range3d]) VALUES(?)", (stmt) => {
|
|
1759
1792
|
stmt.bindRange3d(1, testRange);
|
|
1760
1793
|
const res = stmt.stepForInsert();
|
|
1761
1794
|
assert.equal(res.status, DbResult.BE_SQLITE_DONE);
|
|
@@ -1763,6 +1796,7 @@ describe("ECSqlStatement", () => {
|
|
|
1763
1796
|
return res.id;
|
|
1764
1797
|
});
|
|
1765
1798
|
ecdb.saveChanges();
|
|
1799
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1766
1800
|
ecdb.withPreparedStatement("SELECT [Range3d] FROM test.Foo WHERE ECInstanceId=?", (stmt) => {
|
|
1767
1801
|
stmt.bindId(1, id);
|
|
1768
1802
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
@@ -1787,7 +1821,7 @@ describe("ECSqlStatement", () => {
|
|
|
1787
1821
|
const ecdb = __addDisposableResource(env_19, ECDbTestHelper.createECDb(outDir, "bindids.ecdb"), false);
|
|
1788
1822
|
assert.isTrue(ecdb.isOpen);
|
|
1789
1823
|
const idNumbers = [4444, 4545, 1234, 6758, 1312];
|
|
1790
|
-
ecdb.
|
|
1824
|
+
ecdb.withCachedWriteStatement("INSERT INTO ecdbf.ExternalFileInfo(ECInstanceId,Name) VALUES(?,?)", (stmt) => {
|
|
1791
1825
|
idNumbers.forEach((idNum) => {
|
|
1792
1826
|
const expectedId = Id64.fromLocalAndBriefcaseIds(idNum, 0);
|
|
1793
1827
|
stmt.bindId(1, expectedId);
|
|
@@ -1797,6 +1831,7 @@ describe("ECSqlStatement", () => {
|
|
|
1797
1831
|
assert.isDefined(r.id);
|
|
1798
1832
|
assert.equal(r.id, expectedId);
|
|
1799
1833
|
ecdb.saveChanges();
|
|
1834
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1800
1835
|
ecdb.withStatement(`SELECT ECInstanceId, ECClassId, Name FROM ecdbf.ExternalFileInfo WHERE ECInstanceId=${expectedId}`, (confstmt) => {
|
|
1801
1836
|
assert.equal(confstmt.step(), DbResult.BE_SQLITE_ROW);
|
|
1802
1837
|
const row = confstmt.getRow();
|
|
@@ -1808,6 +1843,7 @@ describe("ECSqlStatement", () => {
|
|
|
1808
1843
|
stmt.clearBindings();
|
|
1809
1844
|
});
|
|
1810
1845
|
});
|
|
1846
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1811
1847
|
ecdb.withPreparedStatement("SELECT ECInstanceId, ECClassId, Name from ecdbf.ExternalFileInfo WHERE InVirtualSet(?, ECInstanceId)", (stmt) => {
|
|
1812
1848
|
let idSet = [];
|
|
1813
1849
|
stmt.bindIdSet(1, idSet);
|
|
@@ -1849,7 +1885,7 @@ describe("ECSqlStatement", () => {
|
|
|
1849
1885
|
const ecdb = __addDisposableResource(env_20, ECDbTestHelper.createECDb(outDir, "bindids.ecdb"), false);
|
|
1850
1886
|
assert.isTrue(ecdb.isOpen);
|
|
1851
1887
|
const idNumbers = [4444, 4545, 1234, 6758, 1312];
|
|
1852
|
-
ecdb.
|
|
1888
|
+
ecdb.withCachedWriteStatement("INSERT INTO ecdbf.ExternalFileInfo(ECInstanceId,Name) VALUES(?,?)", (stmt) => {
|
|
1853
1889
|
idNumbers.forEach((idNum) => {
|
|
1854
1890
|
const expectedId = Id64.fromLocalAndBriefcaseIds(idNum, 0);
|
|
1855
1891
|
stmt.bindId(1, expectedId);
|
|
@@ -1859,6 +1895,7 @@ describe("ECSqlStatement", () => {
|
|
|
1859
1895
|
assert.isDefined(r.id);
|
|
1860
1896
|
assert.equal(r.id, expectedId);
|
|
1861
1897
|
ecdb.saveChanges();
|
|
1898
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1862
1899
|
ecdb.withStatement(`SELECT ECInstanceId, ECClassId, Name FROM ecdbf.ExternalFileInfo WHERE ECInstanceId=${expectedId}`, (confstmt) => {
|
|
1863
1900
|
assert.equal(confstmt.step(), DbResult.BE_SQLITE_ROW);
|
|
1864
1901
|
const row = confstmt.getRow();
|
|
@@ -1870,6 +1907,7 @@ describe("ECSqlStatement", () => {
|
|
|
1870
1907
|
stmt.clearBindings();
|
|
1871
1908
|
});
|
|
1872
1909
|
});
|
|
1910
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1873
1911
|
ecdb.withPreparedStatement("SELECT ECInstanceId, ECClassId, Name from ecdbf.ExternalFileInfo, IdSet(?) WHERE id = ECInstanceId ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES", (stmt) => {
|
|
1874
1912
|
let idSet = [];
|
|
1875
1913
|
stmt.bindIdSet(1, idSet);
|
|
@@ -1911,7 +1949,7 @@ describe("ECSqlStatement", () => {
|
|
|
1911
1949
|
const ecdb = __addDisposableResource(env_21, ECDbTestHelper.createECDb(outDir, "bindids.ecdb"), false);
|
|
1912
1950
|
assert.isTrue(ecdb.isOpen);
|
|
1913
1951
|
const idNumbers = [4444, 4545, 1234, 6758, 1312];
|
|
1914
|
-
ecdb.
|
|
1952
|
+
ecdb.withCachedWriteStatement("INSERT INTO ecdbf.ExternalFileInfo(ECInstanceId,Name) VALUES(?,?)", (stmt) => {
|
|
1915
1953
|
idNumbers.forEach((idNum) => {
|
|
1916
1954
|
const expectedId = Id64.fromLocalAndBriefcaseIds(idNum, 0);
|
|
1917
1955
|
stmt.bindId(1, expectedId);
|
|
@@ -1921,6 +1959,7 @@ describe("ECSqlStatement", () => {
|
|
|
1921
1959
|
assert.isDefined(r.id);
|
|
1922
1960
|
assert.equal(r.id, expectedId);
|
|
1923
1961
|
ecdb.saveChanges();
|
|
1962
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1924
1963
|
ecdb.withStatement(`SELECT ECInstanceId, ECClassId, Name FROM ecdbf.ExternalFileInfo WHERE ECInstanceId=${expectedId}`, (confstmt) => {
|
|
1925
1964
|
assert.equal(confstmt.step(), DbResult.BE_SQLITE_ROW);
|
|
1926
1965
|
const row = confstmt.getRow();
|
|
@@ -1932,7 +1971,8 @@ describe("ECSqlStatement", () => {
|
|
|
1932
1971
|
stmt.clearBindings();
|
|
1933
1972
|
});
|
|
1934
1973
|
});
|
|
1935
|
-
|
|
1974
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1975
|
+
ecdb.withPreparedStatement("SELECT ECInstanceId, ECClassId, Name from ecdbf.ExternalFileInfo, ECVLib.IdSet(?) WHERE id = ECInstanceId ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES", (stmt) => {
|
|
1936
1976
|
let idSet = [];
|
|
1937
1977
|
stmt.bindIdSet(1, idSet);
|
|
1938
1978
|
let result = stmt.step();
|
|
@@ -1986,31 +2026,20 @@ describe("ECSqlStatement", () => {
|
|
|
1986
2026
|
</ECEntityClass>
|
|
1987
2027
|
</ECSchema>`), false);
|
|
1988
2028
|
assert.isTrue(ecdb.isOpen);
|
|
1989
|
-
let id1, id2;
|
|
2029
|
+
let id1 = "", id2 = "";
|
|
1990
2030
|
// *** test without statement cache
|
|
1991
|
-
{
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
id1 = res.id;
|
|
2002
|
-
assert.isTrue(Id64.isValidId64(id1));
|
|
2003
|
-
}
|
|
2004
|
-
catch (e_22) {
|
|
2005
|
-
env_23.error = e_22;
|
|
2006
|
-
env_23.hasError = true;
|
|
2007
|
-
}
|
|
2008
|
-
finally {
|
|
2009
|
-
__disposeResources(env_23);
|
|
2010
|
-
}
|
|
2011
|
-
}
|
|
2031
|
+
ecdb.withCachedWriteStatement("INSERT INTO test.Person(Name,Age,Location) VALUES(?,?,?)", (stmt) => {
|
|
2032
|
+
stmt.bindString(1, "Mary Miller");
|
|
2033
|
+
stmt.bindInteger(2, 30);
|
|
2034
|
+
stmt.bindStruct(3, { Street: "2000 Main Street", City: "New York", Zip: 12311 });
|
|
2035
|
+
const res = stmt.stepForInsert();
|
|
2036
|
+
assert.equal(res.status, DbResult.BE_SQLITE_DONE);
|
|
2037
|
+
assert.isDefined(res.id);
|
|
2038
|
+
id1 = res.id;
|
|
2039
|
+
assert.isTrue(Id64.isValidId64(id1));
|
|
2040
|
+
});
|
|
2012
2041
|
// *** test withstatement cache
|
|
2013
|
-
ecdb.
|
|
2042
|
+
ecdb.withCachedWriteStatement("INSERT INTO test.Person(Name,Age,Location) VALUES(?,?,?)", (stmt) => {
|
|
2014
2043
|
stmt.bindString(1, "Mary Miller");
|
|
2015
2044
|
stmt.bindInteger(2, 30);
|
|
2016
2045
|
stmt.bindStruct(3, { Street: "2000 Main Street", City: "New York", Zip: 12311 });
|
|
@@ -2021,9 +2050,10 @@ describe("ECSqlStatement", () => {
|
|
|
2021
2050
|
assert.isTrue(Id64.isValidId64(id2));
|
|
2022
2051
|
});
|
|
2023
2052
|
{
|
|
2024
|
-
const
|
|
2053
|
+
const env_23 = { stack: [], error: void 0, hasError: false };
|
|
2025
2054
|
try {
|
|
2026
|
-
|
|
2055
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2056
|
+
const stmt = __addDisposableResource(env_23, ecdb.prepareStatement("SELECT ECInstanceId,ECClassId,Name,Age,Location FROM test.Person ORDER BY ECInstanceId"), false);
|
|
2027
2057
|
let rowCount = 0;
|
|
2028
2058
|
while (stmt.step() === DbResult.BE_SQLITE_ROW) {
|
|
2029
2059
|
rowCount++;
|
|
@@ -2041,12 +2071,12 @@ describe("ECSqlStatement", () => {
|
|
|
2041
2071
|
}
|
|
2042
2072
|
assert.equal(rowCount, 2);
|
|
2043
2073
|
}
|
|
2044
|
-
catch (
|
|
2045
|
-
|
|
2046
|
-
|
|
2074
|
+
catch (e_22) {
|
|
2075
|
+
env_23.error = e_22;
|
|
2076
|
+
env_23.hasError = true;
|
|
2047
2077
|
}
|
|
2048
2078
|
finally {
|
|
2049
|
-
__disposeResources(
|
|
2079
|
+
__disposeResources(env_23);
|
|
2050
2080
|
}
|
|
2051
2081
|
}
|
|
2052
2082
|
let rowCount2 = 0;
|
|
@@ -2064,8 +2094,8 @@ describe("ECSqlStatement", () => {
|
|
|
2064
2094
|
assert.equal(row.location.zip, 12311);
|
|
2065
2095
|
}), 2);
|
|
2066
2096
|
}
|
|
2067
|
-
catch (
|
|
2068
|
-
env_22.error =
|
|
2097
|
+
catch (e_23) {
|
|
2098
|
+
env_22.error = e_23;
|
|
2069
2099
|
env_22.hasError = true;
|
|
2070
2100
|
}
|
|
2071
2101
|
finally {
|
|
@@ -2073,9 +2103,9 @@ describe("ECSqlStatement", () => {
|
|
|
2073
2103
|
}
|
|
2074
2104
|
});
|
|
2075
2105
|
it("getRow() with primitives values", async () => {
|
|
2076
|
-
const
|
|
2106
|
+
const env_24 = { stack: [], error: void 0, hasError: false };
|
|
2077
2107
|
try {
|
|
2078
|
-
const ecdb = __addDisposableResource(
|
|
2108
|
+
const ecdb = __addDisposableResource(env_24, ECDbTestHelper.createECDb(outDir, "getprimitives.ecdb", `<ECSchema schemaName="Test" alias="test" version="01.00.00" xmlns="http://www.bentley.com/schemas/Bentley.ECXML.3.1">
|
|
2079
2109
|
<ECEntityClass typeName="Foo" modifier="Sealed">
|
|
2080
2110
|
<ECProperty propertyName="Bl" typeName="binary"/>
|
|
2081
2111
|
<ECProperty propertyName="Bo" typeName="boolean"/>
|
|
@@ -2097,7 +2127,7 @@ describe("ECSqlStatement", () => {
|
|
|
2097
2127
|
const p2dVal = new Point2d(1, 2);
|
|
2098
2128
|
const p3dVal = new Point3d(1, 2, 3);
|
|
2099
2129
|
const strVal = "Hello world";
|
|
2100
|
-
const id = ecdb.
|
|
2130
|
+
const id = ecdb.withCachedWriteStatement("INSERT INTO test.Foo(Bl,Bo,D,Dt,I,P2d,P3d,S) VALUES(?,?,?,?,?,?,?,?)", (stmt) => {
|
|
2101
2131
|
stmt.bindBlob(1, blobVal);
|
|
2102
2132
|
stmt.bindBoolean(2, boolVal);
|
|
2103
2133
|
stmt.bindDouble(3, doubleVal);
|
|
@@ -2110,6 +2140,7 @@ describe("ECSqlStatement", () => {
|
|
|
2110
2140
|
assert.equal(res.status, DbResult.BE_SQLITE_DONE);
|
|
2111
2141
|
return res.id;
|
|
2112
2142
|
});
|
|
2143
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2113
2144
|
ecdb.withPreparedStatement("SELECT ECInstanceId, ECClassId, Bl,Bo,D,Dt,I,P2d,P3d,S FROM test.Foo WHERE ECInstanceId=?", (stmt) => {
|
|
2114
2145
|
stmt.bindId(1, id);
|
|
2115
2146
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
@@ -2153,6 +2184,7 @@ describe("ECSqlStatement", () => {
|
|
|
2153
2184
|
// assert.equal(row.p3d.z, p3dVal.z);
|
|
2154
2185
|
// assert.equal(row.s, strVal);
|
|
2155
2186
|
// }), 1);
|
|
2187
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2156
2188
|
ecdb.withPreparedStatement("SELECT Bl AS Blobby, I+10, Lower(S), Upper(S) CapitalS FROM test.Foo WHERE ECInstanceId=?", (stmt) => {
|
|
2157
2189
|
stmt.bindId(1, id);
|
|
2158
2190
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
@@ -2168,18 +2200,21 @@ describe("ECSqlStatement", () => {
|
|
|
2168
2200
|
// assert.equal(row["lower([S])"], strVal.toLowerCase());
|
|
2169
2201
|
// assert.equal(row.capitalS, strVal.toUpperCase());
|
|
2170
2202
|
// }), 1);
|
|
2203
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2171
2204
|
const testSchemaId = ecdb.withPreparedStatement("SELECT ECInstanceId FROM meta.ECSchemaDef WHERE Name='Test'", (stmt) => {
|
|
2172
2205
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
2173
2206
|
const row = stmt.getRow();
|
|
2174
2207
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_DONE);
|
|
2175
2208
|
return Id64.fromJSON(row.id);
|
|
2176
2209
|
});
|
|
2210
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2177
2211
|
const fooClassId = ecdb.withPreparedStatement("SELECT ECInstanceId FROM meta.ECClassDef WHERE Name='Foo'", (stmt) => {
|
|
2178
2212
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
2179
2213
|
const row = stmt.getRow();
|
|
2180
2214
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_DONE);
|
|
2181
2215
|
return Id64.fromJSON(row.id);
|
|
2182
2216
|
});
|
|
2217
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2183
2218
|
ecdb.withPreparedStatement("SELECT s.ECInstanceId, c.ECInstanceId, c.Name, s.Name FROM meta.ECClassDef c JOIN meta.ECSchemaDef s ON c.Schema.Id=s.ECInstanceId WHERE s.Name='Test' AND c.Name='Foo'", (stmt) => {
|
|
2184
2219
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
2185
2220
|
const row = stmt.getRow();
|
|
@@ -2190,6 +2225,7 @@ describe("ECSqlStatement", () => {
|
|
|
2190
2225
|
assert.equal(row.id, testSchemaId);
|
|
2191
2226
|
assert.equal(row.id_1, fooClassId);
|
|
2192
2227
|
}), 1);
|
|
2228
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2193
2229
|
ecdb.withPreparedStatement("SELECT count(*) cnt FROM meta.ECSchemaDef", (stmt) => {
|
|
2194
2230
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
2195
2231
|
const row = stmt.getRow();
|
|
@@ -2202,6 +2238,7 @@ describe("ECSqlStatement", () => {
|
|
|
2202
2238
|
assert.equal(typeof (row.cnt), "number");
|
|
2203
2239
|
assert.equal(row.cnt, 6);
|
|
2204
2240
|
}), 1);
|
|
2241
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2205
2242
|
ecdb.withPreparedStatement("SELECT 1 FROM meta.ECSchemaDef LIMIT 1", (stmt) => {
|
|
2206
2243
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
2207
2244
|
const row = stmt.getRow();
|
|
@@ -2212,6 +2249,7 @@ describe("ECSqlStatement", () => {
|
|
|
2212
2249
|
assert.equal(typeof (row["1"]), "number");
|
|
2213
2250
|
assert.equal(row["1"], 1);
|
|
2214
2251
|
}), 1);
|
|
2252
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2215
2253
|
ecdb.withPreparedStatement("SELECT NULL FROM meta.ECSchemaDef LIMIT 1", (stmt) => {
|
|
2216
2254
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
2217
2255
|
const row = stmt.getRow();
|
|
@@ -2221,18 +2259,18 @@ describe("ECSqlStatement", () => {
|
|
|
2221
2259
|
assert.equal(Object.entries(row).length, 0);
|
|
2222
2260
|
}), 1);
|
|
2223
2261
|
}
|
|
2224
|
-
catch (
|
|
2225
|
-
|
|
2226
|
-
|
|
2262
|
+
catch (e_24) {
|
|
2263
|
+
env_24.error = e_24;
|
|
2264
|
+
env_24.hasError = true;
|
|
2227
2265
|
}
|
|
2228
2266
|
finally {
|
|
2229
|
-
__disposeResources(
|
|
2267
|
+
__disposeResources(env_24);
|
|
2230
2268
|
}
|
|
2231
2269
|
});
|
|
2232
2270
|
it("getRow() with abbreviated blobs", async () => {
|
|
2233
|
-
const
|
|
2271
|
+
const env_25 = { stack: [], error: void 0, hasError: false };
|
|
2234
2272
|
try {
|
|
2235
|
-
const ecdb = __addDisposableResource(
|
|
2273
|
+
const ecdb = __addDisposableResource(env_25, ECDbTestHelper.createECDb(outDir, "getblobs.ecdb", `<ECSchema schemaName="Test" alias="test" version="01.00.00" xmlns="http://www.bentley.com/schemas/Bentley.ECXML.3.1">
|
|
2236
2274
|
<ECEntityClass typeName="Foo" modifier="Sealed">
|
|
2237
2275
|
<ECProperty propertyName="Bl" typeName="binary"/>
|
|
2238
2276
|
</ECEntityClass>
|
|
@@ -2241,25 +2279,25 @@ describe("ECSqlStatement", () => {
|
|
|
2241
2279
|
const singleBlobVal = blobVal.slice(0, 1);
|
|
2242
2280
|
const abbreviatedSingleBlobVal = `{"bytes":${singleBlobVal.byteLength}}`;
|
|
2243
2281
|
const emptyBlobVal = new Uint8Array();
|
|
2244
|
-
const fullId = ecdb.
|
|
2282
|
+
const fullId = ecdb.withCachedWriteStatement("INSERT INTO test.Foo(Bl) VALUES(?)", (stmt) => {
|
|
2245
2283
|
stmt.bindBlob(1, blobVal);
|
|
2246
2284
|
const res = stmt.stepForInsert();
|
|
2247
2285
|
assert.equal(res.status, DbResult.BE_SQLITE_DONE);
|
|
2248
2286
|
return res.id;
|
|
2249
2287
|
});
|
|
2250
|
-
const singleId = ecdb.
|
|
2288
|
+
const singleId = ecdb.withCachedWriteStatement("INSERT INTO test.Foo(Bl) VALUES(?)", (stmt) => {
|
|
2251
2289
|
stmt.bindBlob(1, singleBlobVal);
|
|
2252
2290
|
const res = stmt.stepForInsert();
|
|
2253
2291
|
assert.equal(res.status, DbResult.BE_SQLITE_DONE);
|
|
2254
2292
|
return res.id;
|
|
2255
2293
|
});
|
|
2256
|
-
const emptyId = ecdb.
|
|
2294
|
+
const emptyId = ecdb.withCachedWriteStatement("INSERT INTO test.Foo(Bl) VALUES(?)", (stmt) => {
|
|
2257
2295
|
stmt.bindBlob(1, emptyBlobVal);
|
|
2258
2296
|
const res = stmt.stepForInsert();
|
|
2259
2297
|
assert.equal(res.status, DbResult.BE_SQLITE_DONE);
|
|
2260
2298
|
return res.id;
|
|
2261
2299
|
});
|
|
2262
|
-
const nullId = ecdb.
|
|
2300
|
+
const nullId = ecdb.withCachedWriteStatement("INSERT INTO test.Foo(Bl) VALUES(?)", (stmt) => {
|
|
2263
2301
|
stmt.bindNull(1);
|
|
2264
2302
|
const res = stmt.stepForInsert();
|
|
2265
2303
|
assert.equal(res.status, DbResult.BE_SQLITE_DONE);
|
|
@@ -2326,18 +2364,18 @@ describe("ECSqlStatement", () => {
|
|
|
2326
2364
|
assert.deepEqual(row.bl, undefined);
|
|
2327
2365
|
}), 1);
|
|
2328
2366
|
}
|
|
2329
|
-
catch (
|
|
2330
|
-
|
|
2331
|
-
|
|
2367
|
+
catch (e_25) {
|
|
2368
|
+
env_25.error = e_25;
|
|
2369
|
+
env_25.hasError = true;
|
|
2332
2370
|
}
|
|
2333
2371
|
finally {
|
|
2334
|
-
__disposeResources(
|
|
2372
|
+
__disposeResources(env_25);
|
|
2335
2373
|
}
|
|
2336
2374
|
});
|
|
2337
2375
|
it("getRow() with navigation properties and relationships", async () => {
|
|
2338
|
-
const
|
|
2376
|
+
const env_26 = { stack: [], error: void 0, hasError: false };
|
|
2339
2377
|
try {
|
|
2340
|
-
const ecdb = __addDisposableResource(
|
|
2378
|
+
const ecdb = __addDisposableResource(env_26, ECDbTestHelper.createECDb(outDir, "getnavandrels.ecdb", `<ECSchema schemaName="Test" alias="test" version="01.00.00" xmlns="http://www.bentley.com/schemas/Bentley.ECXML.3.1">
|
|
2341
2379
|
<ECEntityClass typeName="Parent" modifier="Sealed">
|
|
2342
2380
|
<ECProperty propertyName="Code" typeName="string"/>
|
|
2343
2381
|
</ECEntityClass>
|
|
@@ -2356,14 +2394,14 @@ describe("ECSqlStatement", () => {
|
|
|
2356
2394
|
</ECSchema>`), false);
|
|
2357
2395
|
assert.isTrue(ecdb.isOpen);
|
|
2358
2396
|
let rowCount;
|
|
2359
|
-
const parentId = ecdb.
|
|
2397
|
+
const parentId = ecdb.withCachedWriteStatement("INSERT INTO test.Parent(Code) VALUES('Parent 1')", (stmt) => {
|
|
2360
2398
|
const res = stmt.stepForInsert();
|
|
2361
2399
|
assert.equal(res.status, DbResult.BE_SQLITE_DONE);
|
|
2362
2400
|
assert.isDefined(res.id);
|
|
2363
2401
|
return res.id;
|
|
2364
2402
|
});
|
|
2365
2403
|
const childIds = new Array();
|
|
2366
|
-
ecdb.
|
|
2404
|
+
ecdb.withCachedWriteStatement("INSERT INTO test.Child(Name,Parent) VALUES(?,?)", (stmt) => {
|
|
2367
2405
|
stmt.bindString(1, "Child 1");
|
|
2368
2406
|
stmt.bindNavigation(2, { id: parentId, relClassName: "Test.ParentHasChildren" });
|
|
2369
2407
|
let res = stmt.stepForInsert();
|
|
@@ -2378,6 +2416,7 @@ describe("ECSqlStatement", () => {
|
|
|
2378
2416
|
assert.isDefined(res.id);
|
|
2379
2417
|
childIds.push(res.id);
|
|
2380
2418
|
});
|
|
2419
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2381
2420
|
ecdb.withPreparedStatement("SELECT Name,Parent FROM test.Child ORDER BY Name", (stmt) => {
|
|
2382
2421
|
rowCount = 0;
|
|
2383
2422
|
while (stmt.step() === DbResult.BE_SQLITE_ROW) {
|
|
@@ -2396,6 +2435,7 @@ describe("ECSqlStatement", () => {
|
|
|
2396
2435
|
assert.equal(row.parent.id, parentId);
|
|
2397
2436
|
assert.equal(row.parent.relClassName, "Test.ParentHasChildren");
|
|
2398
2437
|
}), 2);
|
|
2438
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2399
2439
|
ecdb.withPreparedStatement("SELECT Name,Parent.Id,Parent.RelECClassId, Parent.Id myParentId, Parent.RelECClassId myParentRelClassId FROM test.Child ORDER BY Name", (stmt) => {
|
|
2400
2440
|
rowCount = 0;
|
|
2401
2441
|
while (stmt.step() === DbResult.BE_SQLITE_ROW) {
|
|
@@ -2419,6 +2459,7 @@ describe("ECSqlStatement", () => {
|
|
|
2419
2459
|
assert.isTrue(Id64.isValidId64(row.myParentRelClassId));
|
|
2420
2460
|
}), 2);
|
|
2421
2461
|
const childId = childIds[0];
|
|
2462
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2422
2463
|
ecdb.withPreparedStatement("SELECT ECInstanceId,ECClassId,SourceECInstanceId,SourceECClassId,TargetECInstanceId,TargetECClassId FROM test.ParentHasChildren WHERE TargetECInstanceId=?", (stmt) => {
|
|
2423
2464
|
stmt.bindId(1, childId);
|
|
2424
2465
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
@@ -2438,6 +2479,7 @@ describe("ECSqlStatement", () => {
|
|
|
2438
2479
|
assert.equal(row.targetId, childId);
|
|
2439
2480
|
assert.equal(row.targetClassName, "Test.Child");
|
|
2440
2481
|
}), 1);
|
|
2482
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2441
2483
|
ecdb.withPreparedStatement("SELECT ECInstanceId as MyId,ECClassId as MyClassId,SourceECInstanceId As MySourceId,SourceECClassId As MySourceClassId,TargetECInstanceId As MyTargetId,TargetECClassId As MyTargetClassId FROM test.ParentHasChildren WHERE TargetECInstanceId=?", (stmt) => {
|
|
2442
2484
|
stmt.bindId(1, childId);
|
|
2443
2485
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
@@ -2459,18 +2501,18 @@ describe("ECSqlStatement", () => {
|
|
|
2459
2501
|
assert.isTrue(Id64.isValidId64(row.myTargetClassId));
|
|
2460
2502
|
}), 1);
|
|
2461
2503
|
}
|
|
2462
|
-
catch (
|
|
2463
|
-
|
|
2464
|
-
|
|
2504
|
+
catch (e_26) {
|
|
2505
|
+
env_26.error = e_26;
|
|
2506
|
+
env_26.hasError = true;
|
|
2465
2507
|
}
|
|
2466
2508
|
finally {
|
|
2467
|
-
__disposeResources(
|
|
2509
|
+
__disposeResources(env_26);
|
|
2468
2510
|
}
|
|
2469
2511
|
});
|
|
2470
2512
|
it("getRow() with structs", async () => {
|
|
2471
|
-
const
|
|
2513
|
+
const env_27 = { stack: [], error: void 0, hasError: false };
|
|
2472
2514
|
try {
|
|
2473
|
-
const ecdb = __addDisposableResource(
|
|
2515
|
+
const ecdb = __addDisposableResource(env_27, ECDbTestHelper.createECDb(outDir, "getstructs.ecdb", `<ECSchema schemaName="Test" alias="test" version="01.00.00" xmlns="http://www.bentley.com/schemas/Bentley.ECXML.3.1">
|
|
2474
2516
|
<ECStructClass typeName="MyStruct" modifier="Sealed">
|
|
2475
2517
|
<ECProperty propertyName="Bl" typeName="binary"/>
|
|
2476
2518
|
<ECProperty propertyName="Bo" typeName="boolean"/>
|
|
@@ -2495,7 +2537,7 @@ describe("ECSqlStatement", () => {
|
|
|
2495
2537
|
const p2dVal = { x: 1, y: 2 };
|
|
2496
2538
|
const p3dVal = { x: 1, y: 2, z: 3 };
|
|
2497
2539
|
const stringVal = "Hello World";
|
|
2498
|
-
const id = ecdb.
|
|
2540
|
+
const id = ecdb.withCachedWriteStatement("INSERT INTO test.Foo(Struct) VALUES(?)", (stmt) => {
|
|
2499
2541
|
stmt.bindStruct(1, { bl: blobVal, bo: boolVal, d: doubleVal, dt: dtVal, i: intVal, p2d: p2dVal, p3d: p3dVal, s: stringVal });
|
|
2500
2542
|
const res = stmt.stepForInsert();
|
|
2501
2543
|
assert.equal(res.status, DbResult.BE_SQLITE_DONE);
|
|
@@ -2503,6 +2545,7 @@ describe("ECSqlStatement", () => {
|
|
|
2503
2545
|
return res.id;
|
|
2504
2546
|
});
|
|
2505
2547
|
const expectedStruct = { bl: blobVal, bo: boolVal, d: doubleVal, dt: dtVal, i: intVal, p2d: p2dVal, p3d: p3dVal, s: stringVal };
|
|
2548
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2506
2549
|
ecdb.withPreparedStatement("SELECT Struct FROM test.Foo WHERE ECInstanceId=?", (stmt) => {
|
|
2507
2550
|
stmt.bindId(1, id);
|
|
2508
2551
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
@@ -2532,6 +2575,7 @@ describe("ECSqlStatement", () => {
|
|
|
2532
2575
|
assert.equal(row.struct.p3d.z, expectedStruct.p3d.z);
|
|
2533
2576
|
assert.equal(row.struct.s, expectedStruct.s);
|
|
2534
2577
|
}), 1);
|
|
2578
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2535
2579
|
ecdb.withPreparedStatement("SELECT Struct FROM test.Foo WHERE ECInstanceId=?", (stmt) => {
|
|
2536
2580
|
stmt.bindId(1, id);
|
|
2537
2581
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
@@ -2548,6 +2592,7 @@ describe("ECSqlStatement", () => {
|
|
|
2548
2592
|
assert.equal(actualStruct.p3d.z, expectedStruct.p3d.z);
|
|
2549
2593
|
assert.equal(actualStruct.s, expectedStruct.s);
|
|
2550
2594
|
});
|
|
2595
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2551
2596
|
ecdb.withPreparedStatement("SELECT Struct.Bl, Struct.Bo, Struct.D, Struct.Dt, Struct.I, Struct.P2d, Struct.P3d, Struct.S FROM test.Foo WHERE ECInstanceId=?", (stmt) => {
|
|
2552
2597
|
stmt.bindId(1, id);
|
|
2553
2598
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
@@ -2578,16 +2623,16 @@ describe("ECSqlStatement", () => {
|
|
|
2578
2623
|
assert.equal(row["struct.S"], expectedStruct.s);
|
|
2579
2624
|
}), 1);
|
|
2580
2625
|
}
|
|
2581
|
-
catch (
|
|
2582
|
-
|
|
2583
|
-
|
|
2626
|
+
catch (e_27) {
|
|
2627
|
+
env_27.error = e_27;
|
|
2628
|
+
env_27.hasError = true;
|
|
2584
2629
|
}
|
|
2585
2630
|
finally {
|
|
2586
|
-
__disposeResources(
|
|
2631
|
+
__disposeResources(env_27);
|
|
2587
2632
|
}
|
|
2588
2633
|
});
|
|
2589
2634
|
it("check HexStr() sql function", async () => {
|
|
2590
|
-
const
|
|
2635
|
+
const env_28 = { stack: [], error: void 0, hasError: false };
|
|
2591
2636
|
try {
|
|
2592
2637
|
const slm = new SequentialLogMatcher();
|
|
2593
2638
|
slm.append().error().category("ECDb").message(/Step failed for ECSQL/gm);
|
|
@@ -2596,7 +2641,7 @@ describe("ECSqlStatement", () => {
|
|
|
2596
2641
|
slm.append().error().category("ECDb").message(/Failed to prepare function expression/gm);
|
|
2597
2642
|
slm.append().error().category("ECDb").message(/Failed to prepare function expression/gm);
|
|
2598
2643
|
slm.append().error().category("ECDb").message(/Step failed for ECSQL/gm);
|
|
2599
|
-
const ecdb = __addDisposableResource(
|
|
2644
|
+
const ecdb = __addDisposableResource(env_28, ECDbTestHelper.createECDb(outDir, "hexstrfunction.ecdb", `<ECSchema schemaName="Test" alias="test" version="01.00.00" xmlns="http://www.bentley.com/schemas/Bentley.ECXML.3.1">
|
|
2600
2645
|
<ECEntityClass typeName="Foo" modifier="Sealed">
|
|
2601
2646
|
<ECProperty propertyName="Bl" typeName="binary"/>
|
|
2602
2647
|
<ECProperty propertyName="Bo" typeName="boolean"/>
|
|
@@ -2615,7 +2660,7 @@ describe("ECSqlStatement", () => {
|
|
|
2615
2660
|
bl: blobVal, bo: true, d: 3.5, dt: "2018-01-23T12:24:00.000",
|
|
2616
2661
|
i: 3, l: 12312312312312, p2d: { x: 1, y: 2 }, p3d: { x: 1, y: 2, z: 3 }, s: "Hello World",
|
|
2617
2662
|
};
|
|
2618
|
-
const id = ecdb.
|
|
2663
|
+
const id = ecdb.withCachedWriteStatement("INSERT INTO test.Foo(Bl,Bo,D,Dt,I,L,P2d,P3d,S) VALUES(:bl,:bo,:d,:dt,:i,:l,:p2d,:p3d,:s)", (stmt) => {
|
|
2619
2664
|
stmt.bindValues({
|
|
2620
2665
|
bl: blobVal, bo: expectedRow.bo, d: expectedRow.d,
|
|
2621
2666
|
dt: expectedRow.dt, i: expectedRow.i, l: expectedRow.l, p2d: expectedRow.p2d, p3d: expectedRow.p3d, s: expectedRow.s,
|
|
@@ -2626,6 +2671,7 @@ describe("ECSqlStatement", () => {
|
|
|
2626
2671
|
return res.id;
|
|
2627
2672
|
});
|
|
2628
2673
|
ecdb.saveChanges();
|
|
2674
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2629
2675
|
ecdb.withPreparedStatement("SELECT I, HexStr(I) hex FROM test.Foo WHERE ECInstanceId=?", (stmt) => {
|
|
2630
2676
|
stmt.bindId(1, id);
|
|
2631
2677
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
@@ -2633,6 +2679,7 @@ describe("ECSqlStatement", () => {
|
|
|
2633
2679
|
assert.equal(row.i, expectedRow.i);
|
|
2634
2680
|
assert.equal(row.hex, "0x3");
|
|
2635
2681
|
});
|
|
2682
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2636
2683
|
ecdb.withPreparedStatement("SELECT L, HexStr(L) hex FROM test.Foo WHERE ECInstanceId=?", (stmt) => {
|
|
2637
2684
|
stmt.bindId(1, id);
|
|
2638
2685
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
@@ -2640,10 +2687,12 @@ describe("ECSqlStatement", () => {
|
|
|
2640
2687
|
assert.equal(row.l, expectedRow.l);
|
|
2641
2688
|
assert.equal(row.hex, "0xb32af0071f8");
|
|
2642
2689
|
});
|
|
2690
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2643
2691
|
ecdb.withPreparedStatement("SELECT Bl, HexStr(Bl) hex FROM test.Foo WHERE ECInstanceId=?", (stmt) => {
|
|
2644
2692
|
stmt.bindId(1, id);
|
|
2645
2693
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ERROR);
|
|
2646
2694
|
});
|
|
2695
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2647
2696
|
ecdb.withPreparedStatement("SELECT Bo, HexStr(Bo) hex FROM test.Foo WHERE ECInstanceId=?", (stmt) => {
|
|
2648
2697
|
stmt.bindId(1, id);
|
|
2649
2698
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
@@ -2651,40 +2700,45 @@ describe("ECSqlStatement", () => {
|
|
|
2651
2700
|
assert.equal(row.bo, expectedRow.bo);
|
|
2652
2701
|
assert.equal(row.hex, "0x1");
|
|
2653
2702
|
});
|
|
2703
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2654
2704
|
ecdb.withPreparedStatement("SELECT D, HexStr(D) hex FROM test.Foo WHERE ECInstanceId=?", (stmt) => {
|
|
2655
2705
|
stmt.bindId(1, id);
|
|
2656
2706
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ERROR);
|
|
2657
2707
|
});
|
|
2708
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2658
2709
|
ecdb.withPreparedStatement("SELECT Dt, HexStr(Dt) hex FROM test.Foo WHERE ECInstanceId=?", (stmt) => {
|
|
2659
2710
|
stmt.bindId(1, id);
|
|
2660
2711
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ERROR);
|
|
2661
2712
|
});
|
|
2662
2713
|
// SQL functions cannot take points. So here preparation already fails
|
|
2714
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2663
2715
|
assert.throw(() => ecdb.withPreparedStatement("SELECT P2d, HexStr(P2d) hex FROM test.Foo WHERE ECInstanceId=?", () => {
|
|
2664
2716
|
assert.fail();
|
|
2665
2717
|
}));
|
|
2666
2718
|
// SQL functions cannot take points. So here preparation already fails
|
|
2719
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2667
2720
|
assert.throw(() => ecdb.withPreparedStatement("SELECT P3d, HexStr(P3d) hex FROM test.Foo WHERE ECInstanceId=?", () => {
|
|
2668
2721
|
assert.fail();
|
|
2669
2722
|
}));
|
|
2723
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2670
2724
|
ecdb.withPreparedStatement("SELECT S, HexStr(S) hex FROM test.Foo WHERE ECInstanceId=?", (stmt) => {
|
|
2671
2725
|
stmt.bindId(1, id);
|
|
2672
2726
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ERROR);
|
|
2673
2727
|
});
|
|
2674
2728
|
assert.isTrue(slm.finishAndDispose());
|
|
2675
2729
|
}
|
|
2676
|
-
catch (
|
|
2677
|
-
|
|
2678
|
-
|
|
2730
|
+
catch (e_28) {
|
|
2731
|
+
env_28.error = e_28;
|
|
2732
|
+
env_28.hasError = true;
|
|
2679
2733
|
}
|
|
2680
2734
|
finally {
|
|
2681
|
-
__disposeResources(
|
|
2735
|
+
__disposeResources(env_28);
|
|
2682
2736
|
}
|
|
2683
2737
|
});
|
|
2684
2738
|
it("check ec enums", async () => {
|
|
2685
|
-
const
|
|
2739
|
+
const env_29 = { stack: [], error: void 0, hasError: false };
|
|
2686
2740
|
try {
|
|
2687
|
-
const ecdb = __addDisposableResource(
|
|
2741
|
+
const ecdb = __addDisposableResource(env_29, ECDbTestHelper.createECDb(outDir, "ecenums.ecdb", `<ECSchema schemaName="Test" alias="test" version="01.00.00" xmlns="http://www.bentley.com/schemas/Bentley.ECXML.3.2">
|
|
2688
2742
|
<ECEnumeration typeName="Status" backingTypeName="int" isStrict="true">
|
|
2689
2743
|
<ECEnumerator name="On" value="1" />
|
|
2690
2744
|
<ECEnumerator name="Off" value="2" />
|
|
@@ -2701,7 +2755,7 @@ describe("ECSqlStatement", () => {
|
|
|
2701
2755
|
</ECEntityClass>
|
|
2702
2756
|
</ECSchema>`), false);
|
|
2703
2757
|
assert.isTrue(ecdb.isOpen);
|
|
2704
|
-
const id = ecdb.
|
|
2758
|
+
const id = ecdb.withCachedWriteStatement("INSERT INTO test.Foo(MyStat,MyStats,MyDomain,MyDomains) VALUES(test.Status.[On],?,test.Domain.Org,?)", (stmt) => {
|
|
2705
2759
|
stmt.bindValue(1, [1, 2]);
|
|
2706
2760
|
stmt.bindValue(2, ["Org", "Com"]);
|
|
2707
2761
|
const res = stmt.stepForInsert();
|
|
@@ -2709,6 +2763,7 @@ describe("ECSqlStatement", () => {
|
|
|
2709
2763
|
assert.isDefined(res.id);
|
|
2710
2764
|
return res.id;
|
|
2711
2765
|
});
|
|
2766
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2712
2767
|
ecdb.withPreparedStatement("SELECT MyStat,MyStats, MyDomain,MyDomains FROM test.Foo WHERE ECInstanceId=?", (stmt) => {
|
|
2713
2768
|
stmt.bindId(1, id);
|
|
2714
2769
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
@@ -2718,15 +2773,18 @@ describe("ECSqlStatement", () => {
|
|
|
2718
2773
|
assert.deepEqual(row.myStats, [1, 2]);
|
|
2719
2774
|
assert.equal(row.myDomain, "Org");
|
|
2720
2775
|
assert.deepEqual(row.myDomains, ["Org", "Com"]);
|
|
2776
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2721
2777
|
const myStatVal = stmt.getValue(0);
|
|
2722
2778
|
assert.isFalse(myStatVal.isNull);
|
|
2723
2779
|
assert.isTrue(myStatVal.columnInfo.isEnum());
|
|
2724
2780
|
assert.equal(myStatVal.getInteger(), 1);
|
|
2725
2781
|
assert.deepEqual(myStatVal.getEnum(), [{ schema: "Test", name: "Status", key: "On", value: 1 }]);
|
|
2782
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2726
2783
|
const myStatsVal = stmt.getValue(1);
|
|
2727
2784
|
assert.isFalse(myStatsVal.isNull);
|
|
2728
2785
|
assert.isTrue(myStatsVal.columnInfo.isEnum());
|
|
2729
2786
|
assert.deepEqual(myStatsVal.getArray(), [1, 2]);
|
|
2787
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2730
2788
|
const actualStatsEnums = [];
|
|
2731
2789
|
for (const arrayElement of myStatsVal.getArrayIterator()) {
|
|
2732
2790
|
actualStatsEnums.push(arrayElement.getEnum());
|
|
@@ -2734,15 +2792,18 @@ describe("ECSqlStatement", () => {
|
|
|
2734
2792
|
assert.equal(actualStatsEnums.length, 2);
|
|
2735
2793
|
assert.deepEqual(actualStatsEnums[0], [{ schema: "Test", name: "Status", key: "On", value: 1 }]);
|
|
2736
2794
|
assert.deepEqual(actualStatsEnums[1], [{ schema: "Test", name: "Status", key: "Off", value: 2 }]);
|
|
2795
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2737
2796
|
const myDomainVal = stmt.getValue(2);
|
|
2738
2797
|
assert.isFalse(myDomainVal.isNull);
|
|
2739
2798
|
assert.isTrue(myDomainVal.columnInfo.isEnum());
|
|
2740
2799
|
assert.equal(myDomainVal.getString(), "Org");
|
|
2741
2800
|
assert.deepEqual(myDomainVal.getEnum(), [{ schema: "Test", name: "Domain", key: "Org", value: "Org" }]);
|
|
2801
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2742
2802
|
const myDomainsVal = stmt.getValue(3);
|
|
2743
2803
|
assert.isFalse(myDomainsVal.isNull);
|
|
2744
2804
|
assert.isTrue(myDomainsVal.columnInfo.isEnum());
|
|
2745
2805
|
assert.deepEqual(myDomainsVal.getArray(), ["Org", "Com"]);
|
|
2806
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2746
2807
|
const actualDomainsEnums = [];
|
|
2747
2808
|
for (const arrayElement of myDomainsVal.getArrayIterator()) {
|
|
2748
2809
|
actualDomainsEnums.push(arrayElement.getEnum());
|
|
@@ -2758,16 +2819,19 @@ describe("ECSqlStatement", () => {
|
|
|
2758
2819
|
assert.deepEqual(row.myDomains, ["Org", "Com"]);
|
|
2759
2820
|
}), 1);
|
|
2760
2821
|
// test some enums in the built-in schemas
|
|
2822
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2761
2823
|
ecdb.withPreparedStatement("SELECT Type,Modifier FROM meta.ECClassDef WHERE Name='Foo'", (stmt) => {
|
|
2762
2824
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
2763
2825
|
// getRow just returns the enum values
|
|
2764
2826
|
const row = stmt.getRow();
|
|
2765
2827
|
assert.deepEqual(row, { type: 0, modifier: 2 });
|
|
2828
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2766
2829
|
const typeVal = stmt.getValue(0);
|
|
2767
2830
|
assert.isFalse(typeVal.isNull);
|
|
2768
2831
|
assert.isTrue(typeVal.columnInfo.isEnum());
|
|
2769
2832
|
assert.equal(typeVal.getInteger(), 0);
|
|
2770
2833
|
assert.deepEqual(typeVal.getEnum(), [{ schema: "ECDbMeta", name: "ECClassType", key: "Entity", value: 0 }]);
|
|
2834
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2771
2835
|
const modifierVal = stmt.getValue(1);
|
|
2772
2836
|
assert.isFalse(modifierVal.isNull);
|
|
2773
2837
|
assert.isTrue(modifierVal.columnInfo.isEnum());
|
|
@@ -2778,21 +2842,21 @@ describe("ECSqlStatement", () => {
|
|
|
2778
2842
|
assert.deepEqual(row, { type: 0, modifier: 2 });
|
|
2779
2843
|
}), 1);
|
|
2780
2844
|
}
|
|
2781
|
-
catch (
|
|
2782
|
-
|
|
2783
|
-
|
|
2845
|
+
catch (e_29) {
|
|
2846
|
+
env_29.error = e_29;
|
|
2847
|
+
env_29.hasError = true;
|
|
2784
2848
|
}
|
|
2785
2849
|
finally {
|
|
2786
|
-
__disposeResources(
|
|
2850
|
+
__disposeResources(env_29);
|
|
2787
2851
|
}
|
|
2788
2852
|
});
|
|
2789
2853
|
it("check ORed ECEnums", async () => {
|
|
2790
|
-
const
|
|
2854
|
+
const env_30 = { stack: [], error: void 0, hasError: false };
|
|
2791
2855
|
try {
|
|
2792
2856
|
const slm = new SequentialLogMatcher();
|
|
2793
2857
|
slm.append().error().category("ECDb").message(/The value 9 cannot be broken down into a combination of ECEnumerators/gm);
|
|
2794
2858
|
slm.append().error().category("ECDb").message(/The value 'gov,de' cannot be broken down into a combination of ECEnumerators/gm);
|
|
2795
|
-
const ecdb = __addDisposableResource(
|
|
2859
|
+
const ecdb = __addDisposableResource(env_30, ECDbTestHelper.createECDb(outDir, "oredecenums.ecdb", `<ECSchema schemaName="Test" alias="test" version="01.00.00" xmlns="http://www.bentley.com/schemas/Bentley.ECXML.3.2">
|
|
2796
2860
|
<ECEnumeration typeName="Color" backingTypeName="int" isStrict="true">
|
|
2797
2861
|
<ECEnumerator name="Red" value="1" />
|
|
2798
2862
|
<ECEnumerator name="Yellow" value="2" />
|
|
@@ -2809,7 +2873,7 @@ describe("ECSqlStatement", () => {
|
|
|
2809
2873
|
</ECEntityClass>
|
|
2810
2874
|
</ECSchema>`), false);
|
|
2811
2875
|
assert.isTrue(ecdb.isOpen);
|
|
2812
|
-
const ids = ecdb.
|
|
2876
|
+
const ids = ecdb.withCachedWriteStatement("INSERT INTO test.Foo(MyColor,MyDomain) VALUES(?,?)", (stmt) => {
|
|
2813
2877
|
stmt.bindValue(1, 4);
|
|
2814
2878
|
stmt.bindValue(2, "com");
|
|
2815
2879
|
let res = stmt.stepForInsert();
|
|
@@ -2836,6 +2900,7 @@ describe("ECSqlStatement", () => {
|
|
|
2836
2900
|
stmt.clearBindings();
|
|
2837
2901
|
return { unored, ored, unmatched };
|
|
2838
2902
|
});
|
|
2903
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2839
2904
|
ecdb.withPreparedStatement("SELECT MyColor,MyDomain FROM test.Foo WHERE ECInstanceId=?", (stmt) => {
|
|
2840
2905
|
stmt.bindId(1, ids.unored);
|
|
2841
2906
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
@@ -2843,11 +2908,13 @@ describe("ECSqlStatement", () => {
|
|
|
2843
2908
|
let row = stmt.getRow();
|
|
2844
2909
|
assert.equal(row.myColor, 4);
|
|
2845
2910
|
assert.equal(row.myDomain, "com");
|
|
2911
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2846
2912
|
let colVal = stmt.getValue(0);
|
|
2847
2913
|
assert.isFalse(colVal.isNull);
|
|
2848
2914
|
assert.isTrue(colVal.columnInfo.isEnum());
|
|
2849
2915
|
assert.equal(colVal.getInteger(), 4);
|
|
2850
2916
|
assert.deepEqual(colVal.getEnum(), [{ schema: "Test", name: "Color", key: "Blue", value: 4 }]);
|
|
2917
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2851
2918
|
let domainVal = stmt.getValue(1);
|
|
2852
2919
|
assert.isFalse(domainVal.isNull);
|
|
2853
2920
|
assert.isTrue(domainVal.columnInfo.isEnum());
|
|
@@ -2903,10 +2970,12 @@ describe("ECSqlStatement", () => {
|
|
|
2903
2970
|
assert.equal(row.myDomain, "gov,de");
|
|
2904
2971
|
}), 1);
|
|
2905
2972
|
// test some enums in the built-in schemas
|
|
2973
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2906
2974
|
ecdb.withPreparedStatement("SELECT CustomAttributeContainerType caType FROM meta.ECClassDef WHERE Type=meta.ECClassType.CustomAttribute AND Name='DateTimeInfo'", (stmt) => {
|
|
2907
2975
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
2908
2976
|
const row = stmt.getRow();
|
|
2909
2977
|
assert.equal(row.caType, 160);
|
|
2978
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2910
2979
|
const caTypeVal = stmt.getValue(0);
|
|
2911
2980
|
assert.isFalse(caTypeVal.isNull);
|
|
2912
2981
|
assert.isTrue(caTypeVal.columnInfo.isEnum());
|
|
@@ -2921,18 +2990,18 @@ describe("ECSqlStatement", () => {
|
|
|
2921
2990
|
}), 1);
|
|
2922
2991
|
assert.isTrue(slm.finishAndDispose());
|
|
2923
2992
|
}
|
|
2924
|
-
catch (
|
|
2925
|
-
|
|
2926
|
-
|
|
2993
|
+
catch (e_30) {
|
|
2994
|
+
env_30.error = e_30;
|
|
2995
|
+
env_30.hasError = true;
|
|
2927
2996
|
}
|
|
2928
2997
|
finally {
|
|
2929
|
-
__disposeResources(
|
|
2998
|
+
__disposeResources(env_30);
|
|
2930
2999
|
}
|
|
2931
3000
|
});
|
|
2932
3001
|
it("should get native sql", async () => {
|
|
2933
|
-
const
|
|
3002
|
+
const env_31 = { stack: [], error: void 0, hasError: false };
|
|
2934
3003
|
try {
|
|
2935
|
-
const ecdb = __addDisposableResource(
|
|
3004
|
+
const ecdb = __addDisposableResource(env_31, ECDbTestHelper.createECDb(outDir, "asyncmethodtest.ecdb", `<ECSchema schemaName="Test" alias="ts" version="01.00.00" xmlns="http://www.bentley.com/schemas/Bentley.ECXML.3.2">
|
|
2936
3005
|
<ECEntityClass typeName="Foo" modifier="Sealed">
|
|
2937
3006
|
<ECProperty propertyName="n" typeName="int"/>
|
|
2938
3007
|
<ECProperty propertyName="dt" typeName="dateTime"/>
|
|
@@ -2940,7 +3009,7 @@ describe("ECSqlStatement", () => {
|
|
|
2940
3009
|
</ECEntityClass>
|
|
2941
3010
|
</ECSchema>`), false);
|
|
2942
3011
|
assert.isTrue(ecdb.isOpen);
|
|
2943
|
-
const r = await ecdb.
|
|
3012
|
+
const r = await ecdb.withCachedWriteStatement("INSERT INTO ts.Foo(n,dt,fooId) VALUES(20,TIMESTAMP '2018-10-18T12:00:00Z',20)", async (stmt) => {
|
|
2944
3013
|
const nativesql = stmt.getNativeSql();
|
|
2945
3014
|
assert.isTrue(nativesql.startsWith("INSERT INTO [ts_Foo]"));
|
|
2946
3015
|
return stmt.stepForInsert();
|
|
@@ -2949,29 +3018,30 @@ describe("ECSqlStatement", () => {
|
|
|
2949
3018
|
assert.equal(r.status, DbResult.BE_SQLITE_DONE);
|
|
2950
3019
|
assert.equal(r.id, "0x1");
|
|
2951
3020
|
}
|
|
2952
|
-
catch (
|
|
2953
|
-
|
|
2954
|
-
|
|
3021
|
+
catch (e_31) {
|
|
3022
|
+
env_31.error = e_31;
|
|
3023
|
+
env_31.hasError = true;
|
|
2955
3024
|
}
|
|
2956
3025
|
finally {
|
|
2957
|
-
__disposeResources(
|
|
3026
|
+
__disposeResources(env_31);
|
|
2958
3027
|
}
|
|
2959
3028
|
});
|
|
2960
3029
|
it("check column info", async () => {
|
|
2961
|
-
const
|
|
3030
|
+
const env_32 = { stack: [], error: void 0, hasError: false };
|
|
2962
3031
|
try {
|
|
2963
|
-
const ecdb = __addDisposableResource(
|
|
3032
|
+
const ecdb = __addDisposableResource(env_32, ECDbTestHelper.createECDb(outDir, "columnInfo.ecdb", `<ECSchema schemaName="Test" alias="test" version="01.00.00" xmlns="http://www.bentley.com/schemas/Bentley.ECXML.3.2">
|
|
2964
3033
|
<ECEntityClass typeName="MyClass" modifier="Sealed">
|
|
2965
3034
|
<ECProperty propertyName="MyProperty" typeName="string"/>
|
|
2966
3035
|
</ECEntityClass>
|
|
2967
3036
|
</ECSchema>`), false);
|
|
2968
3037
|
assert.isTrue(ecdb.isOpen);
|
|
2969
|
-
const id = ecdb.
|
|
3038
|
+
const id = ecdb.withCachedWriteStatement("INSERT INTO test.MyClass(MyProperty) VALUES('Value')", (stmt) => {
|
|
2970
3039
|
const res = stmt.stepForInsert();
|
|
2971
3040
|
assert.equal(res.status, DbResult.BE_SQLITE_DONE);
|
|
2972
3041
|
assert.isDefined(res.id);
|
|
2973
3042
|
return res.id;
|
|
2974
3043
|
});
|
|
3044
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2975
3045
|
ecdb.withPreparedStatement("SELECT MyProperty as MyAlias, 1 as MyGenerated FROM test.MyClass WHERE ECInstanceId=?", (stmt) => {
|
|
2976
3046
|
stmt.bindId(1, id);
|
|
2977
3047
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
@@ -2979,7 +3049,9 @@ describe("ECSqlStatement", () => {
|
|
|
2979
3049
|
const row = stmt.getRow();
|
|
2980
3050
|
assert.equal(row.myAlias, "Value");
|
|
2981
3051
|
assert.equal(row.myGenerated, 1);
|
|
3052
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2982
3053
|
const val0 = stmt.getValue(0);
|
|
3054
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2983
3055
|
const colInfo0 = val0.columnInfo;
|
|
2984
3056
|
assert.equal(colInfo0.getPropertyName(), "MyAlias");
|
|
2985
3057
|
const accessString0 = colInfo0.getAccessString();
|
|
@@ -2987,7 +3059,9 @@ describe("ECSqlStatement", () => {
|
|
|
2987
3059
|
const originPropertyName = colInfo0.getOriginPropertyName();
|
|
2988
3060
|
assert.isDefined(originPropertyName);
|
|
2989
3061
|
assert.equal(originPropertyName, "MyProperty");
|
|
3062
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2990
3063
|
const val1 = stmt.getValue(1);
|
|
3064
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2991
3065
|
const colInfo1 = val1.columnInfo;
|
|
2992
3066
|
assert.equal(colInfo1.getPropertyName(), "MyGenerated");
|
|
2993
3067
|
const accessString1 = colInfo1.getAccessString();
|
|
@@ -2995,18 +3069,18 @@ describe("ECSqlStatement", () => {
|
|
|
2995
3069
|
assert.isUndefined(colInfo1.getOriginPropertyName());
|
|
2996
3070
|
});
|
|
2997
3071
|
}
|
|
2998
|
-
catch (
|
|
2999
|
-
|
|
3000
|
-
|
|
3072
|
+
catch (e_32) {
|
|
3073
|
+
env_32.error = e_32;
|
|
3074
|
+
env_32.hasError = true;
|
|
3001
3075
|
}
|
|
3002
3076
|
finally {
|
|
3003
|
-
__disposeResources(
|
|
3077
|
+
__disposeResources(env_32);
|
|
3004
3078
|
}
|
|
3005
3079
|
});
|
|
3006
3080
|
it("check access string metadata in nested struct", async () => {
|
|
3007
|
-
const
|
|
3081
|
+
const env_33 = { stack: [], error: void 0, hasError: false };
|
|
3008
3082
|
try {
|
|
3009
|
-
const ecdb = __addDisposableResource(
|
|
3083
|
+
const ecdb = __addDisposableResource(env_33, ECDbTestHelper.createECDb(outDir, "columnInfo.ecdb", `<ECSchema schemaName="Test" alias="test" version="01.00.00" xmlns="http://www.bentley.com/schemas/Bentley.ECXML.3.2">
|
|
3010
3084
|
<ECSchemaReference name="ECDbMap" version="02.00.00" alias="ecdbmap"/>
|
|
3011
3085
|
<ECStructClass typeName="InnerStruct">
|
|
3012
3086
|
<ECProperty propertyName="a" typeName="string"/>
|
|
@@ -3038,11 +3112,12 @@ describe("ECSqlStatement", () => {
|
|
|
3038
3112
|
</ECEntityClass>
|
|
3039
3113
|
</ECSchema>`), false);
|
|
3040
3114
|
assert.isTrue(ecdb.isOpen);
|
|
3041
|
-
ecdb.
|
|
3115
|
+
ecdb.withCachedWriteStatement("INSERT INTO Test.A (f.c.a, f.c.b, f.d, g) VALUES ('f.c.a' ,'f.c.b', 'f.d', 'g')", (stmt) => {
|
|
3042
3116
|
const res = stmt.stepForInsert();
|
|
3043
3117
|
assert.equal(res.status, DbResult.BE_SQLITE_DONE);
|
|
3044
3118
|
assert.isDefined(res.id);
|
|
3045
3119
|
});
|
|
3120
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
3046
3121
|
ecdb.withPreparedStatement("SELECT f, f.c.a, f.c.b, f.d, g FROM Test.A", (stmt) => {
|
|
3047
3122
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
3048
3123
|
// getRow just returns the enum values
|
|
@@ -3051,7 +3126,9 @@ describe("ECSqlStatement", () => {
|
|
|
3051
3126
|
assert.equal(row.f.c.b, "f.c.b");
|
|
3052
3127
|
assert.equal(row.f.d, "f.d");
|
|
3053
3128
|
assert.equal(row.g, "g");
|
|
3129
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
3054
3130
|
const val0 = stmt.getValue(0);
|
|
3131
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
3055
3132
|
const colInfo0 = val0.columnInfo;
|
|
3056
3133
|
assert.equal(colInfo0.getPropertyName(), "f");
|
|
3057
3134
|
const accessString0 = colInfo0.getAccessString();
|
|
@@ -3059,7 +3136,9 @@ describe("ECSqlStatement", () => {
|
|
|
3059
3136
|
const originPropertyName0 = colInfo0.getOriginPropertyName();
|
|
3060
3137
|
assert.isDefined(originPropertyName0);
|
|
3061
3138
|
assert.equal(originPropertyName0, "f");
|
|
3139
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
3062
3140
|
const val1 = stmt.getValue(1);
|
|
3141
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
3063
3142
|
const colInfo1 = val1.columnInfo;
|
|
3064
3143
|
assert.equal(colInfo1.getPropertyName(), "a");
|
|
3065
3144
|
const accessString1 = colInfo1.getAccessString();
|
|
@@ -3067,7 +3146,9 @@ describe("ECSqlStatement", () => {
|
|
|
3067
3146
|
const originPropertyName1 = colInfo1.getOriginPropertyName();
|
|
3068
3147
|
assert.isDefined(originPropertyName1);
|
|
3069
3148
|
assert.equal(originPropertyName1, "a");
|
|
3149
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
3070
3150
|
const val2 = stmt.getValue(2);
|
|
3151
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
3071
3152
|
const colInfo2 = val2.columnInfo;
|
|
3072
3153
|
assert.equal(colInfo2.getPropertyName(), "b");
|
|
3073
3154
|
const accessString2 = colInfo2.getAccessString();
|
|
@@ -3075,7 +3156,9 @@ describe("ECSqlStatement", () => {
|
|
|
3075
3156
|
const originPropertyName2 = colInfo2.getOriginPropertyName();
|
|
3076
3157
|
assert.isDefined(originPropertyName2);
|
|
3077
3158
|
assert.equal(originPropertyName2, "b");
|
|
3159
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
3078
3160
|
const val3 = stmt.getValue(3);
|
|
3161
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
3079
3162
|
const colInfo3 = val3.columnInfo;
|
|
3080
3163
|
assert.equal(colInfo3.getPropertyName(), "d");
|
|
3081
3164
|
const accessString3 = colInfo3.getAccessString();
|
|
@@ -3083,7 +3166,9 @@ describe("ECSqlStatement", () => {
|
|
|
3083
3166
|
const originPropertyName3 = colInfo3.getOriginPropertyName();
|
|
3084
3167
|
assert.isDefined(originPropertyName3);
|
|
3085
3168
|
assert.equal(originPropertyName3, "d");
|
|
3169
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
3086
3170
|
const val4 = stmt.getValue(4);
|
|
3171
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
3087
3172
|
const colInfo4 = val4.columnInfo;
|
|
3088
3173
|
assert.equal(colInfo4.getPropertyName(), "g");
|
|
3089
3174
|
const accessString4 = colInfo4.getAccessString();
|
|
@@ -3092,11 +3177,12 @@ describe("ECSqlStatement", () => {
|
|
|
3092
3177
|
assert.isDefined(originPropertyName4);
|
|
3093
3178
|
assert.equal(originPropertyName4, "g");
|
|
3094
3179
|
});
|
|
3095
|
-
ecdb.
|
|
3180
|
+
ecdb.withCachedWriteStatement("INSERT INTO Test.B (h.a, h.b, i) VALUES ('h.a' ,'h.b', 'i')", (stmt) => {
|
|
3096
3181
|
const res = stmt.stepForInsert();
|
|
3097
3182
|
assert.equal(res.status, DbResult.BE_SQLITE_DONE);
|
|
3098
3183
|
assert.isDefined(res.id);
|
|
3099
3184
|
});
|
|
3185
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
3100
3186
|
ecdb.withPreparedStatement("SELECT h, i FROM Test.B", (stmt) => {
|
|
3101
3187
|
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
|
|
3102
3188
|
// getRow just returns the enum values
|
|
@@ -3104,7 +3190,9 @@ describe("ECSqlStatement", () => {
|
|
|
3104
3190
|
assert.equal(row.h.a, "h.a");
|
|
3105
3191
|
assert.equal(row.h.b, "h.b");
|
|
3106
3192
|
assert.equal(row.i, "i");
|
|
3193
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
3107
3194
|
const val0 = stmt.getValue(0);
|
|
3195
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
3108
3196
|
const colInfo0 = val0.columnInfo;
|
|
3109
3197
|
assert.equal(colInfo0.getPropertyName(), "h");
|
|
3110
3198
|
const accessString0 = colInfo0.getAccessString();
|
|
@@ -3112,7 +3200,9 @@ describe("ECSqlStatement", () => {
|
|
|
3112
3200
|
const originPropertyName0 = colInfo0.getOriginPropertyName();
|
|
3113
3201
|
assert.isDefined(originPropertyName0);
|
|
3114
3202
|
assert.equal(originPropertyName0, "h");
|
|
3203
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
3115
3204
|
const val1 = stmt.getValue(1);
|
|
3205
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
3116
3206
|
const colInfo1 = val1.columnInfo;
|
|
3117
3207
|
assert.equal(colInfo1.getPropertyName(), "i");
|
|
3118
3208
|
const accessString1 = colInfo1.getAccessString();
|
|
@@ -3122,18 +3212,18 @@ describe("ECSqlStatement", () => {
|
|
|
3122
3212
|
assert.equal(originPropertyName1, "i");
|
|
3123
3213
|
});
|
|
3124
3214
|
}
|
|
3125
|
-
catch (
|
|
3126
|
-
|
|
3127
|
-
|
|
3215
|
+
catch (e_33) {
|
|
3216
|
+
env_33.error = e_33;
|
|
3217
|
+
env_33.hasError = true;
|
|
3128
3218
|
}
|
|
3129
3219
|
finally {
|
|
3130
|
-
__disposeResources(
|
|
3220
|
+
__disposeResources(env_33);
|
|
3131
3221
|
}
|
|
3132
3222
|
});
|
|
3133
3223
|
it("ecsql statements with QueryBinder", async () => {
|
|
3134
|
-
const
|
|
3224
|
+
const env_34 = { stack: [], error: void 0, hasError: false };
|
|
3135
3225
|
try {
|
|
3136
|
-
const ecdb = __addDisposableResource(
|
|
3226
|
+
const ecdb = __addDisposableResource(env_34, ECDbTestHelper.createECDb(outDir, "test.ecdb", `<ECSchema schemaName="Test" alias="ts" version="01.00.00" xmlns="http://www.bentley.com/schemas/Bentley.ECXML.3.2">
|
|
3137
3227
|
<ECEntityClass typeName="Foo" modifier="Sealed">
|
|
3138
3228
|
<ECProperty propertyName="booleanProperty" typeName="boolean"/>
|
|
3139
3229
|
<ECProperty propertyName="blobProperty" typeName="binary"/>
|
|
@@ -3166,7 +3256,7 @@ describe("ECSqlStatement", () => {
|
|
|
3166
3256
|
const point2dValue = new Point2d(10, 20);
|
|
3167
3257
|
const point3dValue = new Point3d(15, 30, 45);
|
|
3168
3258
|
const structValue = { structClassProperty: "test string value for struct property" };
|
|
3169
|
-
let r = await ecdb.
|
|
3259
|
+
let r = await ecdb.withCachedWriteStatement(`INSERT INTO ts.Foo(booleanProperty, blobProperty, doubleProperty, customIdProperty, customIdSetProperty, intProperty, longProperty, stringProperty, nullProperty, point2dProperty, point3dProperty)
|
|
3170
3260
|
VALUES(:booleanValue, :blobValue, :doubleValue, :customIdValue, :customIdSetValue, :intValue, :longValue, :stringValue, :nullValue, :point2dValue, :point3dValue)`, async (stmt) => {
|
|
3171
3261
|
stmt.bindBoolean("booleanValue", booleanValue);
|
|
3172
3262
|
stmt.bindBlob("blobValue", blobValue);
|
|
@@ -3212,7 +3302,7 @@ describe("ECSqlStatement", () => {
|
|
|
3212
3302
|
assert.deepEqual(row[9], { X: 10, Y: 20 });
|
|
3213
3303
|
assert.deepEqual(row[10], { X: 15, Y: 30, Z: 45 });
|
|
3214
3304
|
assert.isFalse(await reader.step());
|
|
3215
|
-
r = await ecdb.
|
|
3305
|
+
r = await ecdb.withCachedWriteStatement("INSERT INTO ts.Baz(structProperty) VALUES(:structValue)", async (stmt) => {
|
|
3216
3306
|
stmt.bindStruct("structValue", structValue);
|
|
3217
3307
|
return stmt.stepForInsert();
|
|
3218
3308
|
});
|
|
@@ -3227,12 +3317,12 @@ describe("ECSqlStatement", () => {
|
|
|
3227
3317
|
reader = ecdb.createQueryReader("SELECT * FROM ts.Baz WHERE structProperty = :structValue", paramsWithStruct);
|
|
3228
3318
|
await assert.isRejected(reader.toArray(), "Struct type binding not supported");
|
|
3229
3319
|
}
|
|
3230
|
-
catch (
|
|
3231
|
-
|
|
3232
|
-
|
|
3320
|
+
catch (e_34) {
|
|
3321
|
+
env_34.error = e_34;
|
|
3322
|
+
env_34.hasError = true;
|
|
3233
3323
|
}
|
|
3234
3324
|
finally {
|
|
3235
|
-
__disposeResources(
|
|
3325
|
+
__disposeResources(env_34);
|
|
3236
3326
|
}
|
|
3237
3327
|
});
|
|
3238
3328
|
});
|