node-firebird-driver 3.2.0 → 3.3.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 +7 -4
- 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.d.ts +0 -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 +6 -6
- 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 -2
- package/dist/lib/impl/fb-util.js +107 -88
- 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.js +4 -2
- package/dist/lib/impl/statement.js.map +1 -1
- package/dist/lib/impl/time-zones.js +7 -6
- 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 +8 -2
- package/dist/lib/index.js +7 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/test/tests.js +177 -70
- 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 +154 -127
- package/src/lib/impl/time-zones.ts +643 -641
- package/src/lib/impl/transaction.ts +37 -38
- package/src/lib/index.ts +325 -285
- package/src/test/tests.ts +996 -860
- package/tsconfig.json +7 -13
package/src/lib/index.ts
CHANGED
|
@@ -1,384 +1,424 @@
|
|
|
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>;
|
|
203
236
|
|
|
204
|
-
|
|
205
|
-
|
|
237
|
+
/** Commits and maintains this transaction object for subsequent work. */
|
|
238
|
+
commitRetaining(): Promise<void>;
|
|
206
239
|
|
|
207
|
-
|
|
208
|
-
|
|
240
|
+
/** Rollbacks and release this transaction object. */
|
|
241
|
+
rollback(): Promise<void>;
|
|
209
242
|
|
|
210
|
-
|
|
211
|
-
|
|
243
|
+
/** Rollbacks and maintains this transaction object for subsequent work. */
|
|
244
|
+
rollbackRetaining(): Promise<void>;
|
|
212
245
|
|
|
213
|
-
|
|
214
|
-
|
|
246
|
+
/** True if the transaction is active. */
|
|
247
|
+
readonly isValid: boolean;
|
|
215
248
|
}
|
|
216
249
|
|
|
217
250
|
/** Statement interface. */
|
|
218
251
|
export interface Statement {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
252
|
+
/** Disposes this statement's resources. */
|
|
253
|
+
dispose(): Promise<void>;
|
|
254
|
+
|
|
255
|
+
/** Executes a prepared statement that uses the SET TRANSACTION command. Returns the new transaction. */
|
|
256
|
+
executeTransaction(transaction: Transaction): Promise<Transaction>;
|
|
257
|
+
|
|
258
|
+
/** Executes a prepared statement that has no result set. */
|
|
259
|
+
execute(transaction: Transaction, parameters?: any[], options?: ExecuteOptions): Promise<void>;
|
|
260
|
+
|
|
261
|
+
/** Executes a statement that returns a single record as [col1, col2, ..., colN]. */
|
|
262
|
+
executeSingleton(transaction: Transaction, parameters?: any[], executeOptions?: ExecuteOptions): Promise<any[]>;
|
|
263
|
+
|
|
264
|
+
/** Executes a statement that returns a single record as an object. */
|
|
265
|
+
executeSingletonAsObject<T extends object>(
|
|
266
|
+
transaction: Transaction,
|
|
267
|
+
parameters?: any[],
|
|
268
|
+
executeOptions?: ExecuteOptions,
|
|
269
|
+
): Promise<T>;
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Executes a statement that returns a single record as [col1, col2, ..., colN].
|
|
273
|
+
* @deprecated since version 2.4.0 and will be removed in next major version. Replaced by executeSingleton.
|
|
274
|
+
*/
|
|
275
|
+
executeReturning(transaction: Transaction, parameters?: any[], executeOptions?: ExecuteOptions): Promise<any[]>;
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Executes a statement that returns a single record as an object.
|
|
279
|
+
* @deprecated since version 2.4.0 and will be removed in next major version. Replaced by executeSingletonAsObject.
|
|
280
|
+
*/
|
|
281
|
+
executeReturningAsObject<T extends object>(
|
|
282
|
+
transaction: Transaction,
|
|
283
|
+
parameters?: any[],
|
|
284
|
+
options?: ExecuteOptions,
|
|
285
|
+
): Promise<T>;
|
|
286
|
+
|
|
287
|
+
/** Executes a prepared statement that has result set. */
|
|
288
|
+
executeQuery(transaction: Transaction, parameters?: any[], options?: ExecuteQueryOptions): Promise<ResultSet>;
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Set cursor name of a SELECT ... FOR UPDATE statement.
|
|
292
|
+
*
|
|
293
|
+
* Use with ResultSet.fetch({ fetchSize: 1 }) and other statement with WHERE CURRENT OF <cursorName>.
|
|
294
|
+
*/
|
|
295
|
+
setCursorName(cursorName: string): Promise<void>;
|
|
296
|
+
|
|
297
|
+
getExecPathText(): Promise<string | undefined>;
|
|
298
|
+
|
|
299
|
+
/** True if the statement has not been disposed. */
|
|
300
|
+
readonly isValid: boolean;
|
|
301
|
+
|
|
302
|
+
/** Gets the query's result columns labels. Returns empty array for queries without result. */
|
|
303
|
+
readonly columnLabels: Promise<string[]>;
|
|
304
|
+
|
|
305
|
+
/** When true, query result must be obtained with method executeQuery. */
|
|
306
|
+
readonly hasResultSet: boolean;
|
|
307
|
+
|
|
308
|
+
/** Default query's execute options. */
|
|
309
|
+
defaultExecuteOptions?: ExecuteOptions;
|
|
310
|
+
|
|
311
|
+
/** Default query's executeQuery options. */
|
|
312
|
+
defaultExecuteQueryOptions?: ExecuteQueryOptions;
|
|
313
|
+
|
|
314
|
+
/** Default result set's fetch options. */
|
|
315
|
+
defaultFetchOptions?: FetchOptions;
|
|
276
316
|
}
|
|
277
317
|
|
|
278
318
|
/** ResultSet interface. */
|
|
279
319
|
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
|
-
|
|
320
|
+
/** Closes this result set. */
|
|
321
|
+
close(): Promise<void>;
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Fetchs data from this result set as [col1, col2, ..., colN][].
|
|
325
|
+
*
|
|
326
|
+
* If an exception is found after fetching a row but before reaching options.fetchSize, its throw is delayed for the next fetch call.
|
|
327
|
+
*
|
|
328
|
+
* If result set has no more rows, returns an empty array.
|
|
329
|
+
*/
|
|
330
|
+
fetch(options?: FetchOptions): Promise<any[][]>;
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Fetchs data from this result set as T[].
|
|
334
|
+
* Where <T> represents your object interface.
|
|
335
|
+
*
|
|
336
|
+
* If an exception is found after fetching a row but before reaching options.fetchSize, its throw is delayed for the next fetch call.
|
|
337
|
+
*
|
|
338
|
+
* If result set has no more rows, returns an empty array.
|
|
339
|
+
*/
|
|
340
|
+
fetchAsObject<T extends object>(options?: FetchOptions): Promise<T[]>;
|
|
341
|
+
|
|
342
|
+
/** True if the ResultSet is open. */
|
|
343
|
+
readonly isValid: boolean;
|
|
344
|
+
|
|
345
|
+
/** Default result set's fetch options. */
|
|
346
|
+
defaultFetchOptions?: FetchOptions;
|
|
307
347
|
}
|
|
308
348
|
|
|
309
349
|
export interface Events {
|
|
310
|
-
|
|
350
|
+
cancel(): Promise<void>;
|
|
311
351
|
|
|
312
|
-
|
|
313
|
-
|
|
352
|
+
/** True if the events' attachment is valid. */
|
|
353
|
+
readonly isValid: boolean;
|
|
314
354
|
}
|
|
315
355
|
|
|
316
356
|
/** Blob class. */
|
|
317
357
|
export class Blob {
|
|
318
|
-
|
|
319
|
-
|
|
358
|
+
/** Gets the blob's attachment. */
|
|
359
|
+
readonly attachment: Attachment;
|
|
320
360
|
|
|
321
|
-
|
|
322
|
-
|
|
361
|
+
/** Gets the blob's id. */
|
|
362
|
+
readonly id = new Uint8Array(8);
|
|
323
363
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
364
|
+
constructor(attachment: Attachment, id: Uint8Array) {
|
|
365
|
+
this.attachment = attachment;
|
|
366
|
+
this.id.set(id);
|
|
367
|
+
}
|
|
328
368
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
369
|
+
/** True if the blob's attachment is valid. */
|
|
370
|
+
get isValid(): boolean {
|
|
371
|
+
return this.attachment.isValid;
|
|
372
|
+
}
|
|
333
373
|
}
|
|
334
374
|
|
|
335
375
|
export enum BlobSeekWhence {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
376
|
+
START = 0,
|
|
377
|
+
CURRENT = 1,
|
|
378
|
+
END = 2,
|
|
339
379
|
}
|
|
340
380
|
|
|
341
381
|
/** BlobStream class. */
|
|
342
382
|
export abstract class BlobStream {
|
|
343
|
-
|
|
344
|
-
|
|
383
|
+
/** Gets the blob's. */
|
|
384
|
+
readonly blob: Blob;
|
|
345
385
|
|
|
346
|
-
|
|
347
|
-
|
|
386
|
+
/** Gets the blob's stream length in bytes. */
|
|
387
|
+
abstract get length(): Promise<number>;
|
|
348
388
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
389
|
+
protected constructor(blob: Blob) {
|
|
390
|
+
this.blob = blob;
|
|
391
|
+
}
|
|
352
392
|
|
|
353
|
-
|
|
354
|
-
|
|
393
|
+
/** Closes the blob's stream. */
|
|
394
|
+
abstract close(): Promise<void>;
|
|
355
395
|
|
|
356
|
-
|
|
357
|
-
|
|
396
|
+
/** Cancels the blob's creation. */
|
|
397
|
+
abstract cancel(): Promise<void>;
|
|
358
398
|
|
|
359
|
-
|
|
360
|
-
|
|
399
|
+
/** Seeks into the blob stream and return the new position. */
|
|
400
|
+
abstract seek(offset: number, whence?: BlobSeekWhence): Promise<number>;
|
|
361
401
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
402
|
+
/**
|
|
403
|
+
* Reads data from the blob and return the number of bytes read or -1 for end-of-stream.
|
|
404
|
+
* The number of bytes read may be less than the buffer' size while more data to be read exists.
|
|
405
|
+
*/
|
|
406
|
+
abstract read(buffer: Buffer): Promise<number>;
|
|
367
407
|
|
|
368
|
-
|
|
369
|
-
|
|
408
|
+
/** Writes data to the blob. */
|
|
409
|
+
abstract write(buffer: Buffer): Promise<void>;
|
|
370
410
|
|
|
371
|
-
|
|
372
|
-
|
|
411
|
+
/** True if the blob stream is open. */
|
|
412
|
+
abstract get isValid(): boolean;
|
|
373
413
|
}
|
|
374
414
|
|
|
375
415
|
/** TIME WITH TIME ZONE and TIMESTAMP WITH TIME ZONE to be sent as parameter */
|
|
376
416
|
export interface ZonedDate {
|
|
377
|
-
|
|
378
|
-
|
|
417
|
+
date: Date;
|
|
418
|
+
timeZone: string;
|
|
379
419
|
}
|
|
380
420
|
|
|
381
421
|
/** TIME WITH TIME ZONE and TIMESTAMP WITH TIME ZONE returned by Firebird */
|
|
382
422
|
export interface ZonedDateEx extends ZonedDate {
|
|
383
|
-
|
|
423
|
+
offset: number;
|
|
384
424
|
}
|