mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-02 14:38:50 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
94fe76340e |
No files matched your search
+1
-1
@@ -3,7 +3,7 @@ game 'common'
|
|||||||
|
|
||||||
name 'oxmysql'
|
name 'oxmysql'
|
||||||
description 'Database wrapper for FiveM utilising node-mysql2 offering improved performance and security.'
|
description 'Database wrapper for FiveM utilising node-mysql2 offering improved performance and security.'
|
||||||
version '1.8.2'
|
version '1.8.3'
|
||||||
url 'https://github.com/overextended/oxmysql'
|
url 'https://github.com/overextended/oxmysql'
|
||||||
author 'overextended'
|
author 'overextended'
|
||||||
use_fxv2_oal 'yes'
|
use_fxv2_oal 'yes'
|
||||||
|
|||||||
+1
-1
@@ -71,7 +71,7 @@ const preparedStatement = async (query, parameters, resource) => {
|
|||||||
const executionTime = process.hrtime(startTime)[1] / 1000000; // nanosecond to millisecond
|
const executionTime = process.hrtime(startTime)[1] / 1000000; // nanosecond to millisecond
|
||||||
if (executionTime >= slowQueryWarning || debug)
|
if (executionTime >= slowQueryWarning || debug)
|
||||||
console.log(
|
console.log(
|
||||||
`^3[${debug ? 'DEBUG' : 'WARNING'}] ${resource} took ${totalTime}ms to execute ${
|
`^3[${debug ? 'DEBUG' : 'WARNING'}] ${resource} took ${executionTime}ms to execute ${
|
||||||
queryCount > 1 ? queryCount + ' queries' : 'a query'
|
queryCount > 1 ? queryCount + ' queries' : 'a query'
|
||||||
}!
|
}!
|
||||||
${query} ${JSON.stringify(parameters)}^0`
|
${query} ${JSON.stringify(parameters)}^0`
|
||||||
|
|||||||
+2
-1
@@ -52,7 +52,8 @@ global.exports('prepare', (query, parameters, cb, resource = GetInvokingResource
|
|||||||
preparedStatement(query, parameters, resource).then((result) => safeCallback(cb || parameters, result));
|
preparedStatement(query, parameters, resource).then((result) => safeCallback(cb || parameters, result));
|
||||||
});
|
});
|
||||||
|
|
||||||
if (GetEntityAttachedTo || !GetResourceMetadata(GetCurrentResourceName(), 'server_script', 1)) {
|
// Check for a recent native (~server artifact 4700) to enable JS exports
|
||||||
|
if (GetEntityAttachedTo !== undefined || !GetResourceMetadata(GetCurrentResourceName(), 'server_script', 1)) {
|
||||||
global.exports('prepareSync', async (query, parameters) => {
|
global.exports('prepareSync', async (query, parameters) => {
|
||||||
const result = await preparedStatement(query, parameters, GetInvokingResource());
|
const result = await preparedStatement(query, parameters, GetInvokingResource());
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
+2
-2
@@ -10,7 +10,7 @@ if (connectionString === '') {
|
|||||||
const dbOptions = (() => {
|
const dbOptions = (() => {
|
||||||
const options = connectionString.includes('mysql://')
|
const options = connectionString.includes('mysql://')
|
||||||
? { uri: connectionString }
|
? { uri: connectionString }
|
||||||
: (options = connectionString
|
: connectionString
|
||||||
.replace(/(?:host(?:name)|ip|server|data\s?source|addr(?:ess)?)=/gi, 'host=')
|
.replace(/(?:host(?:name)|ip|server|data\s?source|addr(?:ess)?)=/gi, 'host=')
|
||||||
.replace(/(?:user\s?(?:id|name)?|uid)=/gi, 'user=')
|
.replace(/(?:user\s?(?:id|name)?|uid)=/gi, 'user=')
|
||||||
.replace(/(?:pwd|pass)=/gi, 'password=')
|
.replace(/(?:pwd|pass)=/gi, 'password=')
|
||||||
@@ -20,7 +20,7 @@ const dbOptions = (() => {
|
|||||||
const [key, value] = parameter.split('=');
|
const [key, value] = parameter.split('=');
|
||||||
connectionInfo[key] = value;
|
connectionInfo[key] = value;
|
||||||
return connectionInfo;
|
return connectionInfo;
|
||||||
}, {}));
|
}, {});
|
||||||
|
|
||||||
options.namedPlaceholders = true;
|
options.namedPlaceholders = true;
|
||||||
options.typeCast = parseTypes;
|
options.typeCast = parseTypes;
|
||||||
|
|||||||
Reference in new issue
Block a user