-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate ECSqlStatement class and UseJsPropertyName and convertClassIdsToClassNames flags #7350
Comments
I imagine this will also encompass removing Internal usage via GH queries |
Details on what was wrong and how to do it rightThere are two ways to read value for row return by Get value by index of property in ECSqlStatementIn the following, we use iModel.withStatement("SELECT ECInstanceId, CodeValue FROM BisCore.Element WHERE ECInstanceId=?", (stmt: ECSqlStatement){
stmt.bindId(1, "0x1");
if (stmt.step() == DbResult.BE_SQLITE_ROW) {
// Use getValueXXXX function to get the value
const id = stmt.getValue(0).getId();
const codeValue = stmt.getValue(1).getString();
return { id, codeValue };
}
}); Get value by converting row to javascript object using
|
Why
There are multiple code paths to execute ECSql queries, they produce inconsistent results and have behavior that is undocumented.
What
The functions
withPreparedStatement
andwithStatement
will be deprecated along with theECSqlStatement
that they return. This API has been chosen for deprecation because it is synchronous, inconsistent by default and only available in the backend. The alternative (ECSqlReader
) is consistent with default options, is async and consistent on the frontend and backend APIs.The query option
UseJsPropertyNames
will be deprecated. It produces inconsistent results especially around conversion of class ids to class names.UseECSqlPropertyIndexes
is a more performant alternative if you want to access the results by index andUseECSqlPropertyNames
produces more consistent results thatUseJsPropertyNames
. SeeQueryRowFormat
for more details.The query option
convertClassIdsToClassNames
will be deprecated. It is currently inconsistently applied when used in conjunction withUseJsPropertyNames
. It should be replaced with explicit use of theec_classname
function to convert class ids to class names. SeeQueryOptions
for more details.Impact
This change will impact anyone who uses
withPreparedStatement
orwithStatement
and anyone who usesECSqlReader
AND has used one of the flagsUseJsPropertyNames
orconvertClassIdsToClassNames
. For users ofECSqlReader
updating to these changes is straight forwards and documentation + examples will be provided. For users ofECSqlStatement
the changes are larger because the replacement API is synchronous.Feedback Needed
We are interested in understanding use cases where synchronous queries executed on the main thread are necessary. This type of query can hang the backend freezing an electron app or making a server unresponsive. So we want to move the default away from sync queries but understand that there may be reasons to opt into a sync query but want to understand those before implementing a solution.
The removal of
convertClassIdsToClassNames
takes away a feature without providing a like replacement. We have seen this automatic replacement cause confusion over the years. We think an explicit ECSql function call is a better option because it removes this confusion while still being easy to use.The text was updated successfully, but these errors were encountered: