@prisma/adapter-mariadb 7.10.0-dev.16 → 7.10.0-dev.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/dist/index.js +16 -5
- package/dist/index.mjs +16 -5
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -371,7 +371,7 @@ var MariaDbTransaction = class extends MariaDbQueryable {
|
|
|
371
371
|
this.onError(err);
|
|
372
372
|
} finally {
|
|
373
373
|
this.cleanup?.();
|
|
374
|
-
await this.client
|
|
374
|
+
await releaseConnection(this.client);
|
|
375
375
|
}
|
|
376
376
|
}
|
|
377
377
|
async rollback() {
|
|
@@ -382,7 +382,7 @@ var MariaDbTransaction = class extends MariaDbQueryable {
|
|
|
382
382
|
this.onError(err);
|
|
383
383
|
} finally {
|
|
384
384
|
this.cleanup?.();
|
|
385
|
-
await this.client
|
|
385
|
+
await releaseConnection(this.client);
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
388
|
async createSavepoint(name2) {
|
|
@@ -424,7 +424,7 @@ var PrismaMariaDbAdapter = class extends MariaDbQueryable {
|
|
|
424
424
|
};
|
|
425
425
|
conn.on("error", onError);
|
|
426
426
|
const cleanup = () => {
|
|
427
|
-
conn.
|
|
427
|
+
conn.off("error", onError);
|
|
428
428
|
};
|
|
429
429
|
try {
|
|
430
430
|
const tx = new MariaDbTransaction(conn, this.mariadbOptions, options, cleanup);
|
|
@@ -438,8 +438,11 @@ var PrismaMariaDbAdapter = class extends MariaDbQueryable {
|
|
|
438
438
|
await tx.conn.query({ sql: "BEGIN" }).catch(this.onError.bind(this));
|
|
439
439
|
return tx;
|
|
440
440
|
} catch (error) {
|
|
441
|
-
|
|
442
|
-
|
|
441
|
+
try {
|
|
442
|
+
cleanup();
|
|
443
|
+
} finally {
|
|
444
|
+
await releaseConnection(conn);
|
|
445
|
+
}
|
|
443
446
|
this.onError(error);
|
|
444
447
|
}
|
|
445
448
|
}
|
|
@@ -557,6 +560,14 @@ function rewriteConnectionString(url) {
|
|
|
557
560
|
}
|
|
558
561
|
return url;
|
|
559
562
|
}
|
|
563
|
+
async function releaseConnection(conn) {
|
|
564
|
+
const poolConn = conn;
|
|
565
|
+
if (typeof poolConn.release === "function") {
|
|
566
|
+
await poolConn.release();
|
|
567
|
+
} else {
|
|
568
|
+
await conn.end();
|
|
569
|
+
}
|
|
570
|
+
}
|
|
560
571
|
// Annotate the CommonJS export names for ESM import in node:
|
|
561
572
|
0 && (module.exports = {
|
|
562
573
|
PrismaMariaDb
|
package/dist/index.mjs
CHANGED
|
@@ -335,7 +335,7 @@ var MariaDbTransaction = class extends MariaDbQueryable {
|
|
|
335
335
|
this.onError(err);
|
|
336
336
|
} finally {
|
|
337
337
|
this.cleanup?.();
|
|
338
|
-
await this.client
|
|
338
|
+
await releaseConnection(this.client);
|
|
339
339
|
}
|
|
340
340
|
}
|
|
341
341
|
async rollback() {
|
|
@@ -346,7 +346,7 @@ var MariaDbTransaction = class extends MariaDbQueryable {
|
|
|
346
346
|
this.onError(err);
|
|
347
347
|
} finally {
|
|
348
348
|
this.cleanup?.();
|
|
349
|
-
await this.client
|
|
349
|
+
await releaseConnection(this.client);
|
|
350
350
|
}
|
|
351
351
|
}
|
|
352
352
|
async createSavepoint(name2) {
|
|
@@ -388,7 +388,7 @@ var PrismaMariaDbAdapter = class extends MariaDbQueryable {
|
|
|
388
388
|
};
|
|
389
389
|
conn.on("error", onError);
|
|
390
390
|
const cleanup = () => {
|
|
391
|
-
conn.
|
|
391
|
+
conn.off("error", onError);
|
|
392
392
|
};
|
|
393
393
|
try {
|
|
394
394
|
const tx = new MariaDbTransaction(conn, this.mariadbOptions, options, cleanup);
|
|
@@ -402,8 +402,11 @@ var PrismaMariaDbAdapter = class extends MariaDbQueryable {
|
|
|
402
402
|
await tx.conn.query({ sql: "BEGIN" }).catch(this.onError.bind(this));
|
|
403
403
|
return tx;
|
|
404
404
|
} catch (error) {
|
|
405
|
-
|
|
406
|
-
|
|
405
|
+
try {
|
|
406
|
+
cleanup();
|
|
407
|
+
} finally {
|
|
408
|
+
await releaseConnection(conn);
|
|
409
|
+
}
|
|
407
410
|
this.onError(error);
|
|
408
411
|
}
|
|
409
412
|
}
|
|
@@ -521,6 +524,14 @@ function rewriteConnectionString(url) {
|
|
|
521
524
|
}
|
|
522
525
|
return url;
|
|
523
526
|
}
|
|
527
|
+
async function releaseConnection(conn) {
|
|
528
|
+
const poolConn = conn;
|
|
529
|
+
if (typeof poolConn.release === "function") {
|
|
530
|
+
await poolConn.release();
|
|
531
|
+
} else {
|
|
532
|
+
await conn.end();
|
|
533
|
+
}
|
|
534
|
+
}
|
|
524
535
|
export {
|
|
525
536
|
PrismaMariaDbAdapterFactory as PrismaMariaDb
|
|
526
537
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/adapter-mariadb",
|
|
3
|
-
"version": "7.10.0-dev.
|
|
3
|
+
"version": "7.10.0-dev.18",
|
|
4
4
|
"description": "Prisma's driver adapter for \"mariadb\"",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
"sideEffects": false,
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"mariadb": "3.4.5",
|
|
35
|
-
"@prisma/driver-adapter-utils": "7.10.0-dev.
|
|
35
|
+
"@prisma/driver-adapter-utils": "7.10.0-dev.18"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@prisma/debug": "7.10.0-dev.
|
|
38
|
+
"@prisma/debug": "7.10.0-dev.18"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"dev": "DEV=true tsx helpers/build.ts",
|