@prisma/adapter-mariadb 7.10.1 → 7.11.0-dev.10
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 +45 -19
- package/dist/index.mjs +45 -19
- package/package.json +4 -5
package/dist/index.js
CHANGED
|
@@ -85,7 +85,7 @@ function mapColumnType(field) {
|
|
|
85
85
|
case "TINY_BLOB" /* TINY_BLOB */:
|
|
86
86
|
case "MEDIUM_BLOB" /* MEDIUM_BLOB */:
|
|
87
87
|
case "LONG_BLOB" /* LONG_BLOB */:
|
|
88
|
-
if (field
|
|
88
|
+
if (field.isDataTypeFormatJson()) {
|
|
89
89
|
return import_driver_adapter_utils.ColumnTypeEnum.Json;
|
|
90
90
|
} else if (field.collation.index === BINARY_COLLATION_INDEX) {
|
|
91
91
|
return import_driver_adapter_utils.ColumnTypeEnum.Bytes;
|
|
@@ -367,36 +367,62 @@ var MariaDbTransaction = class extends MariaDbQueryable {
|
|
|
367
367
|
this.options = options;
|
|
368
368
|
this.cleanup = cleanup;
|
|
369
369
|
}
|
|
370
|
+
/**
|
|
371
|
+
* Set on entry to `commit()` or `rollback()`, before either sends SQL. Once the pool has lent the
|
|
372
|
+
* connection to a new owner, a second close would send `COMMIT` or `ROLLBACK` into that owner's
|
|
373
|
+
* session and release the connection twice, so the transaction closes at most once and sends
|
|
374
|
+
* nothing afterwards.
|
|
375
|
+
*/
|
|
376
|
+
closed = false;
|
|
377
|
+
async performIO(query) {
|
|
378
|
+
this.assertOpen();
|
|
379
|
+
return await super.performIO(query);
|
|
380
|
+
}
|
|
370
381
|
async commit() {
|
|
371
382
|
debug(`[js::commit]`);
|
|
372
|
-
|
|
373
|
-
await this.client.query({ sql: "COMMIT" });
|
|
374
|
-
} catch (err) {
|
|
375
|
-
this.onError(err);
|
|
376
|
-
} finally {
|
|
377
|
-
this.cleanup?.();
|
|
378
|
-
await releaseConnection(this.client);
|
|
379
|
-
}
|
|
383
|
+
await this.close("COMMIT");
|
|
380
384
|
}
|
|
381
385
|
async rollback() {
|
|
382
386
|
debug(`[js::rollback]`);
|
|
387
|
+
await this.close("ROLLBACK");
|
|
388
|
+
}
|
|
389
|
+
async createSavepoint(name2) {
|
|
390
|
+
await this.sendTransactionControl(`SAVEPOINT ${name2}`);
|
|
391
|
+
}
|
|
392
|
+
async rollbackToSavepoint(name2) {
|
|
393
|
+
await this.sendTransactionControl(`ROLLBACK TO ${name2}`);
|
|
394
|
+
}
|
|
395
|
+
async releaseSavepoint(name2) {
|
|
396
|
+
await this.sendTransactionControl(`RELEASE SAVEPOINT ${name2}`);
|
|
397
|
+
}
|
|
398
|
+
async close(sql) {
|
|
399
|
+
if (this.closed) {
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
this.closed = true;
|
|
383
403
|
try {
|
|
384
|
-
await this.client.query({ sql
|
|
404
|
+
await this.client.query({ sql });
|
|
385
405
|
} catch (err) {
|
|
386
406
|
this.onError(err);
|
|
387
407
|
} finally {
|
|
388
|
-
|
|
389
|
-
|
|
408
|
+
try {
|
|
409
|
+
this.cleanup?.();
|
|
410
|
+
} finally {
|
|
411
|
+
await releaseConnection(this.client);
|
|
412
|
+
}
|
|
390
413
|
}
|
|
391
414
|
}
|
|
392
|
-
async
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
async rollbackToSavepoint(name2) {
|
|
396
|
-
await this.client.query({ sql: `ROLLBACK TO ${name2}` }).catch(this.onError.bind(this));
|
|
415
|
+
async sendTransactionControl(sql) {
|
|
416
|
+
this.assertOpen();
|
|
417
|
+
await this.client.query({ sql }).catch(this.onError.bind(this));
|
|
397
418
|
}
|
|
398
|
-
|
|
399
|
-
|
|
419
|
+
assertOpen() {
|
|
420
|
+
if (this.closed) {
|
|
421
|
+
throw new import_driver_adapter_utils2.DriverAdapterError({
|
|
422
|
+
kind: "TransactionAlreadyClosed",
|
|
423
|
+
cause: "The transaction has already been committed or rolled back"
|
|
424
|
+
});
|
|
425
|
+
}
|
|
400
426
|
}
|
|
401
427
|
};
|
|
402
428
|
var PrismaMariaDbAdapter = class extends MariaDbQueryable {
|
package/dist/index.mjs
CHANGED
|
@@ -49,7 +49,7 @@ function mapColumnType(field) {
|
|
|
49
49
|
case "TINY_BLOB" /* TINY_BLOB */:
|
|
50
50
|
case "MEDIUM_BLOB" /* MEDIUM_BLOB */:
|
|
51
51
|
case "LONG_BLOB" /* LONG_BLOB */:
|
|
52
|
-
if (field
|
|
52
|
+
if (field.isDataTypeFormatJson()) {
|
|
53
53
|
return ColumnTypeEnum.Json;
|
|
54
54
|
} else if (field.collation.index === BINARY_COLLATION_INDEX) {
|
|
55
55
|
return ColumnTypeEnum.Bytes;
|
|
@@ -331,36 +331,62 @@ var MariaDbTransaction = class extends MariaDbQueryable {
|
|
|
331
331
|
this.options = options;
|
|
332
332
|
this.cleanup = cleanup;
|
|
333
333
|
}
|
|
334
|
+
/**
|
|
335
|
+
* Set on entry to `commit()` or `rollback()`, before either sends SQL. Once the pool has lent the
|
|
336
|
+
* connection to a new owner, a second close would send `COMMIT` or `ROLLBACK` into that owner's
|
|
337
|
+
* session and release the connection twice, so the transaction closes at most once and sends
|
|
338
|
+
* nothing afterwards.
|
|
339
|
+
*/
|
|
340
|
+
closed = false;
|
|
341
|
+
async performIO(query) {
|
|
342
|
+
this.assertOpen();
|
|
343
|
+
return await super.performIO(query);
|
|
344
|
+
}
|
|
334
345
|
async commit() {
|
|
335
346
|
debug(`[js::commit]`);
|
|
336
|
-
|
|
337
|
-
await this.client.query({ sql: "COMMIT" });
|
|
338
|
-
} catch (err) {
|
|
339
|
-
this.onError(err);
|
|
340
|
-
} finally {
|
|
341
|
-
this.cleanup?.();
|
|
342
|
-
await releaseConnection(this.client);
|
|
343
|
-
}
|
|
347
|
+
await this.close("COMMIT");
|
|
344
348
|
}
|
|
345
349
|
async rollback() {
|
|
346
350
|
debug(`[js::rollback]`);
|
|
351
|
+
await this.close("ROLLBACK");
|
|
352
|
+
}
|
|
353
|
+
async createSavepoint(name2) {
|
|
354
|
+
await this.sendTransactionControl(`SAVEPOINT ${name2}`);
|
|
355
|
+
}
|
|
356
|
+
async rollbackToSavepoint(name2) {
|
|
357
|
+
await this.sendTransactionControl(`ROLLBACK TO ${name2}`);
|
|
358
|
+
}
|
|
359
|
+
async releaseSavepoint(name2) {
|
|
360
|
+
await this.sendTransactionControl(`RELEASE SAVEPOINT ${name2}`);
|
|
361
|
+
}
|
|
362
|
+
async close(sql) {
|
|
363
|
+
if (this.closed) {
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
this.closed = true;
|
|
347
367
|
try {
|
|
348
|
-
await this.client.query({ sql
|
|
368
|
+
await this.client.query({ sql });
|
|
349
369
|
} catch (err) {
|
|
350
370
|
this.onError(err);
|
|
351
371
|
} finally {
|
|
352
|
-
|
|
353
|
-
|
|
372
|
+
try {
|
|
373
|
+
this.cleanup?.();
|
|
374
|
+
} finally {
|
|
375
|
+
await releaseConnection(this.client);
|
|
376
|
+
}
|
|
354
377
|
}
|
|
355
378
|
}
|
|
356
|
-
async
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
async rollbackToSavepoint(name2) {
|
|
360
|
-
await this.client.query({ sql: `ROLLBACK TO ${name2}` }).catch(this.onError.bind(this));
|
|
379
|
+
async sendTransactionControl(sql) {
|
|
380
|
+
this.assertOpen();
|
|
381
|
+
await this.client.query({ sql }).catch(this.onError.bind(this));
|
|
361
382
|
}
|
|
362
|
-
|
|
363
|
-
|
|
383
|
+
assertOpen() {
|
|
384
|
+
if (this.closed) {
|
|
385
|
+
throw new DriverAdapterError({
|
|
386
|
+
kind: "TransactionAlreadyClosed",
|
|
387
|
+
cause: "The transaction has already been committed or rolled back"
|
|
388
|
+
});
|
|
389
|
+
}
|
|
364
390
|
}
|
|
365
391
|
};
|
|
366
392
|
var PrismaMariaDbAdapter = class extends MariaDbQueryable {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/adapter-mariadb",
|
|
3
|
-
"version": "7.10
|
|
3
|
+
"version": "7.11.0-dev.10",
|
|
4
4
|
"description": "Prisma's driver adapter for \"mariadb\"",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -32,14 +32,13 @@
|
|
|
32
32
|
"sideEffects": false,
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"mariadb": "3.5.4",
|
|
35
|
-
"@prisma/driver-adapter-utils": "7.10
|
|
35
|
+
"@prisma/driver-adapter-utils": "7.11.0-dev.10"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@prisma/debug": "7.10
|
|
38
|
+
"@prisma/debug": "7.11.0-dev.10"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"dev": "DEV=true tsx helpers/build.ts",
|
|
42
|
-
"build": "tsx helpers/build.ts"
|
|
43
|
-
"test": "vitest run"
|
|
42
|
+
"build": "tsx helpers/build.ts"
|
|
44
43
|
}
|
|
45
44
|
}
|