mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-02 06:28:54 +00:00
refactor(database): move pool and connection variables
Mostly reorganising module. Added getPoolConnection helper.
This commit is contained in:
1 parent
b3f4a7aa6b
commit
0398abc501
6 files changed
+78
-69
No files matched your search
@@ -1,11 +1,10 @@
|
||||
import { pool, isServerConnected, waitForConnection } from '.';
|
||||
import { parseArguments } from '../utils/parseArguments';
|
||||
import { setCallback } from '../utils/setCallback';
|
||||
import { parseResponse } from '../utils/parseResponse';
|
||||
import { logQuery, logError, runProfiler } from '../logger';
|
||||
import type { CFXCallback, CFXParameters } from '../types';
|
||||
import type { QueryType } from '../types';
|
||||
import { scheduleTick } from '../utils/scheduleTick';
|
||||
import { getPoolConnection } from './connection';
|
||||
import { RowDataPacket } from 'mysql2';
|
||||
|
||||
export const rawQuery = async (
|
||||
@@ -23,11 +22,9 @@ export const rawQuery = async (
|
||||
return logError(invokingResource, cb, isPromise, `Query: ${query}`, err.message);
|
||||
}
|
||||
|
||||
if (!isServerConnected) await waitForConnection();
|
||||
const connection = await getPoolConnection();
|
||||
|
||||
scheduleTick();
|
||||
|
||||
const connection = await pool.getConnection();
|
||||
if (!connection) return;
|
||||
|
||||
try {
|
||||
const hasProfiler = await runProfiler(connection, invokingResource);
|
||||
|
||||
Reference in new issue
Block a user