You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
createQueryReader() is not returning inserted data before saveChanges is called.
Reproduce steps
To reproduce, execute code similar to this:
asyncfunctionlogCounts(iModelDb: IModelDb){constecsql="SELECT Count(*) as C FROM bis.Subject where CodeValue='S1'";constresult=iModelDb.withPreparedStatement(ecsql,stmt=>{if(DbResult.BE_SQLITE_ROW===stmt.step()){returnstmt.getValue(0).getInteger();}return0;});console.log(`withPreparedStatement returned: ${result}`);forawait(constrowofiModelDb.createQueryReader(ecsql)){console.log(`createQueryReader returned: ${row.C}`);}}// Use your preffered way to create empty iModel e.g. SnapshotDb.createEmpty()Subject.insert(iModelDb,IModel.rootSubjectId,"S1");console.log("before saving changes");awaitlogCounts(iModelDb);iModelDb.saveChanges();console.log("after saving changes");awaitlogCounts(iModelDb);
Results
It prints:
before saving changes
withPreparedStatement returned: 1 createQueryReader returned: 0
after saving changes
withPreparedStatement returned: 1
createQueryReader returned: 1
Expected results
createQueryReader() should query inserted data. Same as withPreparedStatement(), which returns data even if saveChanges() was not called yet.
Package version
iTwin.js Version 4.10.2
The text was updated successfully, but these errors were encountered:
JulijaRamoskiene
changed the title
createQueryReader() is not returning data before 'saveChanges()' is calledcreateQueryReader() is not returning data before saveChanges() is called
Feb 12, 2025
Description
createQueryReader()
is not returning inserted data beforesaveChanges
is called.Reproduce steps
To reproduce, execute code similar to this:
Results
It prints:
before saving changes
withPreparedStatement returned: 1
createQueryReader returned: 0
after saving changes
withPreparedStatement returned: 1
createQueryReader returned: 1
Expected results
createQueryReader()
should query inserted data. Same aswithPreparedStatement()
, which returns data even ifsaveChanges()
was not called yet.Package version
The text was updated successfully, but these errors were encountered: