node-firebird-driver 3.2.2 → 3.4.0
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/README.md +1 -1
- package/dist/lib/impl/attachment.d.ts +4 -4
- package/dist/lib/impl/attachment.js +8 -6
- package/dist/lib/impl/attachment.js.map +1 -1
- package/dist/lib/impl/blob.js.map +1 -1
- package/dist/lib/impl/client.js +3 -2
- package/dist/lib/impl/client.js.map +1 -1
- package/dist/lib/impl/date-time.js +2 -1
- package/dist/lib/impl/date-time.js.map +1 -1
- package/dist/lib/impl/events.js +2 -1
- package/dist/lib/impl/events.js.map +1 -1
- package/dist/lib/impl/fb-util.d.ts +2 -1
- package/dist/lib/impl/fb-util.js +100 -81
- package/dist/lib/impl/fb-util.js.map +1 -1
- package/dist/lib/impl/resultset.js +11 -5
- package/dist/lib/impl/resultset.js.map +1 -1
- package/dist/lib/impl/statement.d.ts +3 -1
- package/dist/lib/impl/statement.js +4 -2
- package/dist/lib/impl/statement.js.map +1 -1
- package/dist/lib/impl/time-zones.js +5 -3
- package/dist/lib/impl/time-zones.js.map +1 -1
- package/dist/lib/impl/transaction.js +2 -1
- package/dist/lib/impl/transaction.js.map +1 -1
- package/dist/lib/index.d.ts +27 -1
- package/dist/lib/index.js +25 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/test/tests.js +197 -68
- package/dist/test/tests.js.map +1 -1
- package/package.json +6 -5
- package/src/lib/impl/attachment.ts +290 -253
- package/src/lib/impl/blob.ts +37 -35
- package/src/lib/impl/client.ts +60 -61
- package/src/lib/impl/date-time.ts +33 -33
- package/src/lib/impl/events.ts +17 -18
- package/src/lib/impl/fb-util.ts +552 -448
- package/src/lib/impl/resultset.ts +94 -86
- package/src/lib/impl/statement.ts +157 -127
- package/src/lib/impl/time-zones.ts +643 -641
- package/src/lib/impl/transaction.ts +37 -38
- package/src/lib/index.ts +331 -270
- package/src/test/tests.ts +1028 -860
- package/tsconfig.json +7 -13
package/src/lib/index.ts
CHANGED
|
@@ -1,384 +1,445 @@
|
|
|
1
1
|
/** Client interface. */
|
|
2
2
|
export interface Client {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/** Disposes this client's resources. */
|
|
4
|
+
dispose(): Promise<void>;
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
/** Connects to a database. */
|
|
7
|
+
connect(uri: string, options?: ConnectOptions): Promise<Attachment>;
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
/** Creates a database. */
|
|
10
|
+
createDatabase(uri: string, options?: CreateDatabaseOptions): Promise<Attachment>;
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
/** True if the client has not been disposed. */
|
|
13
|
+
readonly isValid: boolean;
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
/** Default connect options. */
|
|
16
|
+
defaultConnectOptions?: ConnectOptions;
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
/** Default create database options. */
|
|
19
|
+
defaultCreateDatabaseOptions?: CreateDatabaseOptions;
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
/** Default transaction options. */
|
|
22
|
+
defaultTransactionOptions?: TransactionOptions;
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
/** Default query's prepare options. */
|
|
25
|
+
defaultPrepareOptions?: PrepareOptions;
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
/** Default query's execute options. */
|
|
28
|
+
defaultExecuteOptions?: ExecuteOptions;
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
/** Default query's executeQuery options. */
|
|
31
|
+
defaultExecuteQueryOptions?: ExecuteQueryOptions;
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
/** Default result set's fetch options. */
|
|
34
|
+
defaultFetchOptions?: FetchOptions;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
/** ConnectOptions interface. */
|
|
38
38
|
export interface ConnectOptions {
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
/** User name. */
|
|
40
|
+
username?: string;
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
/** User password. */
|
|
43
|
+
password?: string;
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
/** User role. */
|
|
46
|
+
role?: string;
|
|
47
|
+
|
|
48
|
+
/** Set database read/write mode. */
|
|
49
|
+
setDatabaseReadWriteMode?: DatabaseReadWriteMode;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** DatabaseReadWriteMode enum */
|
|
53
|
+
export enum DatabaseReadWriteMode {
|
|
54
|
+
READ_WRITE = 'READ_WRITE',
|
|
55
|
+
READ_ONLY = 'READ_ONLY',
|
|
47
56
|
}
|
|
48
57
|
|
|
49
58
|
/** CreateDatabaseOptions interface. */
|
|
50
59
|
export interface CreateDatabaseOptions extends ConnectOptions {
|
|
51
|
-
|
|
52
|
-
|
|
60
|
+
/** Forced write. */
|
|
61
|
+
forcedWrite?: boolean;
|
|
53
62
|
}
|
|
54
63
|
|
|
55
64
|
/** TransactionIsolation enum */
|
|
56
65
|
export enum TransactionIsolation {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
66
|
+
CONSISTENCY = 'CONSISTENCY',
|
|
67
|
+
READ_COMMITTED = 'READ_COMMITTED',
|
|
68
|
+
SNAPSHOT = 'SNAPSHOT',
|
|
60
69
|
}
|
|
61
70
|
|
|
62
71
|
/** TransactionOptions interface. */
|
|
63
72
|
export interface TransactionOptions {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
+
isolation?: TransactionIsolation;
|
|
74
|
+
readCommittedMode?: 'NO_RECORD_VERSION' | 'RECORD_VERSION';
|
|
75
|
+
accessMode?: 'READ_ONLY' | 'READ_WRITE';
|
|
76
|
+
waitMode?: 'NO_WAIT' | 'WAIT';
|
|
77
|
+
noAutoUndo?: boolean;
|
|
78
|
+
ignoreLimbo?: boolean;
|
|
79
|
+
restartRequests?: boolean;
|
|
80
|
+
autoCommit?: boolean;
|
|
81
|
+
//// TODO: lockTimeOut?: number;
|
|
73
82
|
}
|
|
74
83
|
|
|
75
84
|
/** PrepareOptions interface. */
|
|
76
|
-
export interface PrepareOptions {
|
|
77
|
-
}
|
|
85
|
+
export interface PrepareOptions {}
|
|
78
86
|
|
|
79
87
|
/** ExecuteOptions interface. */
|
|
80
|
-
export interface ExecuteOptions {
|
|
81
|
-
}
|
|
88
|
+
export interface ExecuteOptions {}
|
|
82
89
|
|
|
83
90
|
/** ExecuteQueryOptions interface. */
|
|
84
|
-
export interface ExecuteQueryOptions extends ExecuteOptions {
|
|
85
|
-
}
|
|
91
|
+
export interface ExecuteQueryOptions extends ExecuteOptions {}
|
|
86
92
|
|
|
87
93
|
/** FetchOptions interface. */
|
|
88
94
|
export interface FetchOptions {
|
|
89
|
-
|
|
90
|
-
|
|
95
|
+
/** Number of rows to fetch. */
|
|
96
|
+
fetchSize?: number;
|
|
91
97
|
}
|
|
92
98
|
|
|
93
99
|
/** CreateBlobOptions interface. */
|
|
94
100
|
export interface CreateBlobOptions {
|
|
95
|
-
|
|
101
|
+
type?: 'SEGMENTED' | 'STREAM';
|
|
96
102
|
}
|
|
97
103
|
|
|
98
104
|
/** Attachment interface. */
|
|
99
105
|
export interface Attachment {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
106
|
+
/** Disconnects this attachment. */
|
|
107
|
+
disconnect(): Promise<void>;
|
|
108
|
+
|
|
109
|
+
/** Enable/disable cancellation of operations in this attachment. */
|
|
110
|
+
enableCancellation(enable: boolean): Promise<void>;
|
|
111
|
+
|
|
112
|
+
/** Cancel a running operation in this attachment. */
|
|
113
|
+
cancelOperation(forcibleAbort?: boolean): Promise<void>;
|
|
114
|
+
|
|
115
|
+
/** Drops the database and release this attachment. */
|
|
116
|
+
dropDatabase(): Promise<void>;
|
|
117
|
+
|
|
118
|
+
/** Creates a blob and return its stream. */
|
|
119
|
+
createBlob(transaction: Transaction, options?: CreateBlobOptions): Promise<BlobStream>;
|
|
120
|
+
|
|
121
|
+
/** Opens a blob's stream. */
|
|
122
|
+
openBlob(transaction: Transaction, blob: Blob): Promise<BlobStream>;
|
|
123
|
+
|
|
124
|
+
/** Starts a new transaction. */
|
|
125
|
+
startTransaction(options?: TransactionOptions): Promise<Transaction>;
|
|
126
|
+
|
|
127
|
+
/** Prepares a query. */
|
|
128
|
+
prepare(transaction: Transaction, sqlStmt: string, options?: PrepareOptions): Promise<Statement>;
|
|
129
|
+
|
|
130
|
+
/** Executes a statement that uses the SET TRANSACTION command. Returns the new transaction. */
|
|
131
|
+
executeTransaction(
|
|
132
|
+
transaction: Transaction,
|
|
133
|
+
sqlStmt: string,
|
|
134
|
+
options?: {
|
|
135
|
+
prepareOptions?: PrepareOptions;
|
|
136
|
+
},
|
|
137
|
+
): Promise<Transaction>;
|
|
138
|
+
|
|
139
|
+
/** Executes a statement that has no result set. */
|
|
140
|
+
execute(
|
|
141
|
+
transaction: Transaction,
|
|
142
|
+
sqlStmt: string,
|
|
143
|
+
parameters?: any[],
|
|
144
|
+
options?: {
|
|
145
|
+
prepareOptions?: PrepareOptions;
|
|
146
|
+
executeOptions?: ExecuteOptions;
|
|
147
|
+
},
|
|
148
|
+
): Promise<void>;
|
|
149
|
+
|
|
150
|
+
/** Executes a statement that returns a single record as [col1, col2, ..., colN]. */
|
|
151
|
+
executeSingleton(
|
|
152
|
+
transaction: Transaction,
|
|
153
|
+
sqlStmt: string,
|
|
154
|
+
parameters?: any[],
|
|
155
|
+
options?: {
|
|
156
|
+
prepareOptions?: PrepareOptions;
|
|
157
|
+
executeOptions?: ExecuteOptions;
|
|
158
|
+
},
|
|
159
|
+
): Promise<any[]>;
|
|
160
|
+
|
|
161
|
+
/** Executes a statement that returns a single record as an object. */
|
|
162
|
+
executeSingletonAsObject<T extends object>(
|
|
163
|
+
transaction: Transaction,
|
|
164
|
+
sqlStmt: string,
|
|
165
|
+
parameters?: any[],
|
|
166
|
+
options?: {
|
|
167
|
+
prepareOptions?: PrepareOptions;
|
|
168
|
+
executeOptions?: ExecuteOptions;
|
|
169
|
+
},
|
|
170
|
+
): Promise<T>;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Executes a statement that returns a single record as [col1, col2, ..., colN].
|
|
174
|
+
* @deprecated since version 2.4.0 and will be removed in next major version. Replaced by executeSingleton.
|
|
175
|
+
*/
|
|
176
|
+
executeReturning(
|
|
177
|
+
transaction: Transaction,
|
|
178
|
+
sqlStmt: string,
|
|
179
|
+
parameters?: any[],
|
|
180
|
+
options?: {
|
|
181
|
+
prepareOptions?: PrepareOptions;
|
|
182
|
+
executeOptions?: ExecuteOptions;
|
|
183
|
+
},
|
|
184
|
+
): Promise<any[]>;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Executes a statement that returns a single record as an object.
|
|
188
|
+
* @deprecated since version 2.4.0 and will be removed in next major version. Replaced by executeSingletonAsObject.
|
|
189
|
+
*/
|
|
190
|
+
executeReturningAsObject<T extends object>(
|
|
191
|
+
transaction: Transaction,
|
|
192
|
+
sqlStmt: string,
|
|
193
|
+
parameters?: any[],
|
|
194
|
+
options?: {
|
|
195
|
+
prepareOptions?: PrepareOptions;
|
|
196
|
+
executeOptions?: ExecuteOptions;
|
|
197
|
+
},
|
|
198
|
+
): Promise<T>;
|
|
199
|
+
|
|
200
|
+
/** Executes a statement that has result set. */
|
|
201
|
+
executeQuery(
|
|
202
|
+
transaction: Transaction,
|
|
203
|
+
sqlStmt: string,
|
|
204
|
+
parameters?: any[],
|
|
205
|
+
options?: {
|
|
206
|
+
prepareOptions?: PrepareOptions;
|
|
207
|
+
executeOptions?: ExecuteQueryOptions;
|
|
208
|
+
},
|
|
209
|
+
): Promise<ResultSet>;
|
|
210
|
+
|
|
211
|
+
queueEvents(names: string[], callBack: (counters: [string, number][]) => Promise<void>): Promise<Events>;
|
|
212
|
+
|
|
213
|
+
/** True if the attachment is connected. */
|
|
214
|
+
readonly isValid: boolean;
|
|
215
|
+
|
|
216
|
+
/** Default transaction options. */
|
|
217
|
+
defaultTransactionOptions?: TransactionOptions;
|
|
218
|
+
|
|
219
|
+
/** Default query's prepare options. */
|
|
220
|
+
defaultPrepareOptions?: PrepareOptions;
|
|
221
|
+
|
|
222
|
+
/** Default query's execute options. */
|
|
223
|
+
defaultExecuteOptions?: ExecuteOptions;
|
|
224
|
+
|
|
225
|
+
/** Default query's executeQuery options. */
|
|
226
|
+
defaultExecuteQueryOptions?: ExecuteQueryOptions;
|
|
227
|
+
|
|
228
|
+
/** Default result set's fetch options. */
|
|
229
|
+
defaultFetchOptions?: FetchOptions;
|
|
197
230
|
}
|
|
198
231
|
|
|
199
232
|
/** Transaction interface. */
|
|
200
233
|
export interface Transaction {
|
|
201
|
-
|
|
202
|
-
|
|
234
|
+
/** Commits and release this transaction object. */
|
|
235
|
+
commit(): Promise<void>;
|
|
236
|
+
|
|
237
|
+
/** Commits and maintains this transaction object for subsequent work. */
|
|
238
|
+
commitRetaining(): Promise<void>;
|
|
203
239
|
|
|
204
|
-
|
|
205
|
-
|
|
240
|
+
/** Rollbacks and release this transaction object. */
|
|
241
|
+
rollback(): Promise<void>;
|
|
206
242
|
|
|
207
|
-
|
|
208
|
-
|
|
243
|
+
/** Rollbacks and maintains this transaction object for subsequent work. */
|
|
244
|
+
rollbackRetaining(): Promise<void>;
|
|
209
245
|
|
|
210
|
-
|
|
211
|
-
|
|
246
|
+
/** True if the transaction is active. */
|
|
247
|
+
readonly isValid: boolean;
|
|
248
|
+
}
|
|
212
249
|
|
|
213
|
-
|
|
214
|
-
|
|
250
|
+
/** StatementType enum */
|
|
251
|
+
export enum StatementType {
|
|
252
|
+
SELECT = 1,
|
|
253
|
+
INSERT = 2,
|
|
254
|
+
UPDATE = 3,
|
|
255
|
+
DELETE = 4,
|
|
256
|
+
DDL = 5,
|
|
257
|
+
GET_SEGMENT = 6,
|
|
258
|
+
PUT_SEGMENT = 7,
|
|
259
|
+
EXEC_PROCEDURE = 8,
|
|
260
|
+
START_TRANS = 9,
|
|
261
|
+
COMMIT = 10,
|
|
262
|
+
ROLLBACK = 11,
|
|
263
|
+
SELECT_FOR_UPD = 12,
|
|
264
|
+
SET_GENERATOR = 13,
|
|
265
|
+
SAVEPOINT = 14,
|
|
215
266
|
}
|
|
216
267
|
|
|
217
268
|
/** Statement interface. */
|
|
218
269
|
export interface Statement {
|
|
219
|
-
|
|
220
|
-
|
|
270
|
+
/** Disposes this statement's resources. */
|
|
271
|
+
dispose(): Promise<void>;
|
|
272
|
+
|
|
273
|
+
/** Executes a prepared statement that uses the SET TRANSACTION command. Returns the new transaction. */
|
|
274
|
+
executeTransaction(transaction: Transaction): Promise<Transaction>;
|
|
221
275
|
|
|
222
|
-
|
|
223
|
-
|
|
276
|
+
/** Executes a prepared statement that has no result set. */
|
|
277
|
+
execute(transaction: Transaction, parameters?: any[], options?: ExecuteOptions): Promise<void>;
|
|
224
278
|
|
|
225
|
-
|
|
226
|
-
|
|
279
|
+
/** Executes a statement that returns a single record as [col1, col2, ..., colN]. */
|
|
280
|
+
executeSingleton(transaction: Transaction, parameters?: any[], executeOptions?: ExecuteOptions): Promise<any[]>;
|
|
227
281
|
|
|
228
|
-
|
|
229
|
-
|
|
282
|
+
/** Executes a statement that returns a single record as an object. */
|
|
283
|
+
executeSingletonAsObject<T extends object>(
|
|
284
|
+
transaction: Transaction,
|
|
285
|
+
parameters?: any[],
|
|
286
|
+
executeOptions?: ExecuteOptions,
|
|
287
|
+
): Promise<T>;
|
|
230
288
|
|
|
231
|
-
|
|
232
|
-
|
|
289
|
+
/**
|
|
290
|
+
* Executes a statement that returns a single record as [col1, col2, ..., colN].
|
|
291
|
+
* @deprecated since version 2.4.0 and will be removed in next major version. Replaced by executeSingleton.
|
|
292
|
+
*/
|
|
293
|
+
executeReturning(transaction: Transaction, parameters?: any[], executeOptions?: ExecuteOptions): Promise<any[]>;
|
|
233
294
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
295
|
+
/**
|
|
296
|
+
* Executes a statement that returns a single record as an object.
|
|
297
|
+
* @deprecated since version 2.4.0 and will be removed in next major version. Replaced by executeSingletonAsObject.
|
|
298
|
+
*/
|
|
299
|
+
executeReturningAsObject<T extends object>(
|
|
300
|
+
transaction: Transaction,
|
|
301
|
+
parameters?: any[],
|
|
302
|
+
options?: ExecuteOptions,
|
|
303
|
+
): Promise<T>;
|
|
239
304
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
* @deprecated since version 2.4.0 and will be removed in next major version. Replaced by executeSingletonAsObject.
|
|
243
|
-
*/
|
|
244
|
-
executeReturningAsObject<T extends object>(transaction: Transaction, parameters?: any[],
|
|
245
|
-
options?: ExecuteOptions): Promise<T>;
|
|
305
|
+
/** Executes a prepared statement that has result set. */
|
|
306
|
+
executeQuery(transaction: Transaction, parameters?: any[], options?: ExecuteQueryOptions): Promise<ResultSet>;
|
|
246
307
|
|
|
247
|
-
|
|
248
|
-
|
|
308
|
+
/**
|
|
309
|
+
* Set cursor name of a SELECT ... FOR UPDATE statement.
|
|
310
|
+
*
|
|
311
|
+
* Use with ResultSet.fetch({ fetchSize: 1 }) and other statement with WHERE CURRENT OF <cursorName>.
|
|
312
|
+
*/
|
|
313
|
+
setCursorName(cursorName: string): Promise<void>;
|
|
249
314
|
|
|
250
|
-
|
|
251
|
-
* Set cursor name of a SELECT ... FOR UPDATE statement.
|
|
252
|
-
*
|
|
253
|
-
* Use with ResultSet.fetch({ fetchSize: 1 }) and other statement with WHERE CURRENT OF <cursorName>.
|
|
254
|
-
*/
|
|
255
|
-
setCursorName(cursorName: string): Promise<void>;
|
|
315
|
+
getExecPathText(): Promise<string | undefined>;
|
|
256
316
|
|
|
257
|
-
|
|
317
|
+
/** True if the statement has not been disposed. */
|
|
318
|
+
readonly isValid: boolean;
|
|
258
319
|
|
|
259
|
-
|
|
260
|
-
|
|
320
|
+
/** Gets the statement type. */
|
|
321
|
+
readonly type: Promise<StatementType>;
|
|
261
322
|
|
|
262
|
-
|
|
263
|
-
|
|
323
|
+
/** Gets the query's result columns labels. Returns empty array for queries without result. */
|
|
324
|
+
readonly columnLabels: Promise<string[]>;
|
|
264
325
|
|
|
265
|
-
|
|
266
|
-
|
|
326
|
+
/** When true, query result must be obtained with method executeQuery. */
|
|
327
|
+
readonly hasResultSet: boolean;
|
|
267
328
|
|
|
268
|
-
|
|
269
|
-
|
|
329
|
+
/** Default query's execute options. */
|
|
330
|
+
defaultExecuteOptions?: ExecuteOptions;
|
|
270
331
|
|
|
271
|
-
|
|
272
|
-
|
|
332
|
+
/** Default query's executeQuery options. */
|
|
333
|
+
defaultExecuteQueryOptions?: ExecuteQueryOptions;
|
|
273
334
|
|
|
274
|
-
|
|
275
|
-
|
|
335
|
+
/** Default result set's fetch options. */
|
|
336
|
+
defaultFetchOptions?: FetchOptions;
|
|
276
337
|
}
|
|
277
338
|
|
|
278
339
|
/** ResultSet interface. */
|
|
279
340
|
export interface ResultSet {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
341
|
+
/** Closes this result set. */
|
|
342
|
+
close(): Promise<void>;
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Fetchs data from this result set as [col1, col2, ..., colN][].
|
|
346
|
+
*
|
|
347
|
+
* If an exception is found after fetching a row but before reaching options.fetchSize, its throw is delayed for the next fetch call.
|
|
348
|
+
*
|
|
349
|
+
* If result set has no more rows, returns an empty array.
|
|
350
|
+
*/
|
|
351
|
+
fetch(options?: FetchOptions): Promise<any[][]>;
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Fetchs data from this result set as T[].
|
|
355
|
+
* Where <T> represents your object interface.
|
|
356
|
+
*
|
|
357
|
+
* If an exception is found after fetching a row but before reaching options.fetchSize, its throw is delayed for the next fetch call.
|
|
358
|
+
*
|
|
359
|
+
* If result set has no more rows, returns an empty array.
|
|
360
|
+
*/
|
|
361
|
+
fetchAsObject<T extends object>(options?: FetchOptions): Promise<T[]>;
|
|
362
|
+
|
|
363
|
+
/** True if the ResultSet is open. */
|
|
364
|
+
readonly isValid: boolean;
|
|
365
|
+
|
|
366
|
+
/** Default result set's fetch options. */
|
|
367
|
+
defaultFetchOptions?: FetchOptions;
|
|
307
368
|
}
|
|
308
369
|
|
|
309
370
|
export interface Events {
|
|
310
|
-
|
|
371
|
+
cancel(): Promise<void>;
|
|
311
372
|
|
|
312
|
-
|
|
313
|
-
|
|
373
|
+
/** True if the events' attachment is valid. */
|
|
374
|
+
readonly isValid: boolean;
|
|
314
375
|
}
|
|
315
376
|
|
|
316
377
|
/** Blob class. */
|
|
317
378
|
export class Blob {
|
|
318
|
-
|
|
319
|
-
|
|
379
|
+
/** Gets the blob's attachment. */
|
|
380
|
+
readonly attachment: Attachment;
|
|
320
381
|
|
|
321
|
-
|
|
322
|
-
|
|
382
|
+
/** Gets the blob's id. */
|
|
383
|
+
readonly id = new Uint8Array(8);
|
|
323
384
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
385
|
+
constructor(attachment: Attachment, id: Uint8Array) {
|
|
386
|
+
this.attachment = attachment;
|
|
387
|
+
this.id.set(id);
|
|
388
|
+
}
|
|
328
389
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
390
|
+
/** True if the blob's attachment is valid. */
|
|
391
|
+
get isValid(): boolean {
|
|
392
|
+
return this.attachment.isValid;
|
|
393
|
+
}
|
|
333
394
|
}
|
|
334
395
|
|
|
335
396
|
export enum BlobSeekWhence {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
397
|
+
START = 0,
|
|
398
|
+
CURRENT = 1,
|
|
399
|
+
END = 2,
|
|
339
400
|
}
|
|
340
401
|
|
|
341
402
|
/** BlobStream class. */
|
|
342
403
|
export abstract class BlobStream {
|
|
343
|
-
|
|
344
|
-
|
|
404
|
+
/** Gets the blob's. */
|
|
405
|
+
readonly blob: Blob;
|
|
345
406
|
|
|
346
|
-
|
|
347
|
-
|
|
407
|
+
/** Gets the blob's stream length in bytes. */
|
|
408
|
+
abstract get length(): Promise<number>;
|
|
348
409
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
410
|
+
protected constructor(blob: Blob) {
|
|
411
|
+
this.blob = blob;
|
|
412
|
+
}
|
|
352
413
|
|
|
353
|
-
|
|
354
|
-
|
|
414
|
+
/** Closes the blob's stream. */
|
|
415
|
+
abstract close(): Promise<void>;
|
|
355
416
|
|
|
356
|
-
|
|
357
|
-
|
|
417
|
+
/** Cancels the blob's creation. */
|
|
418
|
+
abstract cancel(): Promise<void>;
|
|
358
419
|
|
|
359
|
-
|
|
360
|
-
|
|
420
|
+
/** Seeks into the blob stream and return the new position. */
|
|
421
|
+
abstract seek(offset: number, whence?: BlobSeekWhence): Promise<number>;
|
|
361
422
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
423
|
+
/**
|
|
424
|
+
* Reads data from the blob and return the number of bytes read or -1 for end-of-stream.
|
|
425
|
+
* The number of bytes read may be less than the buffer' size while more data to be read exists.
|
|
426
|
+
*/
|
|
427
|
+
abstract read(buffer: Buffer): Promise<number>;
|
|
367
428
|
|
|
368
|
-
|
|
369
|
-
|
|
429
|
+
/** Writes data to the blob. */
|
|
430
|
+
abstract write(buffer: Buffer): Promise<void>;
|
|
370
431
|
|
|
371
|
-
|
|
372
|
-
|
|
432
|
+
/** True if the blob stream is open. */
|
|
433
|
+
abstract get isValid(): boolean;
|
|
373
434
|
}
|
|
374
435
|
|
|
375
436
|
/** TIME WITH TIME ZONE and TIMESTAMP WITH TIME ZONE to be sent as parameter */
|
|
376
437
|
export interface ZonedDate {
|
|
377
|
-
|
|
378
|
-
|
|
438
|
+
date: Date;
|
|
439
|
+
timeZone: string;
|
|
379
440
|
}
|
|
380
441
|
|
|
381
442
|
/** TIME WITH TIME ZONE and TIMESTAMP WITH TIME ZONE returned by Firebird */
|
|
382
443
|
export interface ZonedDateEx extends ZonedDate {
|
|
383
|
-
|
|
444
|
+
offset: number;
|
|
384
445
|
}
|