Skip to content

Commit

Permalink
Tests and documentation updated for schema names made optional for ta…
Browse files Browse the repository at this point in the history
…ble valued functions (backport #7630) [release/4.11.x] (#7658)

Co-authored-by: Soham Bhattacharjee <[email protected]>
Co-authored-by: imodeljs-admin <[email protected]>
  • Loading branch information
3 people authored Feb 6, 2025
1 parent 98e4e6c commit 181fb74
Show file tree
Hide file tree
Showing 13 changed files with 384 additions and 42 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@itwin/core-backend",
"comment": "",
"type": "none"
}
],
"packageName": "@itwin/core-backend"
}
8 changes: 4 additions & 4 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion core/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
"webpack": "^5.76.0"
},
"dependencies": {
"@bentley/imodeljs-native": "4.11.16",
"@bentley/imodeljs-native": "4.11.17",
"@itwin/cloud-agnostic-core": "^2.2.4",
"@itwin/core-telemetry": "workspace:*",
"@itwin/object-storage-azure": "^2.2.5",
Expand Down
8 changes: 4 additions & 4 deletions core/backend/src/test/ecdb/ECSqlQuery.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ describe("ECSql Query", () => {
for await (const row of imodel1.createQueryReader("SELECT ECInstanceId FROM BisCore.Element LIMIT 23")) {
ids.push(row[0]);
}
const reader = imodel1.createQueryReader("SELECT * FROM BisCore.element, ECVLib.IdSet(?) WHERE id = ECInstanceId ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES", QueryBinder.from([ids]));
const reader = imodel1.createQueryReader("SELECT * FROM BisCore.element, IdSet(?) WHERE id = ECInstanceId ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES", QueryBinder.from([ids]));
let props = await reader.getMetaData();
assert.equal(props.length, 12); // 11 for BisCore.element and 1 for IdSet
let rows = 0;
Expand All @@ -576,7 +576,7 @@ describe("ECSql Query", () => {
ids = row[0]; // getting only the first id
break;
}
const reader = imodel1.createQueryReader("SELECT * FROM BisCore.element, ECVLib.IdSet(?) WHERE id = ECInstanceId ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES", QueryBinder.from([ids]));
const reader = imodel1.createQueryReader("SELECT * FROM BisCore.element, IdSet(?) WHERE id = ECInstanceId ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES", QueryBinder.from([ids]));
let props = await reader.getMetaData();
assert.equal(props.length, 12); // 11 for BisCore.element and 1 for IdSet
let rows = 0; // backend will fail to bind so no rows will be returned
Expand All @@ -592,7 +592,7 @@ describe("ECSql Query", () => {
it("concurrent query bind idset with invalid values in IdSet virtual table", async () => {
const ids: string[] = ["0x1","ABC","YZ"];

const reader = imodel1.createQueryReader("SELECT * FROM BisCore.element, ECVLib.IdSet(?) WHERE id = ECInstanceId ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES", QueryBinder.from([ids]));
const reader = imodel1.createQueryReader("SELECT * FROM BisCore.element, IdSet(?) WHERE id = ECInstanceId ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES", QueryBinder.from([ids]));
let props = await reader.getMetaData();
assert.equal(props.length, 12); // 11 for BisCore.element and 1 for IdSet
let rows = 0; // backend will bind successfully but some of the values are not valid for IdSet VT so those values will be ignored
Expand All @@ -609,7 +609,7 @@ describe("ECSql Query", () => {
const ids: string[] = ["ABC", "0x1","YZ"]; // as first value is not an Id so QueryBinder.from will throw error of "unsupported type"

try{
imodel1.createQueryReader("SELECT * FROM BisCore.element, ECVLib.IdSet(?) WHERE id = ECInstanceId ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES", QueryBinder.from([ids]));
imodel1.createQueryReader("SELECT * FROM BisCore.element, IdSet(?) WHERE id = ECInstanceId ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES", QueryBinder.from([ids]));
}catch(err: any){
assert.equal(err.message, "unsupported type");
}
Expand Down
2 changes: 1 addition & 1 deletion core/backend/src/test/ecdb/ECSqlReader.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe("ECSqlReader", (() => {
params.bindIdSet(1, ["0x32"]);
const optionBuilder = new QueryOptionsBuilder();
optionBuilder.setRowFormat(QueryRowFormat.UseJsPropertyNames);
reader = ecdb.createQueryReader("SELECT ECInstanceId, Name FROM meta.ECClassDef, ECVLib.IdSet(?) WHERE id = ECInstanceId ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES", params, optionBuilder.getOptions());
reader = ecdb.createQueryReader("SELECT ECInstanceId, Name FROM meta.ECClassDef, IdSet(?) WHERE id = ECInstanceId ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES", params, optionBuilder.getOptions());
const rows = await reader.toArray();
assert.equal(rows[0].id, "0x32");
assert.equal(rows.length, 1);
Expand Down
4 changes: 2 additions & 2 deletions core/backend/src/test/ecdb/ECSqlStatement.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1867,7 +1867,7 @@ describe("ECSqlStatement", () => {
});
});

ecdb.withPreparedStatement("SELECT ECInstanceId, ECClassId, Name from ecdbf.ExternalFileInfo, ECVLib.IdSet(?) WHERE id = ECInstanceId ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES", (stmt: ECSqlStatement) => {
ecdb.withPreparedStatement("SELECT ECInstanceId, ECClassId, Name from ecdbf.ExternalFileInfo, IdSet(?) WHERE id = ECInstanceId ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES", (stmt: ECSqlStatement) => {
let idSet: Id64String[] = [];
stmt.bindIdSet(1, idSet);
let result = stmt.step();
Expand Down Expand Up @@ -1926,7 +1926,7 @@ describe("ECSqlStatement", () => {
});
});

ecdb.withPreparedStatement("SELECT ECInstanceId, ECClassId, Name from ecdbf.ExternalFileInfo, ECVLib.IdSet(?) WHERE id = ECInstanceId ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES", (stmt: ECSqlStatement) => {
ecdb.withPreparedStatement("SELECT ECInstanceId, ECClassId, Name from ecdbf.ExternalFileInfo, IdSet(?) WHERE id = ECInstanceId ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES", (stmt: ECSqlStatement) => {
let idSet: Id64String[] = [];
stmt.bindIdSet(1, idSet);
let result = stmt.step();
Expand Down
Loading

0 comments on commit 181fb74

Please sign in to comment.