mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-02 06:28:54 +00:00
fix(config): export convertNamedPlaceholders
parseArguments relied on options.namedPlaceholders, which is now always false. Function is now exported directly when enabled (+typed).
This commit is contained in:
1 parent
45aadf7442
commit
f3401eb671
2 files changed
+4
-4
No files matched your search
+3
-1
@@ -61,6 +61,8 @@ const parseUri = (connectionString: string) => {
|
||||
return options;
|
||||
};
|
||||
|
||||
export let convertNamedPlaceholders: null | ((query: string, parameters: Record<string, any>) => [string, any[]]);
|
||||
|
||||
export const connectionOptions = (() => {
|
||||
const options: Record<string, any> = mysql_connection_string.includes('mysql://')
|
||||
? parseUri(mysql_connection_string)
|
||||
@@ -76,7 +78,7 @@ export const connectionOptions = (() => {
|
||||
return connectionInfo;
|
||||
}, {});
|
||||
|
||||
options.namedPlaceholders = options.namedPlaceholders === 'false' ? false : true;
|
||||
convertNamedPlaceholders = options.namedPlaceholders === 'false' ? null : require('named-placeholders')();
|
||||
|
||||
for (const key in ['dateStrings', 'flags', 'ssl']) {
|
||||
const value = options[key];
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import type { CFXCallback, CFXParameters } from '../types';
|
||||
import { connectionOptions } from '../config';
|
||||
|
||||
const convertNamedPlaceholders = connectionOptions.namedPlaceholders && require('named-placeholders')();
|
||||
import { convertNamedPlaceholders } from '../config';
|
||||
|
||||
export const parseArguments = (
|
||||
invokingResource: string,
|
||||
|
||||
Reference in new issue
Block a user