@minatojs/driver-mysql
Advanced tools
Comparing version 2.5.1 to 2.5.2
@@ -43,3 +43,3 @@ import type { Pool, PoolConfig } from 'mysql'; | ||
_formatValues: (table: string, data: object, keys: readonly string[]) => string; | ||
query<T = any>(sql: string): Promise<T>; | ||
query<T = any>(sql: string, debug?: boolean): Promise<T>; | ||
queue<T = any>(sql: string, values?: any): Promise<T>; | ||
@@ -46,0 +46,0 @@ private _flushTasks; |
@@ -353,9 +353,11 @@ "use strict"; | ||
}; | ||
query(sql) { | ||
query(sql, debug = true) { | ||
const error = new Error(); | ||
return new Promise((resolve, reject) => { | ||
if (debug) | ||
logger.debug("> %s", sql); | ||
this.pool.query(sql, (err, results) => { | ||
if (!err) | ||
return resolve(results); | ||
logger.warn(sql); | ||
logger.warn("> %s", sql); | ||
if (err["code"] === "ER_DUP_ENTRY") { | ||
@@ -371,3 +373,2 @@ err = new import_core.RuntimeError("duplicate-entry", err.message); | ||
sql = (0, import_mysql.format)(sql, values); | ||
logger.debug("> %s", sql); | ||
if (!this.config.multipleStatements) { | ||
@@ -387,3 +388,3 @@ return this.query(sql); | ||
try { | ||
let results = await this.query(tasks.map((task) => task.sql).join("; ")); | ||
let results = await this.query(tasks.map((task) => task.sql).join("; "), false); | ||
if (tasks.length === 1) | ||
@@ -390,0 +391,0 @@ results = [results]; |
{ | ||
"name": "@minatojs/driver-mysql", | ||
"version": "2.5.1", | ||
"version": "2.5.2", | ||
"description": "MySQL Driver for Minato", | ||
@@ -38,4 +38,4 @@ "main": "lib/index.js", | ||
"cosmokit": "^1.4.5", | ||
"reggol": "^1.5.1" | ||
"reggol": "^1.5.2" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
54895
585
Updatedreggol@^1.5.2