@itwin/core-backend
Version:
iTwin.js backend components
680 lines • 34.2 kB
TypeScript
/** @packageDocumentation
* @module ECSQL
*/
import { DbResult, GuidString, Id64String } from "@itwin/core-bentley";
import { LowAndHighXYZ, XAndY, XYAndZ } from "@itwin/core-geometry";
import { ECSqlValueType, NavigationBindingValue, NavigationValue, QueryRowFormat } from "@itwin/core-common";
import { IModelJsNative } from "@bentley/imodeljs-native";
/** The result of an **ECSQL INSERT** statement as returned from [ECSqlStatement.stepForInsert]($backend).
*
* If the step was successful, the ECSqlInsertResult contains
* [DbResult.BE_SQLITE_DONE]($core-bentley)
* and the ECInstanceId of the newly created instance.
* In case of failure it contains the [DbResult]($core-bentley) error code.
*
* > Insert statements can be used with ECDb only, not with IModelDb.
* @public
*/
export declare class ECSqlInsertResult {
status: DbResult;
id?: Id64String | undefined;
constructor(status: DbResult, id?: Id64String | undefined);
}
/**
* Arguments supplied to [[ECSqlStatement.getRow]].
* @public
* */
export interface ECSqlRowArg {
/** Determine row format. */
rowFormat?: QueryRowFormat;
/**
* Determine if classIds are converted to class names.
*/
classIdsToClassNames?: boolean;
}
/** Executes ECSQL statements.
*
* A statement must be prepared before it can be executed, and it must be released when no longer needed.
* See [IModelDb.withPreparedStatement]($backend) or
* [ECDb.withPreparedStatement]($backend) for a convenient and
* reliable way to prepare, execute, and then release a statement.
*
* A statement may contain parameters that must be filled in before use by the **bind** methods.
*
* Once prepared (and parameters are bound, if any), the statement is executed by calling [ECSqlStatement.step]($backend).
* In case of an **ECSQL SELECT** statement, the current row can be retrieved with [ECSqlStatement.getRow]($backend) as
* a whole, or with [ECSqlStatement.getValue]($backend) when individual values are needed.
* Alternatively, query results of an **ECSQL SELECT** statement can be stepped through by using
* standard iteration syntax, such as `for of`.
*
* > Preparing a statement can be time-consuming. The best way to reduce the effect of this overhead is to cache and reuse prepared
* > statements. A cached prepared statement may be used in different places in an app, as long as the statement is general enough.
* > The key to making this strategy work is to phrase a statement in a general way and use placeholders to represent parameters that will vary on each use.
*
* See also
* - [Executing ECSQL]($docs/learning/backend/ExecutingECSQL) provides more background on ECSQL and an introduction on how to execute ECSQL with the iTwin.js API.
* - [Code Examples]($docs/learning/backend/ECSQLCodeExamples) illustrate the use of the iTwin.js API for executing and working with ECSQL
* @public
* @deprecated in 4.11 - will not be removed until after 2026-06-13. Use [IModelDb.createQueryReader]($backend) or [ECDb.createQueryReader]($backend) to query.
* For ECDb, use [ECDb.withCachedWriteStatement]($backend) or [ECDb.withWriteStatement]($backend) to Insert/Update/Delete.
*/
export declare class ECSqlStatement implements IterableIterator<any>, Disposable {
private _stmt;
private _sql;
private _props;
get sql(): string;
/** Check if this statement has been prepared successfully or not */
get isPrepared(): boolean;
/** Prepare this statement prior to first use.
* @param db The DgnDb or ECDb to prepare the statement against
* @param ecsql The ECSQL statement string to prepare
* @param logErrors Determine if errors are logged or not
* @throws [IModelError]($common) if the ECSQL statement cannot be prepared. Normally, prepare fails due to ECSQL syntax errors or references to tables or properties that do not exist.
* The error.message property will provide details.
* @internal
*/
prepare(db: IModelJsNative.DgnDb | IModelJsNative.ECDb, ecsql: string, logErrors?: boolean): void;
/** Prepare this statement prior to first use.
* @param db The DgnDb or ECDb to prepare the statement against
* @param ecsql The ECSQL statement string to prepare
* @param logErrors Determine if errors are logged or not, its set to false by default for tryPrepare()
* @returns An object with a `status` member equal to [DbResult.BE_SQLITE_OK]($bentley) on success. Upon error, the `message` member will provide details.
* @internal
*/
tryPrepare(db: IModelJsNative.DgnDb | IModelJsNative.ECDb, ecsql: string, logErrors?: boolean): {
status: DbResult;
message: string;
};
/** Reset this statement so that the next call to step will return the first row, if any. */
reset(): void;
/** Get the Native SQL statement
* @internal
*/
getNativeSql(): string;
/** Call this function when finished with this statement. This releases the native resources held by the statement.
*
* > Do not call this method directly on a statement that is being managed by a statement cache.
*/
[Symbol.dispose](): void;
/** @deprecated in 5.0 - will not be removed until after 2026-06-13. Use [Symbol.dispose] instead. */
dispose(): void;
/** Binds the specified value to the specified ECSQL parameter.
* The section "[iTwin.js Types used in ECSQL Parameter Bindings]($docs/learning/ECSQLParameterTypes)" describes the
* iTwin.js types to be used for the different ECSQL parameter types.
* @param parameter Index (1-based) or name of the parameter
*/
bindValue(parameter: number | string, val: any): void;
/** Binds null to the specified ECSQL parameter.
* @param parameter Index (1-based) or name of the parameter
*/
bindNull(parameter: number | string): void;
/** Binds a BLOB value to the specified ECSQL parameter.
* @param parameter Index (1-based) or name of the parameter
* @param BLOB value as either a Uint8Array, ArrayBuffer or a Base64 string
*/
bindBlob(parameter: number | string, blob: string | Uint8Array | ArrayBuffer | SharedArrayBuffer): void;
/** Binds a boolean value to the specified ECSQL parameter.
* @param parameter Index (1-based) or name of the parameter
* @param val Boolean value
*/
bindBoolean(parameter: number | string, val: boolean): void;
/** Binds a DateTime value to the specified ECSQL parameter.
* @param parameter Index (1-based) or name of the parameter
* @param isoDateTimeString DateTime value as ISO8601 string
*/
bindDateTime(parameter: number | string, isoDateTimeString: string): void;
/** Binds a double value to the specified ECSQL parameter.
* @param parameter Index (1-based) or name of the parameter
* @param val Double value
*/
bindDouble(parameter: number | string, val: number): void;
/** Binds an GUID value to the specified ECSQL parameter.
* @param parameter Index (1-based) or name of the parameter
* @param val GUID value
*/
bindGuid(parameter: number | string, val: GuidString): void;
/** Binds an Id value to the specified ECSQL parameter.
* @param parameter Index (1-based) or name of the parameter
* @param val Id value
*/
bindId(parameter: number | string, val: Id64String): void;
/** Binds an integer value to the specified ECSQL parameter.
* @param parameter Index (1-based) or name of the parameter
* @param val Integer value as number, decimal string or hexadecimal string.
*/
bindInteger(parameter: number | string, val: number | string): void;
/** Binds an Point2d value to the specified ECSQL parameter.
* @param parameter Index (1-based) or name of the parameter
* @param val Point2d value
*/
bindPoint2d(parameter: number | string, val: XAndY): void;
/** Binds an Point3d value to the specified ECSQL parameter.
* @param parameter Index (1-based) or name of the parameter
* @param val Point3d value
*/
bindPoint3d(parameter: number | string, val: XYAndZ): void;
/** Binds a Range3d as a blob to the specified ECSQL parameter
* @param parameter Index(1-based) or name of the parameter
* @param val Range3d value
*/
bindRange3d(parameter: number | string, val: LowAndHighXYZ): void;
/** Binds an string to the specified ECSQL parameter.
* @param parameter Index (1-based) or name of the parameter
* @param val String value
*/
bindString(parameter: number | string, val: string): void;
/** Binds a navigation property value to the specified ECSQL parameter.
* @param parameter Index (1-based) or name of the parameter
* @param val Navigation property value
*/
bindNavigation(parameter: number | string, val: NavigationBindingValue): void;
/** Binds a struct property value to the specified ECSQL parameter.
* @param parameter Index (1-based) or name of the parameter
* @param val Struct value. The struct value is an object composed of pairs of a struct member property name and its value
* (of one of the supported types)
*/
bindStruct(parameter: number | string, val: object): void;
/** Binds an array value to the specified ECSQL parameter.
* @param parameter Index (1-based) or name of the parameter
* @param val Array value. The array value is an array of values of the supported types
*/
bindArray(parameter: number | string, val: any[]): void;
bindIdSet(parameter: number | string, val: Id64String[]): void;
/**
* Gets a binder to bind a value for an ECSQL parameter
* > This is the most low-level API to bind a value to a specific parameter. Alternatively you can use the ECSqlStatement.bindXX methods
* > or [ECSqlStatement.bindValues]($backend).
* @param parameter Index (1-based) or name of the parameter
*/
getBinder(parameter: string | number): ECSqlBinder;
/** Bind values to all parameters in the statement.
* @param values The values to bind to the parameters.
* Pass an *array* of values if the parameters are *positional*.
* Pass an *object of the values keyed on the parameter name* for *named parameters*.
* The values in either the array or object must match the respective types of the parameter.
*
* The section "[iTwin.js Types used in ECSQL Parameter Bindings]($docs/learning/ECSQLParameterTypes)" describes the
* iTwin.js types to be used for the different ECSQL parameter types.
*
* See also these [Code Samples]($docs/learning/backend/ECSQLCodeExamples#binding-to-all-parameters-at-once)
*/
bindValues(values: any[] | object): void;
/** Clear any bindings that were previously set on this statement.
* @throws [IModelError]($common) in case of errors
*/
clearBindings(): void;
/** Step this statement to the next row.
*
* For **ECSQL SELECT** statements the method returns
* - [DbResult.BE_SQLITE_ROW]($core-bentley) if the statement now points successfully to the next row.
* - [DbResult.BE_SQLITE_DONE]($core-bentley) if the statement has no more rows.
* - Error status in case of errors.
*
* For **ECSQL INSERT, UPDATE, DELETE** statements the method returns
* - [DbResult.BE_SQLITE_DONE]($core-bentley) if the statement has been executed successfully.
* - Error status in case of errors.
*
* > Insert statements can be used with ECDb only, not with IModelDb.
*
* See also: [Code Samples]($docs/learning/backend/ECSQLCodeExamples)
*/
step(): DbResult;
/** @internal added this back in for testing purposes */
stepAsync(): Promise<DbResult>;
/** Step this INSERT statement and returns status and the ECInstanceId of the newly
* created instance.
*
* > Insert statements can be used with ECDb only, not with IModelDb.
*
* @returns Returns the generated ECInstanceId in case of success and the status of the step
* call. In case of error, the respective error code is returned.
*/
stepForInsert(): ECSqlInsertResult;
/** Get the query result's column count (only for ECSQL SELECT statements). */
getColumnCount(): number;
/** Get the current row.
* The returned row is formatted as JavaScript object where every SELECT clause item becomes a property in the JavaScript object.
*
* See also:
* - [ECSQL row format]($docs/learning/ECSQLRowFormat) for details about the format of the returned row.
* - [Code Samples]($docs/learning/backend/ECSQLCodeExamples#working-with-the-query-result)
*/
getRow(args?: ECSqlRowArg): any;
private formatCurrentRow;
/** Calls step when called as an iterator.
*
* Each iteration returns an [ECSQL row format]($docs/learning/ECSQLRowFormat) as returned
* from [ECSqlStatement.getRow]($backend).
*/
next(): IteratorResult<any>;
/** The iterator that will step through the results of this statement. */
[Symbol.iterator](): IterableIterator<any>;
/** Get the value for the column at the given index in the query result.
* @param columnIx Index of ECSQL column in query result (0-based)
*
* See also: [Code Samples]($docs/learning/backend/ECSQLCodeExamples#working-with-the-query-result)
*/
getValue(columnIx: number): ECSqlValue;
}
/** Executes ECSQL INSERT/UPDATE/DELETE statements.
*
* A statement must be prepared before it can be executed, and it must be released when no longer needed.
* See [ECDb.withCachedWriteStatement]($backend) for a convenient and
* reliable way to prepare, execute, and then release a statement.
*
* A statement may contain parameters that must be filled in before use by the **bind** methods.
*
* Once prepared (and parameters are bound, if any), the statement is executed by calling [ECSqlStatement.stepForInsert]($backend).
*
* > Preparing a statement can be time-consuming. The best way to reduce the effect of this overhead is to cache and reuse prepared
* > statements. A cached prepared statement may be used in different places in an app, as long as the statement is general enough.
* > The key to making this strategy work is to phrase a statement in a general way and use placeholders to represent parameters that will vary on each use.
*
* See also
* - [Executing ECSQL]($docs/learning/backend/ExecutingECSQL) provides more background on ECSQL and an introduction on how to execute ECSQL with the iTwin.js API.
* - [Code Examples]($docs/learning/backend/ECSQLCodeExamples) illustrate the use of the iTwin.js API for executing and working with ECSQL
* @public
*/
export declare class ECSqlWriteStatement {
private _stmt;
constructor(stmt?: ECSqlStatement);
get sql(): string;
/** Check if this statement has been prepared successfully or not */
get isPrepared(): boolean;
/** Get the underlying ECSqlStatement. Needed until we remove ECSqlStatement.
* @param
* @internal
*/
get stmt(): ECSqlStatement;
/** Prepare this statement prior to first use.
* @param db The ECDb to prepare the statement against
* @param ecsql The ECSQL statement string to prepare
* @param logErrors Determine if errors are logged or not
* @throws [IModelError]($common) if the ECSQL statement cannot be prepared. Normally, prepare fails due to ECSQL syntax errors or references to tables or properties that do not exist.
* The error.message property will provide details.
* @internal
*/
prepare(db: IModelJsNative.ECDb, ecsql: string, logErrors?: boolean): void;
/** Prepare this statement prior to first use.
* @param db The DgnDb or ECDb to prepare the statement against
* @param ecsql The ECSQL statement string to prepare
* @param logErrors Determine if errors are logged or not, its set to false by default for tryPrepare()
* @returns An object with a `status` member equal to [DbResult.BE_SQLITE_OK]($bentley) on success. Upon error, the `message` member will provide details.
* @internal
*/
tryPrepare(db: IModelJsNative.DgnDb | IModelJsNative.ECDb, ecsql: string, logErrors?: boolean): {
status: DbResult;
message: string;
};
/** Reset this statement so that the next call to step will return the first row, if any. */
reset(): void;
/**
* Releases the native resources held by this ECSqlWriteStatement.
*
* This method should be called when the statement is no longer needed to free up native resources.
*
* > Do not call this method directly on a statement that is being managed by a statement cache.
*/
[Symbol.dispose](): void;
/** Get the Native SQL statement
* @internal
*/
getNativeSql(): string;
/** Binds the specified value to the specified ECSQL parameter.
* The section "[iTwin.js Types used in ECSQL Parameter Bindings]($docs/learning/ECSQLParameterTypes)" describes the
* iTwin.js types to be used for the different ECSQL parameter types.
* @param parameter Index (1-based) or name of the parameter
*/
bindValue(parameter: number | string, val: any): void;
/** Binds null to the specified ECSQL parameter.
* @param parameter Index (1-based) or name of the parameter
*/
bindNull(parameter: number | string): void;
/** Binds a BLOB value to the specified ECSQL parameter.
* @param parameter Index (1-based) or name of the parameter
* @param BLOB value as either a Uint8Array, ArrayBuffer or a Base64 string
*/
bindBlob(parameter: number | string, blob: string | Uint8Array | ArrayBuffer | SharedArrayBuffer): void;
/** Binds a boolean value to the specified ECSQL parameter.
* @param parameter Index (1-based) or name of the parameter
* @param val Boolean value
*/
bindBoolean(parameter: number | string, val: boolean): void;
/** Binds a DateTime value to the specified ECSQL parameter.
* @param parameter Index (1-based) or name of the parameter
* @param isoDateTimeString DateTime value as ISO8601 string
*/
bindDateTime(parameter: number | string, isoDateTimeString: string): void;
/** Binds a double value to the specified ECSQL parameter.
* @param parameter Index (1-based) or name of the parameter
* @param val Double value
*/
bindDouble(parameter: number | string, val: number): void;
/** Binds an GUID value to the specified ECSQL parameter.
* @param parameter Index (1-based) or name of the parameter
* @param val GUID value
*/
bindGuid(parameter: number | string, val: GuidString): void;
/** Binds an Id value to the specified ECSQL parameter.
* @param parameter Index (1-based) or name of the parameter
* @param val Id value
*/
bindId(parameter: number | string, val: Id64String): void;
/** Binds an integer value to the specified ECSQL parameter.
* @param parameter Index (1-based) or name of the parameter
* @param val Integer value as number, decimal string or hexadecimal string.
*/
bindInteger(parameter: number | string, val: number | string): void;
/** Binds an Point2d value to the specified ECSQL parameter.
* @param parameter Index (1-based) or name of the parameter
* @param val Point2d value
*/
bindPoint2d(parameter: number | string, val: XAndY): void;
/** Binds an Point3d value to the specified ECSQL parameter.
* @param parameter Index (1-based) or name of the parameter
* @param val Point3d value
*/
bindPoint3d(parameter: number | string, val: XYAndZ): void;
/** Binds a Range3d as a blob to the specified ECSQL parameter
* @param parameter Index(1-based) or name of the parameter
* @param val Range3d value
*/
bindRange3d(parameter: number | string, val: LowAndHighXYZ): void;
/** Binds an string to the specified ECSQL parameter.
* @param parameter Index (1-based) or name of the parameter
* @param val String value
*/
bindString(parameter: number | string, val: string): void;
/** Binds a navigation property value to the specified ECSQL parameter.
* @param parameter Index (1-based) or name of the parameter
* @param val Navigation property value
*/
bindNavigation(parameter: number | string, val: NavigationBindingValue): void;
/** Binds a struct property value to the specified ECSQL parameter.
* @param parameter Index (1-based) or name of the parameter
* @param val Struct value. The struct value is an object composed of pairs of a struct member property name and its value
* (of one of the supported types)
*/
bindStruct(parameter: number | string, val: object): void;
/** Binds an array value to the specified ECSQL parameter.
* @param parameter Index (1-based) or name of the parameter
* @param val Array value. The array value is an array of values of the supported types
*/
bindArray(parameter: number | string, val: any[]): void;
bindIdSet(parameter: number | string, val: Id64String[]): void;
/**
* Gets a binder to bind a value for an ECSQL parameter
* > This is the most low-level API to bind a value to a specific parameter. Alternatively you can use the ECSqlStatement.bindXX methods
* > or [ECSqlStatement.bindValues]($backend).
* @param parameter Index (1-based) or name of the parameter
*/
getBinder(parameter: string | number): ECSqlBinder;
/** Bind values to all parameters in the statement.
* @param values The values to bind to the parameters.
* Pass an *array* of values if the parameters are *positional*.
* Pass an *object of the values keyed on the parameter name* for *named parameters*.
* The values in either the array or object must match the respective types of the parameter.
*
* The section "[iTwin.js Types used in ECSQL Parameter Bindings]($docs/learning/ECSQLParameterTypes)" describes the
* iTwin.js types to be used for the different ECSQL parameter types.
*
* See also these [Code Samples]($docs/learning/backend/ECSQLCodeExamples#binding-to-all-parameters-at-once)
*/
bindValues(values: any[] | object): void;
/** Clear any bindings that were previously set on this statement.
* @throws [IModelError]($common) in case of errors
*/
clearBindings(): void;
/** Step this INSERT statement and returns status and the ECInstanceId of the newly
* created instance.
*
* > Insert statements can be used with ECDb only, not with IModelDb.
*
* @returns Returns the generated ECInstanceId in case of success and the status of the step
* call. In case of error, the respective error code is returned.
*/
stepForInsert(): ECSqlInsertResult;
step(): DbResult;
/** Get the query result's column count (only for ECSQL SELECT statements). */
getColumnCount(): number;
}
/** Binds a value to an ECSQL parameter.
*
* See also:
*
* - [ECSqlStatement]($backend)
* - [ECSqlStatement.getBinder]($backend)
* - [Executing ECSQL]($docs/learning/backend/ExecutingECSQL)
* @public
*/
export declare class ECSqlBinder {
private _binder;
/** @internal */
constructor(binder: IModelJsNative.ECSqlBinder);
/** Binds the specified value to the ECSQL parameter.
* The section "[iTwin.js Types used in ECSQL Parameter Bindings]($docs/learning/ECSQLParameterTypes)" describes the
* iTwin.js types to be used for the different ECSQL parameter types.
* @param val Value to bind
*/
bind(val: any): void;
/** Binds null to the ECSQL parameter. */
bindNull(): void;
/** Binds a BLOB value to the ECSQL parameter.
* @param BLOB value as either a UInt8Array, ArrayBuffer or a Base64 string
*/
bindBlob(blob: string | Uint8Array | ArrayBuffer | SharedArrayBuffer): void;
/** Binds a boolean value to the ECSQL parameter.
* @param val Boolean value
*/
bindBoolean(val: boolean): void;
/** Binds a DateTime value to the ECSQL parameter.
* @param isoDateTimeString DateTime value as ISO8601 string
*/
bindDateTime(isoDateTimeString: string): void;
/** Binds a double value to the ECSQL parameter.
* @param val Double value
*/
bindDouble(val: number): void;
/** Binds an GUID value to the ECSQL parameter.
* @param val GUID value. If passed as string, it must be formatted as described in [GuidString]($core-bentley).
*/
bindGuid(val: GuidString): void;
/** Binds an Id value to the ECSQL parameter.
* @param val Id value. If passed as string it must be the hexadecimal representation of the Id.
*/
bindId(val: Id64String): void;
/** Binds an integer value to the ECSQL parameter.
* @param val Integer value as number, decimal string or hexadecimal string.
*/
bindInteger(val: number | string): void;
/** Binds an Point2d value to the ECSQL parameter.
* @param val Point2d value
*/
bindPoint2d(val: XAndY): void;
/** Binds an Point3d value to the ECSQL parameter.
* @param val Point3d value
*/
bindPoint3d(val: XYAndZ): void;
/** Binds a Range3d as a blob to the ECSQL parameter.
* @param val Range3d value
*/
bindRange3d(val: LowAndHighXYZ): void;
/** Binds an string to the ECSQL parameter.
* @param val String value
*/
bindString(val: string): void;
/** Binds a navigation property value to the ECSQL parameter.
* @param val Navigation property value
*/
bindNavigation(val: NavigationBindingValue): void;
/** Binds a struct property value to the ECSQL parameter.
* @param val Struct value. The struct value is an object composed of pairs of a struct member property name and its value
* (of one of the supported types)
*/
bindStruct(val: object): void;
/** Gets the binder for the specified member of a struct parameter
*
* > This is the most low-level way to bind struct parameters with most flexibility. A simpler alternative is
* > to just call [ECSqlBinder.bindStruct]($backend).
*/
bindMember(memberName: string): ECSqlBinder;
/** Binds a set of Id strings to the ECSQL parameter.
* @param val array of Id values. If passed as string they must be the hexadecimal representation of the Ids.
*/
bindIdSet(vector: Id64String[]): void;
/** Binds an array value to the ECSQL parameter.
* @param val Array value. The array value is an array of values of the supported types
*/
bindArray(val: any[]): void;
/** Adds a new array element to the array parameter and returns the binder for the new array element
*
* > This is the most low-level way to bind array parameters with most flexibility. A simpler alternative is
* > to just call [ECSqlBinder.bindArray]($backend).
*/
addArrayElement(): ECSqlBinder;
}
/** Represents the value of an ECEnumeration.
*
* See also:
* - [[ECSqlValue.getEnum]]
* - [[ECSqlStatement]]
* - [[ECSqlStatement.getValue]]
* - [Code Samples]($docs/learning/backend/ECSQLCodeExamples#working-with-the-query-result)
* @public
* @deprecated in 4.11 - will not be removed until after 2026-06-13. Use [IModelDb.createQueryReader]($backend) or [ECDb.createQueryReader]($backend) instead.
*/
export interface ECEnumValue {
schema: string;
name: string;
key: string;
value: number | string;
}
/** Value of a column in a row of an ECSQL query result.
*
* See also:
* - [ECSqlStatement]($backend)
* - [ECSqlStatement.getValue]($backend)
* - [Code Samples]($docs/learning/backend/ECSQLCodeExamples#working-with-the-query-result)
* @public
* @deprecated in 4.11 - will not be removed until after 2026-06-13. Use [IModelDb.createQueryReader]($backend) or [ECDb.createQueryReader]($backend) instead.
*/
export declare class ECSqlValue {
private _val;
/** @internal */
constructor(val: IModelJsNative.ECSqlValue);
/** Get information about the query result's column this value refers to. */
get columnInfo(): ECSqlColumnInfo;
/** Get the value of this ECSQL value */
get value(): any;
/** Indicates whether the value is NULL or not. */
get isNull(): boolean;
/** Get the value as BLOB */
getBlob(): Uint8Array;
/** Get the value as a boolean value */
getBoolean(): boolean;
/** Get the value as a DateTime value (formatted as ISO8601 string) */
getDateTime(): string;
/** Get the value as a double value */
getDouble(): number;
/** Get the value as a IGeometry value (as ECJSON IGeometry) */
getGeometry(): any;
/** Get the value as a GUID (formatted as GUID string).
* See [GuidString]($core-bentley)
*/
getGuid(): GuidString;
/** Get the value as a Id (formatted as hexadecimal string). */
getId(): Id64String;
/** Get the ClassId value formatted as fully qualified class name. */
getClassNameForClassId(): string;
/** Get the value as a integer value */
getInteger(): number;
/** Get the value as a string value */
getString(): string;
/** Get the value as [XAndY]($core-geometry) */
getXAndY(): XAndY;
/** Get the value as [XYAndZ]($core-geometry) */
getXYAndZ(): XYAndZ;
/** Get the value as ECEnumeration value
* Note: This method is optional. Using [[ECSqlValue.getInteger]] for integral enums and
* [[ECSqlValue.getString]] for string enums respectively are the usual way to get
* enum values. This method can be used if the context of the underlying ECEnumeration
* is required.
* The value is broken down into the ECEnumerators that make it up, if the value
* is a combination of ECEnumerators. If the value is not a strict match of an ECEnumerator
* or a combination of them, undefined is returned.
* > Note: You can call [[ECSqlValue.columnInfo.isEnum]] to find out whether
* > this method can be called or not.
* @return ECEnumeration value(s) or undefined if the ECSqlValue does not represent an ECEnumeration.
* or is not a strict match of an ECEnumerator or a combination of them.
*/
getEnum(): ECEnumValue[] | undefined;
/** Get the value as [NavigationValue]($common) */
getNavigation(): NavigationValue;
/** Get an iterator for iterating the struct members of this struct value. */
getStructIterator(): ECSqlValueIterator;
/** Get this struct value's content as object literal */
getStruct(): any;
/** Get an iterator for iterating the array elements of this array value. */
getArrayIterator(): ECSqlValueIterator;
/** Get this array value as JavaScript array */
getArray(): any[];
}
/** Iterator over members of a struct [ECSqlValue]($backend) or the elements of an array [ECSqlValue]($backend).
* See [ECSqlValue.getStructIterator]($backend) or [ECSqlValue.getArrayIterator]($backend).
* @public
* @deprecated in 4.11 - will not be removed until after 2026-06-13. Use [IModelDb.createQueryReader]($backend) or [ECDb.createQueryReader]($backend) instead.
*/
export declare class ECSqlValueIterator implements IterableIterator<ECSqlValue> {
private _it;
/** @internal */
constructor(it: IModelJsNative.ECSqlValueIterator);
next(): IteratorResult<ECSqlValue>;
[Symbol.iterator](): IterableIterator<ECSqlValue>;
}
/** Information about an ECSQL column in an ECSQL query result.
* See [ECSqlValue.columnInfo]($backend), [ECSqlStatement.getValue]($backend), [ECSqlStatement]($backend)
* @public
* @deprecated in 4.11 - will not be removed until after 2026-06-13. Use [IModelDb.createQueryReader]($backend) or [ECDb.createQueryReader]($backend) instead.
*/
export interface ECSqlColumnInfo {
/** Gets the data type of the column.
*/
getType(): ECSqlValueType;
/** Gets the name of the property backing the column.
* > If this column is backed by a generated property, i.e. it represents ECSQL expression,
* > the access string consists of the name of the generated property. [[ECSqlColumnInfo.getOriginPropertyName]]
* > can be used to obtain the non-aliased name in that case.
*/
getPropertyName(): string;
/** Gets the name of the original property that the column data is from.
* > Other than [[ECSqlColumnInfo.getPropertyName]], this ignores aliases and allows getting the name
* > of the property which is being used for the column. A column may not be backed
* > by a property, in which case this returns undefined.
*/
getOriginPropertyName(): string | undefined;
/** Gets the full access string to the corresponding ECSqlValue starting from the root class.
* > If this column is backed by a generated property, i.e. it represents ECSQL expression,
* > the access string consists of the ECSQL expression.
*/
getAccessString(): string;
/** Indicates whether the column refers to an ECEnumeration property. */
isEnum(): boolean;
/** Indicates whether the column refers to a system property (e.g. id, className). */
isSystemProperty(): boolean;
/** Indicates whether the column is backed by a generated property or not. For SELECT clause items that are expressions other
* than simply a reference to an ECProperty, a property is generated containing the expression name.
*/
isGeneratedProperty(): boolean;
/** Gets the table space in which this root class is persisted.
* > For classes in the primary file the table space is MAIN. For classes in attached
* > files, the table space is the name by which the file was attached. For generated properties the table space is empty.
*/
getRootClassTableSpace(): string;
/** Gets the fully qualified name of the ECClass of the top-level ECProperty backing this column. */
getRootClassName(): string;
/** Gets the class alias of the root class to which the column refers to.
* > Returns an empty string if no class alias was specified in the select clause.
*/
getRootClassAlias(): string;
}
//# sourceMappingURL=ECSqlStatement.d.ts.map