@travetto/model-sql 5.0.17 → 5.0.18
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/LICENSE +1 -1
- package/package.json +7 -7
- package/src/connection/base.ts +7 -7
package/LICENSE
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/model-sql",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.18",
|
|
4
4
|
"description": "SQL backing for the travetto model module, with real-time modeling support for SQL schemas.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sql",
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
"directory": "module/model-sql"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@travetto/cli": "^5.0.
|
|
31
|
-
"@travetto/config": "^5.0.
|
|
32
|
-
"@travetto/context": "^5.0.
|
|
33
|
-
"@travetto/model": "^5.0.
|
|
34
|
-
"@travetto/model-query": "^5.0.
|
|
30
|
+
"@travetto/cli": "^5.0.17",
|
|
31
|
+
"@travetto/config": "^5.0.14",
|
|
32
|
+
"@travetto/context": "^5.0.14",
|
|
33
|
+
"@travetto/model": "^5.0.15",
|
|
34
|
+
"@travetto/model-query": "^5.0.15"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@travetto/test": "^5.0.
|
|
37
|
+
"@travetto/test": "^5.0.16"
|
|
38
38
|
},
|
|
39
39
|
"peerDependenciesMeta": {
|
|
40
40
|
"@travetto/test": {
|
package/src/connection/base.ts
CHANGED
|
@@ -18,12 +18,12 @@ export abstract class Connection<C = unknown> {
|
|
|
18
18
|
|
|
19
19
|
transactionDialect = {
|
|
20
20
|
begin: 'BEGIN;',
|
|
21
|
-
beginNested: 'SAVEPOINT
|
|
21
|
+
beginNested: 'SAVEPOINT $1;',
|
|
22
22
|
isolate: 'SET TRANSACTION ISOLATION LEVEL READ COMMITTED;',
|
|
23
23
|
rollback: 'ROLLBACK;',
|
|
24
|
-
rollbackNested: 'ROLLBACK TO
|
|
24
|
+
rollbackNested: 'ROLLBACK TO $1;',
|
|
25
25
|
commit: 'COMMIT;',
|
|
26
|
-
commitNested: 'RELEASE SAVEPOINT
|
|
26
|
+
commitNested: 'RELEASE SAVEPOINT $1;'
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
constructor(public readonly context: AsyncContext) {
|
|
@@ -54,7 +54,7 @@ export abstract class Connection<C = unknown> {
|
|
|
54
54
|
* @param rawConnection
|
|
55
55
|
* @param query
|
|
56
56
|
*/
|
|
57
|
-
abstract execute<T = unknown>(rawConnection: C, query: string): Promise<{ records: T[], count: number }>;
|
|
57
|
+
abstract execute<T = unknown>(rawConnection: C, query: string, values?: unknown[]): Promise<{ records: T[], count: number }>;
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
60
|
* Acquire new connection
|
|
@@ -146,7 +146,7 @@ export abstract class Connection<C = unknown> {
|
|
|
146
146
|
async startTx(conn: C, transactionId?: string): Promise<void> {
|
|
147
147
|
if (transactionId) {
|
|
148
148
|
if (this.nestedTransactions) {
|
|
149
|
-
await this.execute(conn, this.transactionDialect.beginNested
|
|
149
|
+
await this.execute(conn, this.transactionDialect.beginNested, [transactionId]);
|
|
150
150
|
}
|
|
151
151
|
} else {
|
|
152
152
|
if (this.isolatedTransactions) {
|
|
@@ -162,7 +162,7 @@ export abstract class Connection<C = unknown> {
|
|
|
162
162
|
async commitTx(conn: C, transactionId?: string): Promise<void> {
|
|
163
163
|
if (transactionId) {
|
|
164
164
|
if (this.nestedTransactions) {
|
|
165
|
-
await this.execute(conn, this.transactionDialect.commitNested
|
|
165
|
+
await this.execute(conn, this.transactionDialect.commitNested, [transactionId]);
|
|
166
166
|
}
|
|
167
167
|
} else {
|
|
168
168
|
await this.execute(conn, this.transactionDialect.commit);
|
|
@@ -175,7 +175,7 @@ export abstract class Connection<C = unknown> {
|
|
|
175
175
|
async rollbackTx(conn: C, transactionId?: string): Promise<void> {
|
|
176
176
|
if (transactionId) {
|
|
177
177
|
if (this.isolatedTransactions) {
|
|
178
|
-
await this.execute(conn, this.transactionDialect.rollbackNested
|
|
178
|
+
await this.execute(conn, this.transactionDialect.rollbackNested, [transactionId]);
|
|
179
179
|
}
|
|
180
180
|
} else {
|
|
181
181
|
await this.execute(conn, this.transactionDialect.rollback);
|