mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-02 14:38:50 +00:00
fix: undefined values
Various mistakes from 1.8.1
This commit is contained in:
1 parent
b7763141b7
commit
94fe76340e
4 files changed
+6
-5
No files matched your search
+1
-1
@@ -71,7 +71,7 @@ const preparedStatement = async (query, parameters, resource) => {
|
||||
const executionTime = process.hrtime(startTime)[1] / 1000000; // nanosecond to millisecond
|
||||
if (executionTime >= slowQueryWarning || debug)
|
||||
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'
|
||||
}!
|
||||
${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));
|
||||
});
|
||||
|
||||
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) => {
|
||||
const result = await preparedStatement(query, parameters, GetInvokingResource());
|
||||
return result;
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@ if (connectionString === '') {
|
||||
const dbOptions = (() => {
|
||||
const options = connectionString.includes('mysql://')
|
||||
? { uri: connectionString }
|
||||
: (options = connectionString
|
||||
: connectionString
|
||||
.replace(/(?:host(?:name)|ip|server|data\s?source|addr(?:ess)?)=/gi, 'host=')
|
||||
.replace(/(?:user\s?(?:id|name)?|uid)=/gi, 'user=')
|
||||
.replace(/(?:pwd|pass)=/gi, 'password=')
|
||||
@@ -20,7 +20,7 @@ const dbOptions = (() => {
|
||||
const [key, value] = parameter.split('=');
|
||||
connectionInfo[key] = value;
|
||||
return connectionInfo;
|
||||
}, {}));
|
||||
}, {});
|
||||
|
||||
options.namedPlaceholders = true;
|
||||
options.typeCast = parseTypes;
|
||||
|
||||
Reference in new issue
Block a user