mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-02 22:22:50 +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,10 +1,8 @@
|
||||
import { pool } from '.';
|
||||
import { logError, profileBatchStatements, runProfiler } from '../logger';
|
||||
import { CFXCallback, CFXParameters, QueryType } from '../types';
|
||||
import { parseResponse } from '../utils/parseResponse';
|
||||
import { executeType, parseExecute } from '../utils/parseExecute';
|
||||
import { scheduleTick } from '../utils/scheduleTick';
|
||||
import { isServerConnected, waitForConnection } from '../database';
|
||||
import { getPoolConnection } from './connection';
|
||||
import { setCallback } from '../utils/setCallback';
|
||||
|
||||
export const rawExecute = async (
|
||||
@@ -28,11 +26,9 @@ export const rawExecute = async (
|
||||
return logError(invokingResource, cb, isPromise, 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