node-firebird-driver 2.3.0 → 3.0.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/dist/lib/impl/attachment.d.ts +14 -3
- package/dist/lib/impl/attachment.js +112 -138
- package/dist/lib/impl/attachment.js.map +1 -1
- package/dist/lib/impl/blob.d.ts +3 -1
- package/dist/lib/impl/blob.js +11 -25
- package/dist/lib/impl/blob.js.map +1 -1
- package/dist/lib/impl/client.d.ts +1 -0
- package/dist/lib/impl/client.js +24 -36
- package/dist/lib/impl/client.js.map +1 -1
- package/dist/lib/impl/events.d.ts +1 -0
- package/dist/lib/impl/events.js +9 -18
- package/dist/lib/impl/events.js.map +1 -1
- package/dist/lib/impl/fb-util.d.ts +34 -5
- package/dist/lib/impl/fb-util.js +82 -42
- package/dist/lib/impl/fb-util.js.map +1 -1
- package/dist/lib/impl/index.js +5 -1
- package/dist/lib/impl/index.js.map +1 -1
- package/dist/lib/impl/resultset.d.ts +1 -0
- package/dist/lib/impl/resultset.js +33 -46
- package/dist/lib/impl/resultset.js.map +1 -1
- package/dist/lib/impl/statement.d.ts +6 -0
- package/dist/lib/impl/statement.js +47 -57
- package/dist/lib/impl/statement.js.map +1 -1
- package/dist/lib/impl/transaction.d.ts +1 -0
- package/dist/lib/impl/transaction.js +20 -34
- package/dist/lib/impl/transaction.js.map +1 -1
- package/dist/lib/index.d.ts +57 -3
- package/dist/lib/index.js +4 -0
- package/dist/lib/index.js.map +1 -1
- package/dist/test/tests.js +385 -301
- package/dist/test/tests.js.map +1 -1
- package/package.json +3 -3
- package/src/lib/impl/attachment.ts +32 -9
- package/src/lib/impl/blob.ts +6 -1
- package/src/lib/impl/client.ts +5 -1
- package/src/lib/impl/events.ts +5 -1
- package/src/lib/impl/fb-util.ts +55 -0
- package/src/lib/impl/resultset.ts +5 -1
- package/src/lib/impl/statement.ts +21 -4
- package/src/lib/impl/transaction.ts +5 -1
- package/src/lib/index.ts +77 -3
- package/src/test/tests.ts +123 -3
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.AbstractStatement = void 0;
|
|
13
4
|
/** AbstractStatement implementation. */
|
|
@@ -16,67 +7,66 @@ class AbstractStatement {
|
|
|
16
7
|
this.attachment = attachment;
|
|
17
8
|
}
|
|
18
9
|
/** Disposes this statement's resources. */
|
|
19
|
-
dispose() {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
this.attachment = undefined;
|
|
27
|
-
});
|
|
10
|
+
async dispose() {
|
|
11
|
+
this.check();
|
|
12
|
+
if (this.resultSet)
|
|
13
|
+
await this.resultSet.close();
|
|
14
|
+
await this.internalDispose();
|
|
15
|
+
this.attachment.statements.delete(this);
|
|
16
|
+
this.attachment = undefined;
|
|
28
17
|
}
|
|
29
18
|
/** Executes a prepared statement that uses the SET TRANSACTION command. Returns the new transaction. */
|
|
30
|
-
executeTransaction(transaction) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return yield this.internalExecuteTransaction(transaction);
|
|
35
|
-
});
|
|
19
|
+
async executeTransaction(transaction) {
|
|
20
|
+
this.check();
|
|
21
|
+
//// TODO: check opened resultSet.
|
|
22
|
+
return await this.internalExecuteTransaction(transaction);
|
|
36
23
|
}
|
|
37
24
|
/** Executes a prepared statement that has no result set. */
|
|
38
|
-
execute(transaction, parameters, options) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
yield this.internalExecute(transaction, parameters, options || this.attachment.defaultExecuteOptions || this.attachment.client.defaultExecuteOptions);
|
|
43
|
-
});
|
|
25
|
+
async execute(transaction, parameters, options) {
|
|
26
|
+
this.check();
|
|
27
|
+
//// TODO: check opened resultSet.
|
|
28
|
+
await this.internalExecute(transaction, parameters, options || this.attachment.defaultExecuteOptions || this.attachment.client.defaultExecuteOptions);
|
|
44
29
|
}
|
|
45
30
|
/** Executes a statement that returns a single record as [col1, col2, ..., colN]. */
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return yield this.internalExecute(transaction, parameters, options || this.attachment.defaultExecuteOptions || this.attachment.client.defaultExecuteOptions);
|
|
51
|
-
});
|
|
31
|
+
async executeSingleton(transaction, parameters, options) {
|
|
32
|
+
this.check();
|
|
33
|
+
//// TODO: check opened resultSet.
|
|
34
|
+
return await this.internalExecute(transaction, parameters, options || this.attachment.defaultExecuteOptions || this.attachment.client.defaultExecuteOptions);
|
|
52
35
|
}
|
|
53
36
|
/** Executes a statement that returns a single record as an object. */
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
obj[col] = v;
|
|
64
|
-
});
|
|
65
|
-
return obj;
|
|
37
|
+
async executeSingletonAsObject(transaction, parameters, options) {
|
|
38
|
+
this.check();
|
|
39
|
+
const row = await this.executeSingleton(transaction, parameters, options);
|
|
40
|
+
const cols = (await this?.columnLabels) || [];
|
|
41
|
+
const obj = {};
|
|
42
|
+
// Loop on row column value.
|
|
43
|
+
row.forEach((v, idx) => {
|
|
44
|
+
const col = cols[idx];
|
|
45
|
+
obj[col] = v;
|
|
66
46
|
});
|
|
47
|
+
return obj;
|
|
48
|
+
}
|
|
49
|
+
/** Executes a statement that returns a single record as [col1, col2, ..., colN]. */
|
|
50
|
+
async executeReturning(transaction, parameters, options) {
|
|
51
|
+
return await this.executeSingleton(transaction, parameters, options);
|
|
52
|
+
}
|
|
53
|
+
/** Executes a statement that returns a single record as an object. */
|
|
54
|
+
async executeReturningAsObject(transaction, parameters, options) {
|
|
55
|
+
return await this.executeSingletonAsObject(transaction, parameters, options);
|
|
67
56
|
}
|
|
68
57
|
/** Executes a prepared statement that has result set. */
|
|
69
|
-
executeQuery(transaction, parameters, options) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
58
|
+
async executeQuery(transaction, parameters, options) {
|
|
59
|
+
this.check();
|
|
60
|
+
//// TODO: check opened resultSet.
|
|
61
|
+
const resultSet = await this.internalExecuteQuery(transaction, parameters, options || this.attachment.defaultExecuteQueryOptions || this.attachment.client.defaultExecuteQueryOptions);
|
|
62
|
+
this.resultSet = resultSet;
|
|
63
|
+
return resultSet;
|
|
64
|
+
}
|
|
65
|
+
get isValid() {
|
|
66
|
+
return !!this.attachment;
|
|
77
67
|
}
|
|
78
68
|
check() {
|
|
79
|
-
if (!this.
|
|
69
|
+
if (!this.isValid)
|
|
80
70
|
throw new Error('Statement is already disposed.');
|
|
81
71
|
}
|
|
82
72
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statement.js","sourceRoot":"","sources":["../../../src/lib/impl/statement.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"statement.js","sourceRoot":"","sources":["../../../src/lib/impl/statement.ts"],"names":[],"mappings":";;;AAYA,wCAAwC;AACxC,MAAsB,iBAAiB;IAoBtC,YAA6B,UAA+B;QAA/B,eAAU,GAAV,UAAU,CAAqB;IAC5D,CAAC;IAED,2CAA2C;IAC3C,KAAK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O,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC;IAC1B,CAAC;IAEO,KAAK;QACZ,IAAI,CAAC,IAAI,CAAC,OAAO;YAChB,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACpD,CAAC;CAUD;AAzHD,8CAyHC"}
|
|
@@ -12,6 +12,7 @@ export declare abstract class AbstractTransaction implements Transaction {
|
|
|
12
12
|
rollback(): Promise<void>;
|
|
13
13
|
/** Rollbacks and maintains this transaction object for subsequent work. */
|
|
14
14
|
rollbackRetaining(): Promise<void>;
|
|
15
|
+
get isValid(): boolean;
|
|
15
16
|
private check;
|
|
16
17
|
protected abstract internalCommit(): Promise<void>;
|
|
17
18
|
protected abstract internalCommitRetaining(): Promise<void>;
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.AbstractTransaction = void 0;
|
|
13
4
|
/** AbstractTransaction implementation. */
|
|
@@ -16,39 +7,34 @@ class AbstractTransaction {
|
|
|
16
7
|
this.attachment = attachment;
|
|
17
8
|
}
|
|
18
9
|
/** Commits and release this transaction object. */
|
|
19
|
-
commit() {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
this.attachment = undefined;
|
|
25
|
-
});
|
|
10
|
+
async commit() {
|
|
11
|
+
this.check();
|
|
12
|
+
await this.internalCommit();
|
|
13
|
+
this.attachment.transactions.delete(this);
|
|
14
|
+
this.attachment = undefined;
|
|
26
15
|
}
|
|
27
16
|
/** Commits and maintains this transaction object for subsequent work. */
|
|
28
|
-
commitRetaining() {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return yield this.internalCommitRetaining();
|
|
32
|
-
});
|
|
17
|
+
async commitRetaining() {
|
|
18
|
+
this.check();
|
|
19
|
+
return await this.internalCommitRetaining();
|
|
33
20
|
}
|
|
34
21
|
/** Rollbacks and release this transaction object. */
|
|
35
|
-
rollback() {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
this.attachment = undefined;
|
|
41
|
-
});
|
|
22
|
+
async rollback() {
|
|
23
|
+
this.check();
|
|
24
|
+
await this.internalRollback();
|
|
25
|
+
this.attachment.transactions.delete(this);
|
|
26
|
+
this.attachment = undefined;
|
|
42
27
|
}
|
|
43
28
|
/** Rollbacks and maintains this transaction object for subsequent work. */
|
|
44
|
-
rollbackRetaining() {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
29
|
+
async rollbackRetaining() {
|
|
30
|
+
this.check();
|
|
31
|
+
return await this.internalRollbackRetaining();
|
|
32
|
+
}
|
|
33
|
+
get isValid() {
|
|
34
|
+
return !!this.attachment;
|
|
49
35
|
}
|
|
50
36
|
check() {
|
|
51
|
-
if (!this.
|
|
37
|
+
if (!this.isValid)
|
|
52
38
|
throw new Error('Transaction is already committed or rolled back.');
|
|
53
39
|
}
|
|
54
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../../src/lib/impl/transaction.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../../src/lib/impl/transaction.ts"],"names":[],"mappings":";;;AAKA,0CAA0C;AAC1C,MAAsB,mBAAmB;IACxC,YAA6B,UAA+B;QAA/B,eAAU,GAAV,UAAU,CAAqB;IAC5D,CAAC;IAED,mDAAmD;IACnD,KAAK,CAAC,MAAM;QACX,IAAI,CAAC,KAAK,EAAE,CAAC;QAEb,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;QAE5B,IAAI,CAAC,UAAW,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC3C,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAC7B,CAAC;IAED,yEAAyE;IACzE,KAAK,CAAC,eAAe;QACpB,IAAI,CAAC,KAAK,EAAE,CAAC;QAEb,OAAO,MAAM,IAAI,CAAC,uBAAuB,EAAE,CAAC;IAC7C,CAAC;IAED,qDAAqD;IACrD,KAAK,CAAC,QAAQ;QACb,IAAI,CAAC,KAAK,EAAE,CAAC;QAEb,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAE9B,IAAI,CAAC,UAAW,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC3C,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAC7B,CAAC;IAED,2EAA2E;IAC3E,KAAK,CAAC,iBAAiB;QACtB,IAAI,CAAC,KAAK,EAAE,CAAC;QAEb,OAAO,MAAM,IAAI,CAAC,yBAAyB,EAAE,CAAC;IAC/C,CAAC;IAED,IAAI,OAAO;QACV,OAAO,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC;IAC1B,CAAC;IAEO,KAAK;QACZ,IAAI,CAAC,IAAI,CAAC,OAAO;YAChB,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACtE,CAAC;CAMD;AAnDD,kDAmDC"}
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ export interface Client {
|
|
|
7
7
|
connect(uri: string, options?: ConnectOptions): Promise<Attachment>;
|
|
8
8
|
/** Creates a database. */
|
|
9
9
|
createDatabase(uri: string, options?: CreateDatabaseOptions): Promise<Attachment>;
|
|
10
|
+
/** True if the client has not been disposed. */
|
|
11
|
+
readonly isValid: boolean;
|
|
10
12
|
/** Default connect options. */
|
|
11
13
|
defaultConnectOptions?: ConnectOptions;
|
|
12
14
|
/** Default create database options. */
|
|
@@ -67,6 +69,10 @@ export interface FetchOptions {
|
|
|
67
69
|
/** Number of rows to fetch. */
|
|
68
70
|
fetchSize?: number;
|
|
69
71
|
}
|
|
72
|
+
/** CreateBlobOptions interface. */
|
|
73
|
+
export interface CreateBlobOptions {
|
|
74
|
+
type?: 'SEGMENTED' | 'STREAM';
|
|
75
|
+
}
|
|
70
76
|
/** Attachment interface. */
|
|
71
77
|
export interface Attachment {
|
|
72
78
|
/** Disconnects this attachment. */
|
|
@@ -74,7 +80,7 @@ export interface Attachment {
|
|
|
74
80
|
/** Drops the database and release this attachment. */
|
|
75
81
|
dropDatabase(): Promise<void>;
|
|
76
82
|
/** Creates a blob and return its stream. */
|
|
77
|
-
createBlob(transaction: Transaction): Promise<BlobStream>;
|
|
83
|
+
createBlob(transaction: Transaction, options?: CreateBlobOptions): Promise<BlobStream>;
|
|
78
84
|
/** Opens a blob's stream. */
|
|
79
85
|
openBlob(transaction: Transaction, blob: Blob): Promise<BlobStream>;
|
|
80
86
|
/** Starts a new transaction. */
|
|
@@ -91,11 +97,27 @@ export interface Attachment {
|
|
|
91
97
|
executeOptions?: ExecuteOptions;
|
|
92
98
|
}): Promise<void>;
|
|
93
99
|
/** Executes a statement that returns a single record as [col1, col2, ..., colN]. */
|
|
94
|
-
|
|
100
|
+
executeSingleton(transaction: Transaction, sqlStmt: string, parameters?: any[], options?: {
|
|
95
101
|
prepareOptions?: PrepareOptions;
|
|
96
102
|
executeOptions?: ExecuteOptions;
|
|
97
103
|
}): Promise<any[]>;
|
|
98
104
|
/** Executes a statement that returns a single record as an object. */
|
|
105
|
+
executeSingletonAsObject<T extends object>(transaction: Transaction, sqlStmt: string, parameters?: any[], options?: {
|
|
106
|
+
prepareOptions?: PrepareOptions;
|
|
107
|
+
executeOptions?: ExecuteOptions;
|
|
108
|
+
}): Promise<T>;
|
|
109
|
+
/**
|
|
110
|
+
* Executes a statement that returns a single record as [col1, col2, ..., colN].
|
|
111
|
+
* @deprecated since version 2.4.0 and will be removed in next major version. Replaced by executeSingleton.
|
|
112
|
+
*/
|
|
113
|
+
executeReturning(transaction: Transaction, sqlStmt: string, parameters?: any[], options?: {
|
|
114
|
+
prepareOptions?: PrepareOptions;
|
|
115
|
+
executeOptions?: ExecuteOptions;
|
|
116
|
+
}): Promise<any[]>;
|
|
117
|
+
/**
|
|
118
|
+
* Executes a statement that returns a single record as an object.
|
|
119
|
+
* @deprecated since version 2.4.0 and will be removed in next major version. Replaced by executeSingletonAsObject.
|
|
120
|
+
*/
|
|
99
121
|
executeReturningAsObject<T extends object>(transaction: Transaction, sqlStmt: string, parameters?: any[], options?: {
|
|
100
122
|
prepareOptions?: PrepareOptions;
|
|
101
123
|
executeOptions?: ExecuteOptions;
|
|
@@ -106,6 +128,8 @@ export interface Attachment {
|
|
|
106
128
|
executeOptions?: ExecuteQueryOptions;
|
|
107
129
|
}): Promise<ResultSet>;
|
|
108
130
|
queueEvents(names: string[], callBack: (counters: [string, number][]) => Promise<void>): Promise<Events>;
|
|
131
|
+
/** True if the attachment is connected. */
|
|
132
|
+
readonly isValid: boolean;
|
|
109
133
|
/** Default transaction options. */
|
|
110
134
|
defaultTransactionOptions?: TransactionOptions;
|
|
111
135
|
/** Default query's prepare options. */
|
|
@@ -127,6 +151,8 @@ export interface Transaction {
|
|
|
127
151
|
rollback(): Promise<void>;
|
|
128
152
|
/** Rollbacks and maintains this transaction object for subsequent work. */
|
|
129
153
|
rollbackRetaining(): Promise<void>;
|
|
154
|
+
/** True if the transaction is active. */
|
|
155
|
+
readonly isValid: boolean;
|
|
130
156
|
}
|
|
131
157
|
/** Statement interface. */
|
|
132
158
|
export interface Statement {
|
|
@@ -137,8 +163,18 @@ export interface Statement {
|
|
|
137
163
|
/** Executes a prepared statement that has no result set. */
|
|
138
164
|
execute(transaction: Transaction, parameters?: any[], options?: ExecuteOptions): Promise<void>;
|
|
139
165
|
/** Executes a statement that returns a single record as [col1, col2, ..., colN]. */
|
|
140
|
-
|
|
166
|
+
executeSingleton(transaction: Transaction, parameters?: any[], executeOptions?: ExecuteOptions): Promise<any[]>;
|
|
141
167
|
/** Executes a statement that returns a single record as an object. */
|
|
168
|
+
executeSingletonAsObject<T extends object>(transaction: Transaction, parameters?: any[], executeOptions?: ExecuteOptions): Promise<T>;
|
|
169
|
+
/**
|
|
170
|
+
* Executes a statement that returns a single record as [col1, col2, ..., colN].
|
|
171
|
+
* @deprecated since version 2.4.0 and will be removed in next major version. Replaced by executeSingleton.
|
|
172
|
+
*/
|
|
173
|
+
executeReturning(transaction: Transaction, parameters?: any[], executeOptions?: ExecuteOptions): Promise<any[]>;
|
|
174
|
+
/**
|
|
175
|
+
* Executes a statement that returns a single record as an object.
|
|
176
|
+
* @deprecated since version 2.4.0 and will be removed in next major version. Replaced by executeSingletonAsObject.
|
|
177
|
+
*/
|
|
142
178
|
executeReturningAsObject<T extends object>(transaction: Transaction, parameters?: any[], options?: ExecuteOptions): Promise<T>;
|
|
143
179
|
/** Executes a prepared statement that has result set. */
|
|
144
180
|
executeQuery(transaction: Transaction, parameters?: any[], options?: ExecuteQueryOptions): Promise<ResultSet>;
|
|
@@ -148,6 +184,9 @@ export interface Statement {
|
|
|
148
184
|
* Use with ResultSet.fetch({ fetchSize: 1 }) and other statement with WHERE CURRENT OF <cursorName>.
|
|
149
185
|
*/
|
|
150
186
|
setCursorName(cursorName: string): Promise<void>;
|
|
187
|
+
getExecPathText(): Promise<string | undefined>;
|
|
188
|
+
/** True if the statement has not been disposed. */
|
|
189
|
+
readonly isValid: boolean;
|
|
151
190
|
/** Gets the query's result columns labels. Returns empty array for queries without result. */
|
|
152
191
|
readonly columnLabels: Promise<string[]>;
|
|
153
192
|
/** When true, query result must be obtained with method executeQuery. */
|
|
@@ -180,11 +219,15 @@ export interface ResultSet {
|
|
|
180
219
|
* If result set has no more rows, returns an empty array.
|
|
181
220
|
*/
|
|
182
221
|
fetchAsObject<T extends object>(options?: FetchOptions): Promise<T[]>;
|
|
222
|
+
/** True if the ResultSet is open. */
|
|
223
|
+
readonly isValid: boolean;
|
|
183
224
|
/** Default result set's fetch options. */
|
|
184
225
|
defaultFetchOptions?: FetchOptions;
|
|
185
226
|
}
|
|
186
227
|
export interface Events {
|
|
187
228
|
cancel(): Promise<void>;
|
|
229
|
+
/** True if the events' attachment is valid. */
|
|
230
|
+
readonly isValid: boolean;
|
|
188
231
|
}
|
|
189
232
|
/** Blob class. */
|
|
190
233
|
export declare class Blob {
|
|
@@ -193,6 +236,13 @@ export declare class Blob {
|
|
|
193
236
|
/** Gets the blob's id. */
|
|
194
237
|
readonly id: Uint8Array;
|
|
195
238
|
constructor(attachment: Attachment, id: Uint8Array);
|
|
239
|
+
/** True if the blob's attachment is valid. */
|
|
240
|
+
get isValid(): boolean;
|
|
241
|
+
}
|
|
242
|
+
export declare const enum BlobSeekWhence {
|
|
243
|
+
START = 0,
|
|
244
|
+
CURRENT = 1,
|
|
245
|
+
END = 2
|
|
196
246
|
}
|
|
197
247
|
/** BlobStream class. */
|
|
198
248
|
export declare abstract class BlobStream {
|
|
@@ -205,6 +255,8 @@ export declare abstract class BlobStream {
|
|
|
205
255
|
abstract close(): Promise<void>;
|
|
206
256
|
/** Cancels the blob's creation. */
|
|
207
257
|
abstract cancel(): Promise<void>;
|
|
258
|
+
/** Seeks into the blob stream and return the new position. */
|
|
259
|
+
abstract seek(offset: number, whence?: BlobSeekWhence): Promise<number>;
|
|
208
260
|
/**
|
|
209
261
|
* Reads data from the blob and return the number of bytes read or -1 for end-of-stream.
|
|
210
262
|
* The number of bytes read may be less than the buffer' size while more data to be read exists.
|
|
@@ -212,6 +264,8 @@ export declare abstract class BlobStream {
|
|
|
212
264
|
abstract read(buffer: Buffer): Promise<number>;
|
|
213
265
|
/** Writes data to the blob. */
|
|
214
266
|
abstract write(buffer: Buffer): Promise<void>;
|
|
267
|
+
/** True if the blob stream is open. */
|
|
268
|
+
abstract get isValid(): boolean;
|
|
215
269
|
}
|
|
216
270
|
/** TIME WITH TIME ZONE and TIMESTAMP WITH TIME ZONE to be sent as parameter */
|
|
217
271
|
export interface ZonedDate {
|
package/dist/lib/index.js
CHANGED
package/dist/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":";;;AAsDA,gCAAgC;AAChC,IAAY,oBAIX;AAJD,WAAY,oBAAoB;IAC/B,mDAA2B,CAAA;IAC3B,yDAAiC,CAAA;IACjC,6CAAqB,CAAA;AACtB,CAAC,EAJW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAI/B;AA0PD,kBAAkB;AAClB,MAAa,IAAI;IAOhB,YAAY,UAAsB,EAAE,EAAc;QAHlD,0BAA0B;QACjB,OAAE,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;QAG/B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;IAED,8CAA8C;IAC9C,IAAI,OAAO;QACV,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;IAChC,CAAC;CACD;AAhBD,oBAgBC;AAQD,wBAAwB;AACxB,MAAsB,UAAU;IAO/B,YAAsB,IAAU;QAC/B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IAClB,CAAC;CAsBD;AA/BD,gCA+BC"}
|