Compare commits
4 Commits
4240e978cf
...
1a45c35090
Author | SHA1 | Date | |
---|---|---|---|
1a45c35090 | |||
e3e7623c27 | |||
a82dacdc30 | |||
8230fa376b |
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@navy.gif/wrappers",
|
||||
"version": "1.6.4",
|
||||
"version": "1.6.6",
|
||||
"description": "Various wrapper classes I use in my projects",
|
||||
"repository": "https://git.corgi.wtf/Navy.gif/wrappers.git",
|
||||
"author": "Navy.gif",
|
||||
|
@ -337,6 +337,9 @@ class MariaDB
|
||||
const pool = this.#pool;
|
||||
if (nodeName)
|
||||
{
|
||||
const available = this.#nodes.filter(n => n.status === 'synced');
|
||||
if (!available.length)
|
||||
throw new Error('No nodes available for query');
|
||||
const node = this.#nodes.find(n => n.name === nodeName);
|
||||
if (!node)
|
||||
{
|
||||
@ -358,7 +361,7 @@ class MariaDB
|
||||
this.#logger.debug(`Selected node ${nodeName} for query`);
|
||||
return pool.of(nodeName ?? '*').getConnection((err, conn) =>
|
||||
{
|
||||
if (err)
|
||||
if (err)
|
||||
return reject(err);
|
||||
return resolve(conn);
|
||||
});
|
||||
@ -391,7 +394,7 @@ class MariaDB
|
||||
resolve(fields);
|
||||
connection.release();
|
||||
});
|
||||
this.#logger.debug(`Constructed query: ${q.sql}`);
|
||||
this.#logger.debug(`Constructed query: ${q.sql.substring(0, 1024)}`);
|
||||
});
|
||||
return Promise.resolve(result || []);
|
||||
}
|
||||
@ -421,7 +424,7 @@ class MariaDB
|
||||
let batch = false;
|
||||
if (values && typeof values.some === 'function')
|
||||
batch = values.some(val => val instanceof Array);
|
||||
this.#logger.debug(`Incoming query (batch: ${batch})\n${query}\n${inspect(values)}`);
|
||||
this.#logger.debug(`Incoming query (batch: ${batch})\n${query}\n${inspect(values).substring(0, 1024)}`);
|
||||
|
||||
return this.#_query<T>(query, values ?? [], opts);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user