ECDb Class

An ECDb file

Implements

Methods

Name Description
constructor(): ECDb    
abandonChanges(): void Abandon (cancel) the outermost transaction, discarding all changes since last save.  
closeDb(): void Close the Db after saving any uncommitted changes.  
createDb(pathName: string): void Create an ECDb  
createQueryReader(ecsql: string, params?: QueryBinder, config?: QueryOptions): ECSqlReader Allow to execute query and read results along with meta data. Beta  
dispose(): void Call this function when finished with this ECDb object.  
importSchema(pathName: string): void Import a schema.  
openDb(pathName: string, openMode: ECDbOpenMode = ECDbOpenMode.Readonly): void Open the ECDb.  
prepareStatement(ecsql: string, logErrors: boolean = true): ECSqlStatement Prepare an ECSQL statement.  
query(ecsql: string, params?: QueryBinder, options?: QueryOptions): AsyncIterableIterator<any> Execute a query and stream its results Deprecated  
queryRowCount(ecsql: string, params?: QueryBinder): Promise<number> Compute number of rows that would be returned by the ECSQL. Deprecated  
restartQuery(token: string, ecsql: string, params?: QueryBinder, options?: QueryOptions): AsyncIterableIterator<any> Cancel any previous query with same token and run execute the current specified query. Deprecated  
saveChanges(changesetName?: string): void Commit the outermost transaction, writing changes to the file.  
withPreparedSqliteStatement<T>(sql: string, callback: (stmt: SqliteStatement) => T, logErrors: boolean = true): T Use a prepared SQL statement, potentially from the statement cache.  
withPreparedStatement<T>(ecsql: string, callback: (stmt: ECSqlStatement) => T, logErrors: boolean = true): T Use a prepared ECSQL statement, potentially from the statement cache.  
withSqliteStatement<T>(sql: string, callback: (stmt: SqliteStatement) => T, logErrors: boolean = true): T Prepared and execute a callback on a SQL statement.  
withStatement<T>(ecsql: string, callback: (stmt: ECSqlStatement) => T, logErrors: boolean = true): T Prepared and execute a callback on an ECSQL statement.  

Properties

Name Type Description
isOpen Accessor ReadOnly boolean Returns true if the ECDb is open  

Defined in

Last Updated: 20 June, 2023