node-firebird-driver 3.2.2 → 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 +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.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 +8 -1
- package/dist/lib/index.js +7 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/test/tests.js +176 -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 +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
|
@@ -2,57 +2,56 @@ import { AbstractAttachment } from './attachment';
|
|
|
2
2
|
|
|
3
3
|
import { Transaction } from '..';
|
|
4
4
|
|
|
5
|
-
|
|
6
5
|
/** AbstractTransaction implementation. */
|
|
7
6
|
export abstract class AbstractTransaction implements Transaction {
|
|
8
|
-
|
|
9
|
-
}
|
|
7
|
+
protected constructor(public attachment?: AbstractAttachment) {}
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
/** Commits and release this transaction object. */
|
|
10
|
+
async commit(): Promise<void> {
|
|
11
|
+
this.check();
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
await this.internalCommit();
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
this.attachment!.transactions.delete(this);
|
|
16
|
+
this.attachment = undefined;
|
|
17
|
+
}
|
|
20
18
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
/** Commits and maintains this transaction object for subsequent work. */
|
|
20
|
+
async commitRetaining(): Promise<void> {
|
|
21
|
+
this.check();
|
|
24
22
|
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
return await this.internalCommitRetaining();
|
|
24
|
+
}
|
|
27
25
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
/** Rollbacks and release this transaction object. */
|
|
27
|
+
async rollback(): Promise<void> {
|
|
28
|
+
this.check();
|
|
31
29
|
|
|
32
|
-
|
|
30
|
+
await this.internalRollback();
|
|
33
31
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
this.attachment!.transactions.delete(this);
|
|
33
|
+
this.attachment = undefined;
|
|
34
|
+
}
|
|
37
35
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
/** Rollbacks and maintains this transaction object for subsequent work. */
|
|
37
|
+
async rollbackRetaining(): Promise<void> {
|
|
38
|
+
this.check();
|
|
41
39
|
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
return await this.internalRollbackRetaining();
|
|
41
|
+
}
|
|
44
42
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
get isValid(): boolean {
|
|
44
|
+
return !!this.attachment;
|
|
45
|
+
}
|
|
48
46
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
private check() {
|
|
48
|
+
if (!this.isValid) {
|
|
49
|
+
throw new Error('Transaction is already committed or rolled back.');
|
|
50
|
+
}
|
|
51
|
+
}
|
|
53
52
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
protected abstract internalCommit(): Promise<void>;
|
|
54
|
+
protected abstract internalCommitRetaining(): Promise<void>;
|
|
55
|
+
protected abstract internalRollback(): Promise<void>;
|
|
56
|
+
protected abstract internalRollbackRetaining(): Promise<void>;
|
|
58
57
|
}
|