@noldova/context.data.sql 0.0.8 → 0.0.9
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/api/index.d.ts
CHANGED
|
@@ -346,18 +346,24 @@ export declare class SqlTransaction extends Transaction {
|
|
|
346
346
|
* Runs a query that returns no rows in the transaction and returns the
|
|
347
347
|
* number of rows it changed. A completed transaction rejects with
|
|
348
348
|
* `DataException`.
|
|
349
|
+
* A failure marks the transaction rollback-only, so the connection rolls it
|
|
350
|
+
* back even when the action catches it.
|
|
349
351
|
*/
|
|
350
352
|
public executeAsync(query: SqlQuery): Promise<number>;
|
|
351
353
|
|
|
352
354
|
/**
|
|
353
355
|
* Runs an `INSERT` in the transaction and returns the generated key. A
|
|
354
356
|
* completed transaction rejects with `DataException`.
|
|
357
|
+
* A failure marks the transaction rollback-only, so the connection rolls it
|
|
358
|
+
* back even when the action catches it.
|
|
355
359
|
*/
|
|
356
360
|
public insertAsync(query: SqlQuery): Promise<number>;
|
|
357
361
|
|
|
358
362
|
/**
|
|
359
363
|
* Runs a query in the transaction and returns its rows as records. A
|
|
360
364
|
* completed transaction rejects with `DataException`.
|
|
365
|
+
* A failure marks the transaction rollback-only, so the connection rolls it
|
|
366
|
+
* back even when the action catches it.
|
|
361
367
|
*/
|
|
362
368
|
public queryAsync(query: SqlQuery): Promise<readonly DataRecord[]>;
|
|
363
369
|
|
|
@@ -15,16 +15,13 @@ export class SqlTransaction extends Transaction {
|
|
|
15
15
|
this.session = session;
|
|
16
16
|
}
|
|
17
17
|
async executeAsync(query) {
|
|
18
|
-
this.
|
|
19
|
-
return this.session.executeAsync(query);
|
|
18
|
+
return this.runInTransactionAsync(async () => this.session.executeAsync(query));
|
|
20
19
|
}
|
|
21
20
|
async insertAsync(query) {
|
|
22
|
-
this.
|
|
23
|
-
return this.session.insertAsync(query);
|
|
21
|
+
return this.runInTransactionAsync(async () => this.session.insertAsync(query));
|
|
24
22
|
}
|
|
25
23
|
async queryAsync(query) {
|
|
26
|
-
this.
|
|
27
|
-
return this.session.queryAsync(query);
|
|
24
|
+
return this.runInTransactionAsync(async () => this.session.queryAsync(query));
|
|
28
25
|
}
|
|
29
26
|
async commitCoreAsync() {
|
|
30
27
|
await this.session.executeAsync(new SqlQuery(Resources.commitTransaction));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sql-transaction.js","sourceRoot":"","sources":["../../../../src/data/noldova.context.data.sql/src/models/sql-transaction.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAmB,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAErE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,MAAM,OAAO,cAAe,SAAQ,WAAW;IAC5B,OAAO,CAAa;IAErC,YAAmB,OAAmB;QACpC,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAEM,KAAK,CAAC,YAAY,CAAC,KAAe;QACvC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"sql-transaction.js","sourceRoot":"","sources":["../../../../src/data/noldova.context.data.sql/src/models/sql-transaction.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAmB,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAErE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,MAAM,OAAO,cAAe,SAAQ,WAAW;IAC5B,OAAO,CAAa;IAErC,YAAmB,OAAmB;QACpC,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAEM,KAAK,CAAC,YAAY,CAAC,KAAe;QACvC,OAAO,IAAI,CAAC,qBAAqB,CAAC,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;IAClF,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,KAAe;QACtC,OAAO,IAAI,CAAC,qBAAqB,CAAC,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;IACjF,CAAC;IAEM,KAAK,CAAC,UAAU,CAAC,KAAe;QACrC,OAAO,IAAI,CAAC,qBAAqB,CAAC,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;IAChF,CAAC;IAEkB,KAAK,CAAC,eAAe;QACtC,MAAM,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,QAAQ,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAC7E,CAAC;IAEkB,KAAK,CAAC,iBAAiB;QACxC,MAAM,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,QAAQ,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAC/E,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noldova/context.data.sql",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "api/index.js",
|
|
6
6
|
"types": "api/index.d.ts",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"access": "public",
|
|
19
19
|
"registry": "https://registry.npmjs.org/"
|
|
20
20
|
},
|
|
21
|
-
"
|
|
22
|
-
"@noldova/context.core": "0.0.
|
|
23
|
-
"@noldova/context.data": "0.0.
|
|
24
|
-
"@noldova/context.exceptions": "0.0.
|
|
21
|
+
"peerDependencies": {
|
|
22
|
+
"@noldova/context.core": ">=0.0.9 <0.1.0",
|
|
23
|
+
"@noldova/context.data": ">=0.0.9 <0.1.0",
|
|
24
|
+
"@noldova/context.exceptions": ">=0.0.9 <0.1.0"
|
|
25
25
|
},
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "739f94fdfd82cfca7901164d7719be5275012451"
|
|
27
27
|
}
|