@itwin/core-backend 5.0.0-dev.98 → 5.0.0-dev.99
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/ChangeSummaryManager.d.ts.map +1 -1
- package/lib/cjs/ChangeSummaryManager.js +12 -5
- package/lib/cjs/ChangeSummaryManager.js.map +1 -1
- package/lib/cjs/ChangesetECAdaptor.d.ts.map +1 -1
- package/lib/cjs/ChangesetECAdaptor.js +1 -0
- package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
- package/lib/cjs/ECDb.d.ts +37 -1
- package/lib/cjs/ECDb.d.ts.map +1 -1
- package/lib/cjs/ECDb.js +81 -0
- package/lib/cjs/ECDb.js.map +1 -1
- package/lib/cjs/ECSqlStatement.d.ts +181 -2
- package/lib/cjs/ECSqlStatement.d.ts.map +1 -1
- package/lib/cjs/ECSqlStatement.js +224 -5
- package/lib/cjs/ECSqlStatement.js.map +1 -1
- package/lib/cjs/ElementAspect.d.ts.map +1 -1
- package/lib/cjs/ElementAspect.js +1 -0
- package/lib/cjs/ElementAspect.js.map +1 -1
- package/lib/cjs/ElementTreeWalker.d.ts.map +1 -1
- package/lib/cjs/ElementTreeWalker.js +4 -0
- package/lib/cjs/ElementTreeWalker.js.map +1 -1
- package/lib/cjs/IModelDb.d.ts +4 -0
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +29 -1
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/Relationship.d.ts.map +1 -1
- package/lib/cjs/Relationship.js +2 -0
- package/lib/cjs/Relationship.js.map +1 -1
- package/lib/cjs/ViewStore.d.ts.map +1 -1
- package/lib/cjs/ViewStore.js +2 -1
- package/lib/cjs/ViewStore.js.map +1 -1
- package/lib/cjs/internal/ChannelAdmin.d.ts.map +1 -1
- package/lib/cjs/internal/ChannelAdmin.js +2 -0
- package/lib/cjs/internal/ChannelAdmin.js.map +1 -1
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts.map +1 -1
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +1 -0
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
- package/lib/esm/ChangeSummaryManager.d.ts.map +1 -1
- package/lib/esm/ChangeSummaryManager.js +12 -5
- package/lib/esm/ChangeSummaryManager.js.map +1 -1
- package/lib/esm/ChangesetECAdaptor.d.ts.map +1 -1
- package/lib/esm/ChangesetECAdaptor.js +1 -0
- package/lib/esm/ChangesetECAdaptor.js.map +1 -1
- package/lib/esm/ECDb.d.ts +37 -1
- package/lib/esm/ECDb.d.ts.map +1 -1
- package/lib/esm/ECDb.js +82 -1
- package/lib/esm/ECDb.js.map +1 -1
- package/lib/esm/ECSqlStatement.d.ts +181 -2
- package/lib/esm/ECSqlStatement.d.ts.map +1 -1
- package/lib/esm/ECSqlStatement.js +222 -4
- package/lib/esm/ECSqlStatement.js.map +1 -1
- package/lib/esm/ElementAspect.d.ts.map +1 -1
- package/lib/esm/ElementAspect.js +1 -0
- package/lib/esm/ElementAspect.js.map +1 -1
- package/lib/esm/ElementTreeWalker.d.ts.map +1 -1
- package/lib/esm/ElementTreeWalker.js +4 -0
- package/lib/esm/ElementTreeWalker.js.map +1 -1
- package/lib/esm/IModelDb.d.ts +4 -0
- package/lib/esm/IModelDb.d.ts.map +1 -1
- package/lib/esm/IModelDb.js +29 -1
- package/lib/esm/IModelDb.js.map +1 -1
- package/lib/esm/Relationship.d.ts.map +1 -1
- package/lib/esm/Relationship.js +2 -0
- package/lib/esm/Relationship.js.map +1 -1
- package/lib/esm/ViewStore.d.ts.map +1 -1
- package/lib/esm/ViewStore.js +2 -1
- package/lib/esm/ViewStore.js.map +1 -1
- package/lib/esm/internal/ChannelAdmin.d.ts.map +1 -1
- package/lib/esm/internal/ChannelAdmin.js +2 -0
- package/lib/esm/internal/ChannelAdmin.js.map +1 -1
- package/lib/esm/rpc-impl/IModelReadRpcImpl.d.ts.map +1 -1
- package/lib/esm/rpc-impl/IModelReadRpcImpl.js +1 -0
- package/lib/esm/rpc-impl/IModelReadRpcImpl.js.map +1 -1
- package/lib/esm/test/IModelTestUtils.d.ts.map +1 -1
- package/lib/esm/test/IModelTestUtils.js +10 -0
- package/lib/esm/test/IModelTestUtils.js.map +1 -1
- package/lib/esm/test/PrintElementTree.js +1 -0
- package/lib/esm/test/PrintElementTree.js.map +1 -1
- package/lib/esm/test/SchemaUtils.test.js +2 -0
- package/lib/esm/test/SchemaUtils.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECDb.test.js +12 -1
- package/lib/esm/test/ecdb/ECDb.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECSqlAst.test.js +1 -0
- package/lib/esm/test/ecdb/ECSqlAst.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECSqlQuery.test.js +6 -0
- package/lib/esm/test/ecdb/ECSqlQuery.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECSqlReader.test.js +1 -1
- package/lib/esm/test/ecdb/ECSqlReader.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECSqlStatement.test.js +253 -163
- package/lib/esm/test/ecdb/ECSqlStatement.test.js.map +1 -1
- package/lib/esm/test/ecdb/SqliteStatement.test.js +2 -0
- package/lib/esm/test/ecdb/SqliteStatement.test.js.map +1 -1
- package/lib/esm/test/ecsql/src/ECSqlTestGenerator.js +1 -0
- package/lib/esm/test/ecsql/src/ECSqlTestGenerator.js.map +1 -1
- package/lib/esm/test/ecsql/src/ECSqlTestRunner.test.js +5 -1
- package/lib/esm/test/ecsql/src/ECSqlTestRunner.test.js.map +1 -1
- package/lib/esm/test/element/ElementRoundTrip.test.js +10 -0
- package/lib/esm/test/element/ElementRoundTrip.test.js.map +1 -1
- package/lib/esm/test/imodel/ElementTreeWalker.test.js +1 -0
- package/lib/esm/test/imodel/ElementTreeWalker.test.js.map +1 -1
- package/lib/esm/test/imodel/IModel.test.js +14 -0
- package/lib/esm/test/imodel/IModel.test.js.map +1 -1
- package/lib/esm/test/schema/GenericDomain.test.js +1 -0
- package/lib/esm/test/schema/GenericDomain.test.js.map +1 -1
- package/lib/esm/test/standalone/ChangesetReader.test.js +1 -0
- package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
- package/lib/esm/test/standalone/IModelWrite.test.js +7 -0
- package/lib/esm/test/standalone/IModelWrite.test.js.map +1 -1
- package/lib/esm/test/standalone/RenderMaterialElement.test.js +1 -0
- package/lib/esm/test/standalone/RenderMaterialElement.test.js.map +1 -1
- package/package.json +12 -12
package/lib/cjs/ECDb.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IModelJsNative } from "@bentley/imodeljs-native";
|
|
2
2
|
import { ECSchemaProps, ECSqlReader, QueryBinder, QueryOptions } from "@itwin/core-common";
|
|
3
|
-
import { ECSqlStatement } from "./ECSqlStatement";
|
|
3
|
+
import { ECSqlStatement, ECSqlWriteStatement } from "./ECSqlStatement";
|
|
4
4
|
import { SqliteStatement } from "./SqliteStatement";
|
|
5
5
|
import { _nativeDb } from "./internal/Symbols";
|
|
6
6
|
/** Modes for how to open [ECDb]($backend) files.
|
|
@@ -87,6 +87,39 @@ export declare class ECDb implements Disposable {
|
|
|
87
87
|
* @throws if the schema can not be found or loaded.
|
|
88
88
|
*/
|
|
89
89
|
getSchemaProps(name: string): ECSchemaProps;
|
|
90
|
+
/**
|
|
91
|
+
* Use a prepared ECSQL statement, potentially from the statement cache. If the requested statement doesn't exist
|
|
92
|
+
* in the statement cache, a new statement is prepared. After the callback completes, the statement is reset and saved
|
|
93
|
+
* in the statement cache so it can be reused in the future. Use this method for ECSQL statements that will be
|
|
94
|
+
* reused often and are expensive to prepare. The statement cache holds the most recently used statements, discarding
|
|
95
|
+
* the oldest statements as it fills. For statements you don't intend to reuse, instead use [[withStatement]].
|
|
96
|
+
* @param sql The SQLite SQL statement to execute
|
|
97
|
+
* @param callback the callback to invoke on the prepared statement
|
|
98
|
+
* @param logErrors Determines if error will be logged if statement fail to prepare
|
|
99
|
+
* @returns the value returned by `callback`.
|
|
100
|
+
* @see [[withWriteStatement]]
|
|
101
|
+
* @beta
|
|
102
|
+
*/
|
|
103
|
+
withCachedWriteStatement<T>(ecsql: string, callback: (stmt: ECSqlWriteStatement) => T, logErrors?: boolean): T;
|
|
104
|
+
/**
|
|
105
|
+
* Prepared and execute a callback on an ECSQL statement. After the callback completes the statement is disposed.
|
|
106
|
+
* Use this method for ECSQL statements are either not expected to be reused, or are not expensive to prepare.
|
|
107
|
+
* For statements that will be reused often, instead use [[withPreparedStatement]].
|
|
108
|
+
* @param sql The SQLite SQL statement to execute
|
|
109
|
+
* @param callback the callback to invoke on the prepared statement
|
|
110
|
+
* @param logErrors Determines if error will be logged if statement fail to prepare
|
|
111
|
+
* @returns the value returned by `callback`.
|
|
112
|
+
* @see [[withCachedWriteStatement]]
|
|
113
|
+
* @beta
|
|
114
|
+
*/
|
|
115
|
+
withWriteStatement<T>(ecsql: string, callback: (stmt: ECSqlWriteStatement) => T, logErrors?: boolean): T;
|
|
116
|
+
/** Prepare an ECSQL statement.
|
|
117
|
+
* @param ecsql The ECSQL statement to prepare
|
|
118
|
+
* @param logErrors Determines if error will be logged if statement fail to prepare
|
|
119
|
+
* @throws [IModelError]($common) if there is a problem preparing the statement.
|
|
120
|
+
* @beta
|
|
121
|
+
*/
|
|
122
|
+
prepareWriteStatement(ecsql: string, logErrors?: boolean): ECSqlWriteStatement;
|
|
90
123
|
/**
|
|
91
124
|
* Use a prepared ECSQL statement, potentially from the statement cache. If the requested statement doesn't exist
|
|
92
125
|
* in the statement cache, a new statement is prepared. After the callback completes, the statement is reset and saved
|
|
@@ -99,6 +132,7 @@ export declare class ECDb implements Disposable {
|
|
|
99
132
|
* @returns the value returned by `callback`.
|
|
100
133
|
* @see [[withStatement]]
|
|
101
134
|
* @public
|
|
135
|
+
* @deprecated in 4.11. Use [[createQueryReader]] for SELECT statements and [[withCachedWriteStatement]] for INSERT/UPDATE/DELETE instead.
|
|
102
136
|
*/
|
|
103
137
|
withPreparedStatement<T>(ecsql: string, callback: (stmt: ECSqlStatement) => T, logErrors?: boolean): T;
|
|
104
138
|
/**
|
|
@@ -111,12 +145,14 @@ export declare class ECDb implements Disposable {
|
|
|
111
145
|
* @returns the value returned by `callback`.
|
|
112
146
|
* @see [[withPreparedStatement]]
|
|
113
147
|
* @public
|
|
148
|
+
* @deprecated in 4.11. Use [[createQueryReader]] for SELECT statements and [[withWriteStatement]] for INSERT/UPDATE/DELETE instead.
|
|
114
149
|
*/
|
|
115
150
|
withStatement<T>(ecsql: string, callback: (stmt: ECSqlStatement) => T, logErrors?: boolean): T;
|
|
116
151
|
/** Prepare an ECSQL statement.
|
|
117
152
|
* @param ecsql The ECSQL statement to prepare
|
|
118
153
|
* @param logErrors Determines if error will be logged if statement fail to prepare
|
|
119
154
|
* @throws [IModelError]($common) if there is a problem preparing the statement.
|
|
155
|
+
* @deprecated in 4.11. Use [[prepareWriteStatement]] when preparing an INSERT/UPDATE/DELETE statement or [[createQueryReader]] to execute a SELECT statement.
|
|
120
156
|
*/
|
|
121
157
|
prepareStatement(ecsql: string, logErrors?: boolean): ECSqlStatement;
|
|
122
158
|
/**
|
package/lib/cjs/ECDb.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ECDb.d.ts","sourceRoot":"","sources":["../../src/ECDb.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAkB,aAAa,EAAE,WAAW,EAAe,WAAW,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGxH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"ECDb.d.ts","sourceRoot":"","sources":["../../src/ECDb.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAkB,aAAa,EAAE,WAAW,EAAe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AO,GAAG,CAAC;IAiBvG;;;;;OAKG;IACI,sBAAsB,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,UAAO,GAAG,eAAe;IAM7E,gBAAgB;IAChB,IAAW,CAAC,SAAS,CAAC,IAAI,cAAc,CAAC,IAAI,CAG5C;IAED;;;;;;;;;;;SAWK;IACE,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,WAAW;CAWlG"}
|
package/lib/cjs/ECDb.js
CHANGED
|
@@ -32,6 +32,7 @@ var ECDbOpenMode;
|
|
|
32
32
|
*/
|
|
33
33
|
class ECDb {
|
|
34
34
|
_nativeDb;
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
35
36
|
_statementCache = new SqliteStatement_1.StatementCache();
|
|
36
37
|
_sqliteStatementCache = new SqliteStatement_1.StatementCache();
|
|
37
38
|
/** only for tests
|
|
@@ -160,6 +161,77 @@ class ECDb {
|
|
|
160
161
|
getSchemaProps(name) {
|
|
161
162
|
return this[Symbols_1._nativeDb].getSchemaProps(name);
|
|
162
163
|
}
|
|
164
|
+
/**
|
|
165
|
+
* Use a prepared ECSQL statement, potentially from the statement cache. If the requested statement doesn't exist
|
|
166
|
+
* in the statement cache, a new statement is prepared. After the callback completes, the statement is reset and saved
|
|
167
|
+
* in the statement cache so it can be reused in the future. Use this method for ECSQL statements that will be
|
|
168
|
+
* reused often and are expensive to prepare. The statement cache holds the most recently used statements, discarding
|
|
169
|
+
* the oldest statements as it fills. For statements you don't intend to reuse, instead use [[withStatement]].
|
|
170
|
+
* @param sql The SQLite SQL statement to execute
|
|
171
|
+
* @param callback the callback to invoke on the prepared statement
|
|
172
|
+
* @param logErrors Determines if error will be logged if statement fail to prepare
|
|
173
|
+
* @returns the value returned by `callback`.
|
|
174
|
+
* @see [[withWriteStatement]]
|
|
175
|
+
* @beta
|
|
176
|
+
*/
|
|
177
|
+
withCachedWriteStatement(ecsql, callback, logErrors = true) {
|
|
178
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
179
|
+
const stmt = this._statementCache.findAndRemove(ecsql) ?? this.prepareStatement(ecsql, logErrors);
|
|
180
|
+
const release = () => this._statementCache.addOrDispose(stmt);
|
|
181
|
+
try {
|
|
182
|
+
const val = callback(new ECSqlStatement_1.ECSqlWriteStatement(stmt));
|
|
183
|
+
if (val instanceof Promise) {
|
|
184
|
+
val.then(release, release);
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
release();
|
|
188
|
+
}
|
|
189
|
+
return val;
|
|
190
|
+
}
|
|
191
|
+
catch (err) {
|
|
192
|
+
release();
|
|
193
|
+
throw err;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Prepared and execute a callback on an ECSQL statement. After the callback completes the statement is disposed.
|
|
198
|
+
* Use this method for ECSQL statements are either not expected to be reused, or are not expensive to prepare.
|
|
199
|
+
* For statements that will be reused often, instead use [[withPreparedStatement]].
|
|
200
|
+
* @param sql The SQLite SQL statement to execute
|
|
201
|
+
* @param callback the callback to invoke on the prepared statement
|
|
202
|
+
* @param logErrors Determines if error will be logged if statement fail to prepare
|
|
203
|
+
* @returns the value returned by `callback`.
|
|
204
|
+
* @see [[withCachedWriteStatement]]
|
|
205
|
+
* @beta
|
|
206
|
+
*/
|
|
207
|
+
withWriteStatement(ecsql, callback, logErrors = true) {
|
|
208
|
+
const stmt = this.prepareWriteStatement(ecsql, logErrors);
|
|
209
|
+
const release = () => { };
|
|
210
|
+
try {
|
|
211
|
+
const val = callback(stmt);
|
|
212
|
+
if (val instanceof Promise) {
|
|
213
|
+
val.then(release, release);
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
release();
|
|
217
|
+
}
|
|
218
|
+
return val;
|
|
219
|
+
}
|
|
220
|
+
catch (err) {
|
|
221
|
+
release();
|
|
222
|
+
throw err;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
/** Prepare an ECSQL statement.
|
|
226
|
+
* @param ecsql The ECSQL statement to prepare
|
|
227
|
+
* @param logErrors Determines if error will be logged if statement fail to prepare
|
|
228
|
+
* @throws [IModelError]($common) if there is a problem preparing the statement.
|
|
229
|
+
* @beta
|
|
230
|
+
*/
|
|
231
|
+
prepareWriteStatement(ecsql, logErrors = true) {
|
|
232
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
233
|
+
return new ECSqlStatement_1.ECSqlWriteStatement(this.prepareStatement(ecsql, logErrors));
|
|
234
|
+
}
|
|
163
235
|
/**
|
|
164
236
|
* Use a prepared ECSQL statement, potentially from the statement cache. If the requested statement doesn't exist
|
|
165
237
|
* in the statement cache, a new statement is prepared. After the callback completes, the statement is reset and saved
|
|
@@ -172,8 +244,11 @@ class ECDb {
|
|
|
172
244
|
* @returns the value returned by `callback`.
|
|
173
245
|
* @see [[withStatement]]
|
|
174
246
|
* @public
|
|
247
|
+
* @deprecated in 4.11. Use [[createQueryReader]] for SELECT statements and [[withCachedWriteStatement]] for INSERT/UPDATE/DELETE instead.
|
|
175
248
|
*/
|
|
249
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
176
250
|
withPreparedStatement(ecsql, callback, logErrors = true) {
|
|
251
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
177
252
|
const stmt = this._statementCache.findAndRemove(ecsql) ?? this.prepareStatement(ecsql, logErrors);
|
|
178
253
|
const release = () => this._statementCache.addOrDispose(stmt);
|
|
179
254
|
try {
|
|
@@ -201,8 +276,11 @@ class ECDb {
|
|
|
201
276
|
* @returns the value returned by `callback`.
|
|
202
277
|
* @see [[withPreparedStatement]]
|
|
203
278
|
* @public
|
|
279
|
+
* @deprecated in 4.11. Use [[createQueryReader]] for SELECT statements and [[withWriteStatement]] for INSERT/UPDATE/DELETE instead.
|
|
204
280
|
*/
|
|
281
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
205
282
|
withStatement(ecsql, callback, logErrors = true) {
|
|
283
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
206
284
|
const stmt = this.prepareStatement(ecsql, logErrors);
|
|
207
285
|
const release = () => stmt[Symbol.dispose]();
|
|
208
286
|
try {
|
|
@@ -224,8 +302,11 @@ class ECDb {
|
|
|
224
302
|
* @param ecsql The ECSQL statement to prepare
|
|
225
303
|
* @param logErrors Determines if error will be logged if statement fail to prepare
|
|
226
304
|
* @throws [IModelError]($common) if there is a problem preparing the statement.
|
|
305
|
+
* @deprecated in 4.11. Use [[prepareWriteStatement]] when preparing an INSERT/UPDATE/DELETE statement or [[createQueryReader]] to execute a SELECT statement.
|
|
227
306
|
*/
|
|
307
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
228
308
|
prepareStatement(ecsql, logErrors = true) {
|
|
309
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
229
310
|
const stmt = new ECSqlStatement_1.ECSqlStatement();
|
|
230
311
|
stmt.prepare(this[Symbols_1._nativeDb], ecsql, logErrors);
|
|
231
312
|
return stmt;
|
package/lib/cjs/ECDb.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ECDb.js","sourceRoot":"","sources":["../../src/ECDb.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,sDAAyE;AAEzE,oDAAwH;AACxH,mEAAgE;AAChE,uDAAoD;AACpD,qDAAkD;AAClD,8DAAyD;AACzD,uDAAoE;AACpE,gDAA+C;AAE/C,MAAM,cAAc,GAAW,6CAAqB,CAAC,IAAI,CAAC;AAE1D;;GAEG;AACH,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,uDAAQ,CAAA;IACR,yDAAS,CAAA;IACT,sGAAsG;IACtG,6DAAW,CAAA;AACb,CAAC,EALW,YAAY,4BAAZ,YAAY,QAKvB;AAED;;GAEG;AACH,MAAa,IAAI;IACP,SAAS,CAAuB;IACvB,eAAe,GAAG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AAS,CAAC,EAAE,OAAO,CAAC,CAAC;YACvE,CAAC;SACF,CAAC;QACF,OAAO,IAAI,yBAAW,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1D,CAAC;CACF;AAxTD,oBAwTC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module ECDb\n */\nimport { assert, DbResult, Logger, OpenMode } from \"@itwin/core-bentley\";\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\nimport { DbQueryRequest, ECSchemaProps, ECSqlReader, IModelError, QueryBinder, QueryOptions } from \"@itwin/core-common\";\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\nimport { ConcurrentQuery } from \"./ConcurrentQuery\";\nimport { ECSqlStatement } from \"./ECSqlStatement\";\nimport { IModelNative } from \"./internal/NativePlatform\";\nimport { SqliteStatement, StatementCache } from \"./SqliteStatement\";\nimport { _nativeDb } from \"./internal/Symbols\";\n\nconst loggerCategory: string = BackendLoggerCategory.ECDb;\n\n/** Modes for how to open [ECDb]($backend) files.\n * @public\n */\nexport enum ECDbOpenMode {\n Readonly,\n ReadWrite,\n /** Opens the file read-write and upgrades the file if necessary to the latest file format version. */\n FileUpgrade,\n}\n\n/** An ECDb file\n * @public\n */\nexport class ECDb implements Disposable {\n private _nativeDb?: IModelJsNative.ECDb;\n private readonly _statementCache = new StatementCache<ECSqlStatement>();\n private _sqliteStatementCache = new StatementCache<SqliteStatement>();\n\n /** only for tests\n * @internal\n */\n public resetSqliteCache(size: number) {\n this._sqliteStatementCache.clear();\n this._sqliteStatementCache = new StatementCache<SqliteStatement>(size);\n }\n\n constructor() {\n this._nativeDb = new IModelNative.platform.ECDb();\n }\n /** Call this function when finished with this ECDb object. This releases the native resources held by the\n * ECDb object.\n */\n public [Symbol.dispose](): void {\n if (!this._nativeDb)\n return;\n\n this.closeDb();\n this._nativeDb.dispose();\n this._nativeDb = undefined;\n }\n /**\n * Attach an iModel file to this connection and load and register its schemas.\n * @note There are some reserve tablespace names that cannot be used. They are 'main', 'schema_sync_db', 'ecchange' & 'temp'\n * @param fileName IModel file name\n * @param alias identifier for the attached file. This identifer is used to access schema from the attached file. e.g. if alias is 'abc' then schema can be accessed using 'abc.MySchema.MyClass'\n */\n public attachDb(fileName: string, alias: string): void {\n if (alias.toLowerCase() === \"main\" || alias.toLowerCase() === \"schema_sync_db\" || alias.toLowerCase() === \"ecchange\" || alias.toLowerCase() === \"temp\") {\n throw new IModelError(DbResult.BE_SQLITE_ERROR, \"Reserved tablespace name cannot be used\");\n }\n this[_nativeDb].attachDb(fileName, alias);\n }\n /**\n * Detach the attached file from this connection. The attached file is closed and its schemas are unregistered.\n * @note There are some reserve tablespace names that cannot be used. They are 'main', 'schema_sync_db', 'ecchange' & 'temp'\n * @param alias identifer that was used in the call to [[attachDb]]\n */\n public detachDb(alias: string): void {\n if (alias.toLowerCase() === \"main\" || alias.toLowerCase() === \"schema_sync_db\" || alias.toLowerCase() === \"ecchange\" || alias.toLowerCase() === \"temp\") {\n throw new IModelError(DbResult.BE_SQLITE_ERROR, \"Reserved tablespace name cannot be used\");\n }\n this.clearStatementCache();\n this[_nativeDb].detachDb(alias);\n }\n\n /** @deprecated in 5.0 Use [Symbol.dispose] instead. */\n public dispose(): void {\n this[Symbol.dispose]();\n }\n\n /** Create an ECDb\n * @param pathName The path to the ECDb file to create.\n * @throws [IModelError]($common) if the operation failed.\n */\n public createDb(pathName: string): void {\n const status: DbResult = this[_nativeDb].createDb(pathName);\n if (status !== DbResult.BE_SQLITE_OK)\n throw new IModelError(status, \"Failed to created ECDb\");\n }\n\n /** Open the ECDb.\n * @param pathName The path to the ECDb file to open\n * @param openMode Open mode\n * @throws [IModelError]($common) if the operation failed.\n */\n public openDb(pathName: string, openMode: ECDbOpenMode = ECDbOpenMode.Readonly): void {\n const nativeOpenMode: OpenMode = openMode === ECDbOpenMode.Readonly ? OpenMode.Readonly : OpenMode.ReadWrite;\n const tryUpgrade: boolean = openMode === ECDbOpenMode.FileUpgrade;\n const status: DbResult = this[_nativeDb].openDb(pathName, nativeOpenMode, tryUpgrade);\n if (status !== DbResult.BE_SQLITE_OK)\n throw new IModelError(status, \"Failed to open ECDb\");\n }\n\n /** Returns true if the ECDb is open */\n public get isOpen(): boolean { return this[_nativeDb].isOpen(); }\n\n /** Close the Db after saving any uncommitted changes.\n * @throws [IModelError]($common) if the database is not open.\n */\n public closeDb(): void {\n this._statementCache.clear();\n this._sqliteStatementCache.clear();\n this[_nativeDb].closeDb();\n }\n\n /** @internal use to test statement caching */\n public clearStatementCache() {\n this._statementCache.clear();\n }\n\n /** @internal use to test statement caching */\n public getCachedStatementCount() {\n return this._statementCache.size;\n }\n\n /** Commit the outermost transaction, writing changes to the file. Then, restart the transaction.\n * @param changesetName The name of the operation that generated these changes.\n * @throws [IModelError]($common) if the database is not open or if the operation failed.\n */\n public saveChanges(changesetName?: string): void {\n const status: DbResult = this[_nativeDb].saveChanges(changesetName);\n if (status !== DbResult.BE_SQLITE_OK)\n throw new IModelError(status, \"Failed to save changes\");\n }\n\n /** Abandon (cancel) the outermost transaction, discarding all changes since last save. Then, restart the transaction.\n * @throws [IModelError]($common) if the database is not open or if the operation failed.\n */\n public abandonChanges(): void {\n const status: DbResult = this[_nativeDb].abandonChanges();\n if (status !== DbResult.BE_SQLITE_OK)\n throw new IModelError(status, \"Failed to abandon changes\");\n }\n\n /** Import a schema.\n *\n * If the import was successful, the database is automatically saved to disk.\n * @param pathName Path to ECSchema XML file to import.\n * @throws [IModelError]($common) if the database is not open or if the operation failed.\n */\n public importSchema(pathName: string): void {\n const status: DbResult = this[_nativeDb].importSchema(pathName);\n if (status !== DbResult.BE_SQLITE_OK) {\n Logger.logError(loggerCategory, `Failed to import schema from '${pathName}'.`);\n throw new IModelError(status, `Failed to import schema from '${pathName}'.`);\n }\n }\n\n /**\n * Returns the full schema for the input name.\n * @param name The name of the schema e.g. 'ECDbMeta'\n * @returns The SchemaProps for the requested schema\n * @throws if the schema can not be found or loaded.\n */\n public getSchemaProps(name: string): ECSchemaProps {\n return this[_nativeDb].getSchemaProps(name);\n }\n\n /**\n * Use a prepared ECSQL statement, potentially from the statement cache. If the requested statement doesn't exist\n * in the statement cache, a new statement is prepared. After the callback completes, the statement is reset and saved\n * in the statement cache so it can be reused in the future. Use this method for ECSQL statements that will be\n * reused often and are expensive to prepare. The statement cache holds the most recently used statements, discarding\n * the oldest statements as it fills. For statements you don't intend to reuse, instead use [[withStatement]].\n * @param sql The SQLite SQL statement to execute\n * @param callback the callback to invoke on the prepared statement\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @returns the value returned by `callback`.\n * @see [[withStatement]]\n * @public\n */\n public withPreparedStatement<T>(ecsql: string, callback: (stmt: ECSqlStatement) => T, logErrors = true): T {\n const stmt = this._statementCache.findAndRemove(ecsql) ?? this.prepareStatement(ecsql, logErrors);\n const release = () => this._statementCache.addOrDispose(stmt);\n try {\n const val = callback(stmt);\n if (val instanceof Promise) {\n val.then(release, release);\n } else {\n release();\n }\n return val;\n } catch (err) {\n release();\n throw err;\n }\n }\n\n /**\n * Prepared and execute a callback on an ECSQL statement. After the callback completes the statement is disposed.\n * Use this method for ECSQL statements are either not expected to be reused, or are not expensive to prepare.\n * For statements that will be reused often, instead use [[withPreparedStatement]].\n * @param sql The SQLite SQL statement to execute\n * @param callback the callback to invoke on the prepared statement\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @returns the value returned by `callback`.\n * @see [[withPreparedStatement]]\n * @public\n */\n public withStatement<T>(ecsql: string, callback: (stmt: ECSqlStatement) => T, logErrors = true): T {\n const stmt = this.prepareStatement(ecsql, logErrors);\n const release = () => stmt[Symbol.dispose]();\n try {\n const val = callback(stmt);\n if (val instanceof Promise) {\n val.then(release, release);\n } else {\n release();\n }\n return val;\n } catch (err) {\n release();\n throw err;\n }\n }\n\n /** Prepare an ECSQL statement.\n * @param ecsql The ECSQL statement to prepare\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @throws [IModelError]($common) if there is a problem preparing the statement.\n */\n public prepareStatement(ecsql: string, logErrors = true): ECSqlStatement {\n const stmt = new ECSqlStatement();\n stmt.prepare(this[_nativeDb], ecsql, logErrors);\n return stmt;\n }\n\n /**\n * Use a prepared SQL statement, potentially from the statement cache. If the requested statement doesn't exist\n * in the statement cache, a new statement is prepared. After the callback completes, the statement is reset and saved\n * in the statement cache so it can be reused in the future. Use this method for SQL statements that will be\n * reused often and are expensive to prepare. The statement cache holds the most recently used statements, discarding\n * the oldest statements as it fills. For statements you don't intend to reuse, instead use [[withSqliteStatement]].\n * @param sql The SQLite SQL statement to execute\n * @param callback the callback to invoke on the prepared statement\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @returns the value returned by `callback`.\n * @see [[withPreparedStatement]]\n * @public\n */\n public withPreparedSqliteStatement<T>(sql: string, callback: (stmt: SqliteStatement) => T, logErrors = true): T {\n const stmt = this._sqliteStatementCache.findAndRemove(sql) ?? this.prepareSqliteStatement(sql, logErrors);\n const release = () => this._sqliteStatementCache.addOrDispose(stmt);\n try {\n const val: T = callback(stmt);\n if (val instanceof Promise) {\n val.then(release, release);\n } else {\n release();\n }\n return val;\n } catch (err) {\n release();\n throw err;\n }\n }\n\n /**\n * Prepared and execute a callback on a SQL statement. After the callback completes the statement is disposed.\n * Use this method for SQL statements are either not expected to be reused, or are not expensive to prepare.\n * For statements that will be reused often, instead use [[withPreparedSqliteStatement]].\n * @param sql The SQLite SQL statement to execute\n * @param callback the callback to invoke on the prepared statement\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @returns the value returned by `callback`.\n * @public\n */\n public withSqliteStatement<T>(sql: string, callback: (stmt: SqliteStatement) => T, logErrors = true): T {\n const stmt = this.prepareSqliteStatement(sql, logErrors);\n const release = () => stmt[Symbol.dispose]();\n try {\n const val: T = callback(stmt);\n if (val instanceof Promise) {\n val.then(release, release);\n } else {\n release();\n }\n return val;\n } catch (err) {\n release();\n throw err;\n }\n }\n\n /** Prepare an SQL statement.\n * @param sql The SQLite SQL statement to prepare\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @throws [IModelError]($common) if there is a problem preparing the statement.\n * @internal\n */\n public prepareSqliteStatement(sql: string, logErrors = true): SqliteStatement {\n const stmt = new SqliteStatement(sql);\n stmt.prepare(this[_nativeDb], logErrors);\n return stmt;\n }\n\n /** @internal */\n public get [_nativeDb](): IModelJsNative.ECDb {\n assert(undefined !== this._nativeDb);\n return this._nativeDb;\n }\n\n /** Allow to execute query and read results along with meta data. The result are streamed.\n *\n * See also:\n * - [ECSQL Overview]($docs/learning/backend/ExecutingECSQL)\n * - [Code Examples]($docs/learning/backend/ECSQLCodeExamples)\n * - [ECSQL Row Format]($docs/learning/ECSQLRowFormat)\n *\n * @param params The values to bind to the parameters (if the ECSQL has any).\n * @param config Allow to specify certain flags which control how query is executed.\n * @returns Returns an [ECSqlReader]($common) which helps iterate over the result set and also give access to metadata.\n * @public\n * */\n public createQueryReader(ecsql: string, params?: QueryBinder, config?: QueryOptions): ECSqlReader {\n if (!this._nativeDb || !this._nativeDb.isOpen()) {\n throw new IModelError(DbResult.BE_SQLITE_ERROR, \"db not open\");\n }\n const executor = {\n execute: async (request: DbQueryRequest) => {\n return ConcurrentQuery.executeQueryRequest(this[_nativeDb], request);\n },\n };\n return new ECSqlReader(executor, ecsql, params, config);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ECDb.js","sourceRoot":"","sources":["../../src/ECDb.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,sDAAyE;AAEzE,oDAAwH;AACxH,mEAAgE;AAChE,uDAAoD;AACpD,qDAAuE;AACvE,8DAAyD;AACzD,uDAAoE;AACpE,gDAA+C;AAE/C,MAAM,cAAc,GAAW,6CAAqB,CAAC,IAAI,CAAC;AAE1D;;GAEG;AACH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AAE,SAAS,CAAC,CAAC;QACzC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,gBAAgB;IAChB,IAAW,CAAC,mBAAS,CAAC;QACpB,IAAA,qBAAM,EAAC,SAAS,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC;QACrC,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;;;;;;;;;;SAWK;IACE,iBAAiB,CAAC,KAAa,EAAE,MAAoB,EAAE,MAAqB;QACjF,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,CAAC;YAChD,MAAM,IAAI,yBAAW,CAAC,uBAAQ,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;QACjE,CAAC;QACD,MAAM,QAAQ,GAAG;YACf,OAAO,EAAE,KAAK,EAAE,OAAuB,EAAE,EAAE;gBACzC,OAAO,iCAAe,CAAC,mBAAmB,CAAC,IAAI,CAAC,mBAAS,CAAC,EAAE,OAAO,CAAC,CAAC;YACvE,CAAC;SACF,CAAC;QACF,OAAO,IAAI,yBAAW,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1D,CAAC;CACF;AAxYD,oBAwYC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module ECDb\n */\nimport { assert, DbResult, Logger, OpenMode } from \"@itwin/core-bentley\";\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\nimport { DbQueryRequest, ECSchemaProps, ECSqlReader, IModelError, QueryBinder, QueryOptions } from \"@itwin/core-common\";\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\nimport { ConcurrentQuery } from \"./ConcurrentQuery\";\nimport { ECSqlStatement, ECSqlWriteStatement } from \"./ECSqlStatement\";\nimport { IModelNative } from \"./internal/NativePlatform\";\nimport { SqliteStatement, StatementCache } from \"./SqliteStatement\";\nimport { _nativeDb } from \"./internal/Symbols\";\n\nconst loggerCategory: string = BackendLoggerCategory.ECDb;\n\n/** Modes for how to open [ECDb]($backend) files.\n * @public\n */\nexport enum ECDbOpenMode {\n Readonly,\n ReadWrite,\n /** Opens the file read-write and upgrades the file if necessary to the latest file format version. */\n FileUpgrade,\n}\n\n/** An ECDb file\n * @public\n */\nexport class ECDb implements Disposable {\n private _nativeDb?: IModelJsNative.ECDb;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n private readonly _statementCache = new StatementCache<ECSqlStatement>();\n private _sqliteStatementCache = new StatementCache<SqliteStatement>();\n\n /** only for tests\n * @internal\n */\n public resetSqliteCache(size: number) {\n this._sqliteStatementCache.clear();\n this._sqliteStatementCache = new StatementCache<SqliteStatement>(size);\n }\n\n constructor() {\n this._nativeDb = new IModelNative.platform.ECDb();\n }\n /** Call this function when finished with this ECDb object. This releases the native resources held by the\n * ECDb object.\n */\n public [Symbol.dispose](): void {\n if (!this._nativeDb)\n return;\n\n this.closeDb();\n this._nativeDb.dispose();\n this._nativeDb = undefined;\n }\n /**\n * Attach an iModel file to this connection and load and register its schemas.\n * @note There are some reserve tablespace names that cannot be used. They are 'main', 'schema_sync_db', 'ecchange' & 'temp'\n * @param fileName IModel file name\n * @param alias identifier for the attached file. This identifer is used to access schema from the attached file. e.g. if alias is 'abc' then schema can be accessed using 'abc.MySchema.MyClass'\n */\n public attachDb(fileName: string, alias: string): void {\n if (alias.toLowerCase() === \"main\" || alias.toLowerCase() === \"schema_sync_db\" || alias.toLowerCase() === \"ecchange\" || alias.toLowerCase() === \"temp\") {\n throw new IModelError(DbResult.BE_SQLITE_ERROR, \"Reserved tablespace name cannot be used\");\n }\n this[_nativeDb].attachDb(fileName, alias);\n }\n /**\n * Detach the attached file from this connection. The attached file is closed and its schemas are unregistered.\n * @note There are some reserve tablespace names that cannot be used. They are 'main', 'schema_sync_db', 'ecchange' & 'temp'\n * @param alias identifer that was used in the call to [[attachDb]]\n */\n public detachDb(alias: string): void {\n if (alias.toLowerCase() === \"main\" || alias.toLowerCase() === \"schema_sync_db\" || alias.toLowerCase() === \"ecchange\" || alias.toLowerCase() === \"temp\") {\n throw new IModelError(DbResult.BE_SQLITE_ERROR, \"Reserved tablespace name cannot be used\");\n }\n this.clearStatementCache();\n this[_nativeDb].detachDb(alias);\n }\n\n /** @deprecated in 5.0 Use [Symbol.dispose] instead. */\n public dispose(): void {\n this[Symbol.dispose]();\n }\n\n /** Create an ECDb\n * @param pathName The path to the ECDb file to create.\n * @throws [IModelError]($common) if the operation failed.\n */\n public createDb(pathName: string): void {\n const status: DbResult = this[_nativeDb].createDb(pathName);\n if (status !== DbResult.BE_SQLITE_OK)\n throw new IModelError(status, \"Failed to created ECDb\");\n }\n\n /** Open the ECDb.\n * @param pathName The path to the ECDb file to open\n * @param openMode Open mode\n * @throws [IModelError]($common) if the operation failed.\n */\n public openDb(pathName: string, openMode: ECDbOpenMode = ECDbOpenMode.Readonly): void {\n const nativeOpenMode: OpenMode = openMode === ECDbOpenMode.Readonly ? OpenMode.Readonly : OpenMode.ReadWrite;\n const tryUpgrade: boolean = openMode === ECDbOpenMode.FileUpgrade;\n const status: DbResult = this[_nativeDb].openDb(pathName, nativeOpenMode, tryUpgrade);\n if (status !== DbResult.BE_SQLITE_OK)\n throw new IModelError(status, \"Failed to open ECDb\");\n }\n\n /** Returns true if the ECDb is open */\n public get isOpen(): boolean { return this[_nativeDb].isOpen(); }\n\n /** Close the Db after saving any uncommitted changes.\n * @throws [IModelError]($common) if the database is not open.\n */\n public closeDb(): void {\n this._statementCache.clear();\n this._sqliteStatementCache.clear();\n this[_nativeDb].closeDb();\n }\n\n /** @internal use to test statement caching */\n public clearStatementCache() {\n this._statementCache.clear();\n }\n\n /** @internal use to test statement caching */\n public getCachedStatementCount() {\n return this._statementCache.size;\n }\n\n /** Commit the outermost transaction, writing changes to the file. Then, restart the transaction.\n * @param changesetName The name of the operation that generated these changes.\n * @throws [IModelError]($common) if the database is not open or if the operation failed.\n */\n public saveChanges(changesetName?: string): void {\n const status: DbResult = this[_nativeDb].saveChanges(changesetName);\n if (status !== DbResult.BE_SQLITE_OK)\n throw new IModelError(status, \"Failed to save changes\");\n }\n\n /** Abandon (cancel) the outermost transaction, discarding all changes since last save. Then, restart the transaction.\n * @throws [IModelError]($common) if the database is not open or if the operation failed.\n */\n public abandonChanges(): void {\n const status: DbResult = this[_nativeDb].abandonChanges();\n if (status !== DbResult.BE_SQLITE_OK)\n throw new IModelError(status, \"Failed to abandon changes\");\n }\n\n /** Import a schema.\n *\n * If the import was successful, the database is automatically saved to disk.\n * @param pathName Path to ECSchema XML file to import.\n * @throws [IModelError]($common) if the database is not open or if the operation failed.\n */\n public importSchema(pathName: string): void {\n const status: DbResult = this[_nativeDb].importSchema(pathName);\n if (status !== DbResult.BE_SQLITE_OK) {\n Logger.logError(loggerCategory, `Failed to import schema from '${pathName}'.`);\n throw new IModelError(status, `Failed to import schema from '${pathName}'.`);\n }\n }\n\n /**\n * Returns the full schema for the input name.\n * @param name The name of the schema e.g. 'ECDbMeta'\n * @returns The SchemaProps for the requested schema\n * @throws if the schema can not be found or loaded.\n */\n public getSchemaProps(name: string): ECSchemaProps {\n return this[_nativeDb].getSchemaProps(name);\n }\n\n /**\n * Use a prepared ECSQL statement, potentially from the statement cache. If the requested statement doesn't exist\n * in the statement cache, a new statement is prepared. After the callback completes, the statement is reset and saved\n * in the statement cache so it can be reused in the future. Use this method for ECSQL statements that will be\n * reused often and are expensive to prepare. The statement cache holds the most recently used statements, discarding\n * the oldest statements as it fills. For statements you don't intend to reuse, instead use [[withStatement]].\n * @param sql The SQLite SQL statement to execute\n * @param callback the callback to invoke on the prepared statement\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @returns the value returned by `callback`.\n * @see [[withWriteStatement]]\n * @beta\n */\n public withCachedWriteStatement<T>(ecsql: string, callback: (stmt: ECSqlWriteStatement) => T, logErrors = true): T {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const stmt = this._statementCache.findAndRemove(ecsql) ?? this.prepareStatement(ecsql, logErrors);\n const release = () => this._statementCache.addOrDispose(stmt);\n try {\n const val = callback(new ECSqlWriteStatement(stmt));\n if (val instanceof Promise) {\n val.then(release, release);\n } else {\n release();\n }\n return val;\n } catch (err) {\n release();\n throw err;\n }\n }\n\n /**\n * Prepared and execute a callback on an ECSQL statement. After the callback completes the statement is disposed.\n * Use this method for ECSQL statements are either not expected to be reused, or are not expensive to prepare.\n * For statements that will be reused often, instead use [[withPreparedStatement]].\n * @param sql The SQLite SQL statement to execute\n * @param callback the callback to invoke on the prepared statement\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @returns the value returned by `callback`.\n * @see [[withCachedWriteStatement]]\n * @beta\n */\n public withWriteStatement<T>(ecsql: string, callback: (stmt: ECSqlWriteStatement) => T, logErrors = true): T {\n const stmt = this.prepareWriteStatement(ecsql, logErrors);\n const release = () => { };\n try {\n const val = callback(stmt);\n if (val instanceof Promise) {\n val.then(release, release);\n } else {\n release();\n }\n return val;\n } catch (err) {\n release();\n throw err;\n }\n }\n\n /** Prepare an ECSQL statement.\n * @param ecsql The ECSQL statement to prepare\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @throws [IModelError]($common) if there is a problem preparing the statement.\n * @beta\n */\n public prepareWriteStatement(ecsql: string, logErrors = true): ECSqlWriteStatement {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return new ECSqlWriteStatement(this.prepareStatement(ecsql, logErrors));\n }\n\n /**\n * Use a prepared ECSQL statement, potentially from the statement cache. If the requested statement doesn't exist\n * in the statement cache, a new statement is prepared. After the callback completes, the statement is reset and saved\n * in the statement cache so it can be reused in the future. Use this method for ECSQL statements that will be\n * reused often and are expensive to prepare. The statement cache holds the most recently used statements, discarding\n * the oldest statements as it fills. For statements you don't intend to reuse, instead use [[withStatement]].\n * @param sql The SQLite SQL statement to execute\n * @param callback the callback to invoke on the prepared statement\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @returns the value returned by `callback`.\n * @see [[withStatement]]\n * @public\n * @deprecated in 4.11. Use [[createQueryReader]] for SELECT statements and [[withCachedWriteStatement]] for INSERT/UPDATE/DELETE instead.\n */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public withPreparedStatement<T>(ecsql: string, callback: (stmt: ECSqlStatement) => T, logErrors = true): T {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const stmt = this._statementCache.findAndRemove(ecsql) ?? this.prepareStatement(ecsql, logErrors);\n const release = () => this._statementCache.addOrDispose(stmt);\n try {\n const val = callback(stmt);\n if (val instanceof Promise) {\n val.then(release, release);\n } else {\n release();\n }\n return val;\n } catch (err) {\n release();\n throw err;\n }\n }\n\n /**\n * Prepared and execute a callback on an ECSQL statement. After the callback completes the statement is disposed.\n * Use this method for ECSQL statements are either not expected to be reused, or are not expensive to prepare.\n * For statements that will be reused often, instead use [[withPreparedStatement]].\n * @param sql The SQLite SQL statement to execute\n * @param callback the callback to invoke on the prepared statement\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @returns the value returned by `callback`.\n * @see [[withPreparedStatement]]\n * @public\n * @deprecated in 4.11. Use [[createQueryReader]] for SELECT statements and [[withWriteStatement]] for INSERT/UPDATE/DELETE instead.\n */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public withStatement<T>(ecsql: string, callback: (stmt: ECSqlStatement) => T, logErrors = true): T {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const stmt = this.prepareStatement(ecsql, logErrors);\n const release = () => stmt[Symbol.dispose]();\n try {\n const val = callback(stmt);\n if (val instanceof Promise) {\n val.then(release, release);\n } else {\n release();\n }\n return val;\n } catch (err) {\n release();\n throw err;\n }\n }\n\n /** Prepare an ECSQL statement.\n * @param ecsql The ECSQL statement to prepare\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @throws [IModelError]($common) if there is a problem preparing the statement.\n * @deprecated in 4.11. Use [[prepareWriteStatement]] when preparing an INSERT/UPDATE/DELETE statement or [[createQueryReader]] to execute a SELECT statement.\n */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public prepareStatement(ecsql: string, logErrors = true): ECSqlStatement {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const stmt = new ECSqlStatement();\n stmt.prepare(this[_nativeDb], ecsql, logErrors);\n return stmt;\n }\n\n /**\n * Use a prepared SQL statement, potentially from the statement cache. If the requested statement doesn't exist\n * in the statement cache, a new statement is prepared. After the callback completes, the statement is reset and saved\n * in the statement cache so it can be reused in the future. Use this method for SQL statements that will be\n * reused often and are expensive to prepare. The statement cache holds the most recently used statements, discarding\n * the oldest statements as it fills. For statements you don't intend to reuse, instead use [[withSqliteStatement]].\n * @param sql The SQLite SQL statement to execute\n * @param callback the callback to invoke on the prepared statement\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @returns the value returned by `callback`.\n * @see [[withPreparedStatement]]\n * @public\n */\n public withPreparedSqliteStatement<T>(sql: string, callback: (stmt: SqliteStatement) => T, logErrors = true): T {\n const stmt = this._sqliteStatementCache.findAndRemove(sql) ?? this.prepareSqliteStatement(sql, logErrors);\n const release = () => this._sqliteStatementCache.addOrDispose(stmt);\n try {\n const val: T = callback(stmt);\n if (val instanceof Promise) {\n val.then(release, release);\n } else {\n release();\n }\n return val;\n } catch (err) {\n release();\n throw err;\n }\n }\n\n /**\n * Prepared and execute a callback on a SQL statement. After the callback completes the statement is disposed.\n * Use this method for SQL statements are either not expected to be reused, or are not expensive to prepare.\n * For statements that will be reused often, instead use [[withPreparedSqliteStatement]].\n * @param sql The SQLite SQL statement to execute\n * @param callback the callback to invoke on the prepared statement\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @returns the value returned by `callback`.\n * @public\n */\n public withSqliteStatement<T>(sql: string, callback: (stmt: SqliteStatement) => T, logErrors = true): T {\n const stmt = this.prepareSqliteStatement(sql, logErrors);\n const release = () => stmt[Symbol.dispose]();\n try {\n const val: T = callback(stmt);\n if (val instanceof Promise) {\n val.then(release, release);\n } else {\n release();\n }\n return val;\n } catch (err) {\n release();\n throw err;\n }\n }\n\n /** Prepare an SQL statement.\n * @param sql The SQLite SQL statement to prepare\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @throws [IModelError]($common) if there is a problem preparing the statement.\n * @internal\n */\n public prepareSqliteStatement(sql: string, logErrors = true): SqliteStatement {\n const stmt = new SqliteStatement(sql);\n stmt.prepare(this[_nativeDb], logErrors);\n return stmt;\n }\n\n /** @internal */\n public get [_nativeDb](): IModelJsNative.ECDb {\n assert(undefined !== this._nativeDb);\n return this._nativeDb;\n }\n\n /** Allow to execute query and read results along with meta data. The result are streamed.\n *\n * See also:\n * - [ECSQL Overview]($docs/learning/backend/ExecutingECSQL)\n * - [Code Examples]($docs/learning/backend/ECSQLCodeExamples)\n * - [ECSQL Row Format]($docs/learning/ECSQLRowFormat)\n *\n * @param params The values to bind to the parameters (if the ECSQL has any).\n * @param config Allow to specify certain flags which control how query is executed.\n * @returns Returns an [ECSqlReader]($common) which helps iterate over the result set and also give access to metadata.\n * @public\n * */\n public createQueryReader(ecsql: string, params?: QueryBinder, config?: QueryOptions): ECSqlReader {\n if (!this._nativeDb || !this._nativeDb.isOpen()) {\n throw new IModelError(DbResult.BE_SQLITE_ERROR, \"db not open\");\n }\n const executor = {\n execute: async (request: DbQueryRequest) => {\n return ConcurrentQuery.executeQueryRequest(this[_nativeDb], request);\n },\n };\n return new ECSqlReader(executor, ecsql, params, config);\n }\n}\n"]}
|
|
@@ -55,6 +55,8 @@ export interface ECSqlRowArg {
|
|
|
55
55
|
* - [Executing ECSQL]($docs/learning/backend/ExecutingECSQL) provides more background on ECSQL and an introduction on how to execute ECSQL with the iTwin.js API.
|
|
56
56
|
* - [Code Examples]($docs/learning/backend/ECSQLCodeExamples) illustrate the use of the iTwin.js API for executing and working with ECSQL
|
|
57
57
|
* @public
|
|
58
|
+
* @deprecated in 4.11. Use [IModelDb.createQueryReader]($backend) or [ECDb.createQueryReader]($backend) to query.
|
|
59
|
+
* For ECDb, use [ECDb.withCachedWriteStatement]($backend) or [ECDb.withWriteStatement]($backend) to Insert/Update/Delete.
|
|
58
60
|
*/
|
|
59
61
|
export declare class ECSqlStatement implements IterableIterator<any>, Disposable {
|
|
60
62
|
private _stmt;
|
|
@@ -254,6 +256,179 @@ export declare class ECSqlStatement implements IterableIterator<any>, Disposable
|
|
|
254
256
|
*/
|
|
255
257
|
getValue(columnIx: number): ECSqlValue;
|
|
256
258
|
}
|
|
259
|
+
/** Executes ECSQL INSERT/UPDATE/DELETE statements.
|
|
260
|
+
*
|
|
261
|
+
* A statement must be prepared before it can be executed, and it must be released when no longer needed.
|
|
262
|
+
* See [ECDb.withCachedWriteStatement]($backend) for a convenient and
|
|
263
|
+
* reliable way to prepare, execute, and then release a statement.
|
|
264
|
+
*
|
|
265
|
+
* A statement may contain parameters that must be filled in before use by the **bind** methods.
|
|
266
|
+
*
|
|
267
|
+
* Once prepared (and parameters are bound, if any), the statement is executed by calling [ECSqlStatement.stepForInsert]($backend).
|
|
268
|
+
*
|
|
269
|
+
* > Preparing a statement can be time-consuming. The best way to reduce the effect of this overhead is to cache and reuse prepared
|
|
270
|
+
* > statements. A cached prepared statement may be used in different places in an app, as long as the statement is general enough.
|
|
271
|
+
* > 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.
|
|
272
|
+
*
|
|
273
|
+
* See also
|
|
274
|
+
* - [Executing ECSQL]($docs/learning/backend/ExecutingECSQL) provides more background on ECSQL and an introduction on how to execute ECSQL with the iTwin.js API.
|
|
275
|
+
* - [Code Examples]($docs/learning/backend/ECSQLCodeExamples) illustrate the use of the iTwin.js API for executing and working with ECSQL
|
|
276
|
+
* @public
|
|
277
|
+
*/
|
|
278
|
+
export declare class ECSqlWriteStatement {
|
|
279
|
+
private _stmt;
|
|
280
|
+
constructor(stmt?: ECSqlStatement);
|
|
281
|
+
get sql(): string;
|
|
282
|
+
/** Check if this statement has been prepared successfully or not */
|
|
283
|
+
get isPrepared(): boolean;
|
|
284
|
+
/** Get the underlying ECSqlStatement. Needed until we remove ECSqlStatement.
|
|
285
|
+
* @param
|
|
286
|
+
* @internal
|
|
287
|
+
*/
|
|
288
|
+
get stmt(): ECSqlStatement;
|
|
289
|
+
/** Prepare this statement prior to first use.
|
|
290
|
+
* @param db The ECDb to prepare the statement against
|
|
291
|
+
* @param ecsql The ECSQL statement string to prepare
|
|
292
|
+
* @param logErrors Determine if errors are logged or not
|
|
293
|
+
* @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.
|
|
294
|
+
* The error.message property will provide details.
|
|
295
|
+
* @internal
|
|
296
|
+
*/
|
|
297
|
+
prepare(db: IModelJsNative.ECDb, ecsql: string, logErrors?: boolean): void;
|
|
298
|
+
/** Prepare this statement prior to first use.
|
|
299
|
+
* @param db The DgnDb or ECDb to prepare the statement against
|
|
300
|
+
* @param ecsql The ECSQL statement string to prepare
|
|
301
|
+
* @param logErrors Determine if errors are logged or not, its set to false by default for tryPrepare()
|
|
302
|
+
* @returns An object with a `status` member equal to [DbResult.BE_SQLITE_OK]($bentley) on success. Upon error, the `message` member will provide details.
|
|
303
|
+
* @internal
|
|
304
|
+
*/
|
|
305
|
+
tryPrepare(db: IModelJsNative.DgnDb | IModelJsNative.ECDb, ecsql: string, logErrors?: boolean): {
|
|
306
|
+
status: DbResult;
|
|
307
|
+
message: string;
|
|
308
|
+
};
|
|
309
|
+
/** Reset this statement so that the next call to step will return the first row, if any. */
|
|
310
|
+
reset(): void;
|
|
311
|
+
/** Get the Native SQL statement
|
|
312
|
+
* @internal
|
|
313
|
+
*/
|
|
314
|
+
getNativeSql(): string;
|
|
315
|
+
/** Binds the specified value to the specified ECSQL parameter.
|
|
316
|
+
* The section "[iTwin.js Types used in ECSQL Parameter Bindings]($docs/learning/ECSQLParameterTypes)" describes the
|
|
317
|
+
* iTwin.js types to be used for the different ECSQL parameter types.
|
|
318
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
319
|
+
*/
|
|
320
|
+
bindValue(parameter: number | string, val: any): void;
|
|
321
|
+
/** Binds null to the specified ECSQL parameter.
|
|
322
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
323
|
+
*/
|
|
324
|
+
bindNull(parameter: number | string): void;
|
|
325
|
+
/** Binds a BLOB value to the specified ECSQL parameter.
|
|
326
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
327
|
+
* @param BLOB value as either a Uint8Array, ArrayBuffer or a Base64 string
|
|
328
|
+
*/
|
|
329
|
+
bindBlob(parameter: number | string, blob: string | Uint8Array | ArrayBuffer | SharedArrayBuffer): void;
|
|
330
|
+
/** Binds a boolean value to the specified ECSQL parameter.
|
|
331
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
332
|
+
* @param val Boolean value
|
|
333
|
+
*/
|
|
334
|
+
bindBoolean(parameter: number | string, val: boolean): void;
|
|
335
|
+
/** Binds a DateTime value to the specified ECSQL parameter.
|
|
336
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
337
|
+
* @param isoDateTimeString DateTime value as ISO8601 string
|
|
338
|
+
*/
|
|
339
|
+
bindDateTime(parameter: number | string, isoDateTimeString: string): void;
|
|
340
|
+
/** Binds a double value to the specified ECSQL parameter.
|
|
341
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
342
|
+
* @param val Double value
|
|
343
|
+
*/
|
|
344
|
+
bindDouble(parameter: number | string, val: number): void;
|
|
345
|
+
/** Binds an GUID value to the specified ECSQL parameter.
|
|
346
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
347
|
+
* @param val GUID value
|
|
348
|
+
*/
|
|
349
|
+
bindGuid(parameter: number | string, val: GuidString): void;
|
|
350
|
+
/** Binds an Id value to the specified ECSQL parameter.
|
|
351
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
352
|
+
* @param val Id value
|
|
353
|
+
*/
|
|
354
|
+
bindId(parameter: number | string, val: Id64String): void;
|
|
355
|
+
/** Binds an integer value to the specified ECSQL parameter.
|
|
356
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
357
|
+
* @param val Integer value as number, decimal string or hexadecimal string.
|
|
358
|
+
*/
|
|
359
|
+
bindInteger(parameter: number | string, val: number | string): void;
|
|
360
|
+
/** Binds an Point2d value to the specified ECSQL parameter.
|
|
361
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
362
|
+
* @param val Point2d value
|
|
363
|
+
*/
|
|
364
|
+
bindPoint2d(parameter: number | string, val: XAndY): void;
|
|
365
|
+
/** Binds an Point3d value to the specified ECSQL parameter.
|
|
366
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
367
|
+
* @param val Point3d value
|
|
368
|
+
*/
|
|
369
|
+
bindPoint3d(parameter: number | string, val: XYAndZ): void;
|
|
370
|
+
/** Binds a Range3d as a blob to the specified ECSQL parameter
|
|
371
|
+
* @param parameter Index(1-based) or name of the parameter
|
|
372
|
+
* @param val Range3d value
|
|
373
|
+
*/
|
|
374
|
+
bindRange3d(parameter: number | string, val: LowAndHighXYZ): void;
|
|
375
|
+
/** Binds an string to the specified ECSQL parameter.
|
|
376
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
377
|
+
* @param val String value
|
|
378
|
+
*/
|
|
379
|
+
bindString(parameter: number | string, val: string): void;
|
|
380
|
+
/** Binds a navigation property value to the specified ECSQL parameter.
|
|
381
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
382
|
+
* @param val Navigation property value
|
|
383
|
+
*/
|
|
384
|
+
bindNavigation(parameter: number | string, val: NavigationBindingValue): void;
|
|
385
|
+
/** Binds a struct property value to the specified ECSQL parameter.
|
|
386
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
387
|
+
* @param val Struct value. The struct value is an object composed of pairs of a struct member property name and its value
|
|
388
|
+
* (of one of the supported types)
|
|
389
|
+
*/
|
|
390
|
+
bindStruct(parameter: number | string, val: object): void;
|
|
391
|
+
/** Binds an array value to the specified ECSQL parameter.
|
|
392
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
393
|
+
* @param val Array value. The array value is an array of values of the supported types
|
|
394
|
+
*/
|
|
395
|
+
bindArray(parameter: number | string, val: any[]): void;
|
|
396
|
+
bindIdSet(parameter: number | string, val: Id64String[]): void;
|
|
397
|
+
/**
|
|
398
|
+
* Gets a binder to bind a value for an ECSQL parameter
|
|
399
|
+
* > This is the most low-level API to bind a value to a specific parameter. Alternatively you can use the ECSqlStatement.bindXX methods
|
|
400
|
+
* > or [ECSqlStatement.bindValues]($backend).
|
|
401
|
+
* @param parameter Index (1-based) or name of the parameter
|
|
402
|
+
*/
|
|
403
|
+
getBinder(parameter: string | number): ECSqlBinder;
|
|
404
|
+
/** Bind values to all parameters in the statement.
|
|
405
|
+
* @param values The values to bind to the parameters.
|
|
406
|
+
* Pass an *array* of values if the parameters are *positional*.
|
|
407
|
+
* Pass an *object of the values keyed on the parameter name* for *named parameters*.
|
|
408
|
+
* The values in either the array or object must match the respective types of the parameter.
|
|
409
|
+
*
|
|
410
|
+
* The section "[iTwin.js Types used in ECSQL Parameter Bindings]($docs/learning/ECSQLParameterTypes)" describes the
|
|
411
|
+
* iTwin.js types to be used for the different ECSQL parameter types.
|
|
412
|
+
*
|
|
413
|
+
* See also these [Code Samples]($docs/learning/backend/ECSQLCodeExamples#binding-to-all-parameters-at-once)
|
|
414
|
+
*/
|
|
415
|
+
bindValues(values: any[] | object): void;
|
|
416
|
+
/** Clear any bindings that were previously set on this statement.
|
|
417
|
+
* @throws [IModelError]($common) in case of errors
|
|
418
|
+
*/
|
|
419
|
+
clearBindings(): void;
|
|
420
|
+
/** Step this INSERT statement and returns status and the ECInstanceId of the newly
|
|
421
|
+
* created instance.
|
|
422
|
+
*
|
|
423
|
+
* > Insert statements can be used with ECDb only, not with IModelDb.
|
|
424
|
+
*
|
|
425
|
+
* @returns Returns the generated ECInstanceId in case of success and the status of the step
|
|
426
|
+
* call. In case of error, the respective error code is returned.
|
|
427
|
+
*/
|
|
428
|
+
stepForInsert(): ECSqlInsertResult;
|
|
429
|
+
/** Get the query result's column count (only for ECSQL SELECT statements). */
|
|
430
|
+
getColumnCount(): number;
|
|
431
|
+
}
|
|
257
432
|
/** Binds a value to an ECSQL parameter.
|
|
258
433
|
*
|
|
259
434
|
* See also:
|
|
@@ -357,6 +532,7 @@ export declare class ECSqlBinder {
|
|
|
357
532
|
* - [[ECSqlStatement.getValue]]
|
|
358
533
|
* - [Code Samples]($docs/learning/backend/ECSQLCodeExamples#working-with-the-query-result)
|
|
359
534
|
* @public
|
|
535
|
+
* @deprecated in 4.11. Use [IModelDb.createQueryReader]($backend) or [ECDb.createQueryReader]($backend) instead.
|
|
360
536
|
*/
|
|
361
537
|
export interface ECEnumValue {
|
|
362
538
|
schema: string;
|
|
@@ -371,7 +547,8 @@ export interface ECEnumValue {
|
|
|
371
547
|
* - [ECSqlStatement.getValue]($backend)
|
|
372
548
|
* - [Code Samples]($docs/learning/backend/ECSQLCodeExamples#working-with-the-query-result)
|
|
373
549
|
* @public
|
|
374
|
-
|
|
550
|
+
* @deprecated in 4.11. Use [IModelDb.createQueryReader]($backend) or [ECDb.createQueryReader]($backend) instead.
|
|
551
|
+
*/
|
|
375
552
|
export declare class ECSqlValue {
|
|
376
553
|
private _val;
|
|
377
554
|
/** @internal */
|
|
@@ -436,7 +613,8 @@ export declare class ECSqlValue {
|
|
|
436
613
|
/** Iterator over members of a struct [ECSqlValue]($backend) or the elements of an array [ECSqlValue]($backend).
|
|
437
614
|
* See [ECSqlValue.getStructIterator]($backend) or [ECSqlValue.getArrayIterator]($backend).
|
|
438
615
|
* @public
|
|
439
|
-
|
|
616
|
+
* @deprecated in 4.11. Use [IModelDb.createQueryReader]($backend) or [ECDb.createQueryReader]($backend) instead.
|
|
617
|
+
*/
|
|
440
618
|
export declare class ECSqlValueIterator implements IterableIterator<ECSqlValue> {
|
|
441
619
|
private _it;
|
|
442
620
|
/** @internal */
|
|
@@ -447,6 +625,7 @@ export declare class ECSqlValueIterator implements IterableIterator<ECSqlValue>
|
|
|
447
625
|
/** Information about an ECSQL column in an ECSQL query result.
|
|
448
626
|
* See [ECSqlValue.columnInfo]($backend), [ECSqlStatement.getValue]($backend), [ECSqlStatement]($backend)
|
|
449
627
|
* @public
|
|
628
|
+
* @deprecated in 4.11. Use [IModelDb.createQueryReader]($backend) or [ECDb.createQueryReader]($backend) instead.
|
|
450
629
|
*/
|
|
451
630
|
export interface ECSqlColumnInfo {
|
|
452
631
|
/** Gets the data type of the column.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ECSqlStatement.d.ts","sourceRoot":"","sources":["../../src/ECSqlStatement.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAU,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAW,KAAK,EAAE,MAAM,EAAO,MAAM,sBAAsB,CAAC;AAClF,OAAO,EAAa,cAAc,EAAe,sBAAsB,EAAE,eAAe,EAAuB,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC1J,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAI1D;;;;;;;;;GASG;AACH,qBAAa,iBAAiB;IACF,MAAM,EAAE,QAAQ;IAAS,EAAE,CAAC,EAAE,UAAU;gBAAxC,MAAM,EAAE,QAAQ,EAAS,EAAE,CAAC,EAAE,UAAU,YAAA;CACnE;AAED;;;KAGK;AACL,MAAM,WAAW,WAAW;IAC1B,4BAA4B;IAC5B,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED
|
|
1
|
+
{"version":3,"file":"ECSqlStatement.d.ts","sourceRoot":"","sources":["../../src/ECSqlStatement.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAU,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM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