mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-02 06:28:54 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4b2b564591 | ||
|
|
3f57c566df | ||
|
|
5e6547611b |
No files matched your search
+1
-1
@@ -3,7 +3,7 @@ game 'gta5'
|
||||
|
||||
name 'oxmysql'
|
||||
description 'Database wrapper for FiveM utilising node-mysql2 offering improved performance and security.'
|
||||
version '1.3.1'
|
||||
version '1.3.2'
|
||||
url 'https://github.com/overextended/oxmysql'
|
||||
author 'overextended'
|
||||
use_fxv2_oal 'yes'
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "oxmysql",
|
||||
"version": "1.2.0",
|
||||
"version": "1.3.2",
|
||||
"main": "oxmysql.js",
|
||||
"description": "FiveM MySQL wrapper using faster mysql2",
|
||||
"repository": "[email protected]:overextended/oxmysql.git",
|
||||
|
||||
+3
-3
@@ -7,13 +7,13 @@ const resourceName = GetCurrentResourceName() || 'oxmysql';
|
||||
const execute = async (query, parameters, resource) => {
|
||||
ScheduleResourceTick(resourceName);
|
||||
try {
|
||||
const time = debug? process.hrtime.bigint() : Date.now();
|
||||
const time = debug ? process.hrtime.bigint() : Date.now();
|
||||
|
||||
[query, parameters] = parseParameters(query, parameters);
|
||||
|
||||
const [result] = await pool.query(query, parameters);
|
||||
|
||||
const executionTime = debug? Number(process.hrtime.bigint() - time) / 1e6 : Date.now() - time;
|
||||
const executionTime = debug ? Number(process.hrtime.bigint() - time) / 1e6 : Date.now() - time;
|
||||
|
||||
if (executionTime >= slowQueryWarning || debug)
|
||||
console.log(
|
||||
@@ -28,7 +28,7 @@ const execute = async (query, parameters, resource) => {
|
||||
${error.message}
|
||||
${error.sql || `${query} ${JSON.stringify(parameters)}`}^0`
|
||||
);
|
||||
//console.trace(error);
|
||||
debug && console.trace(error);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
import { pool } from './pool';
|
||||
import { execute } from './execute';
|
||||
|
||||
setImmediate(async () => {
|
||||
try {
|
||||
await (await pool.getConnection()).ping();
|
||||
@@ -11,7 +12,7 @@ setImmediate(async () => {
|
||||
|
||||
const safeCallback = (callback, result, error) => {
|
||||
if (typeof callback === 'function') return callback(result || false);
|
||||
else return console.log(`^1[ERROR] ${error[0]} was unable to execute a query, callback function was undefined!\n ^1 ${error[1]}^0`);
|
||||
else return console.log(`^3[WARNING] ${error[0]} executed a query, but no callback function was defined!\n ^3 ${error[1]}^0`);
|
||||
};
|
||||
|
||||
global.exports('execute', (query, parameters, cb, resource = GetInvokingResource()) => {
|
||||
|
||||
Reference in new issue
Block a user