mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-04 06:28:53 +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;
|
return options;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export let convertNamedPlaceholders: null | ((query: string, parameters: Record<string, any>) => [string, any[]]);
|
||||||
|
|
||||||
export const connectionOptions = (() => {
|
export const connectionOptions = (() => {
|
||||||
const options: Record<string, any> = mysql_connection_string.includes('mysql://')
|
const options: Record<string, any> = mysql_connection_string.includes('mysql://')
|
||||||
? parseUri(mysql_connection_string)
|
? parseUri(mysql_connection_string)
|
||||||
@@ -76,7 +78,7 @@ export const connectionOptions = (() => {
|
|||||||
return connectionInfo;
|
return connectionInfo;
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
options.namedPlaceholders = options.namedPlaceholders === 'false' ? false : true;
|
convertNamedPlaceholders = options.namedPlaceholders === 'false' ? null : require('named-placeholders')();
|
||||||
|
|
||||||
for (const key in ['dateStrings', 'flags', 'ssl']) {
|
for (const key in ['dateStrings', 'flags', 'ssl']) {
|
||||||
const value = options[key];
|
const value = options[key];
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import type { CFXCallback, CFXParameters } from '../types';
|
import type { CFXCallback, CFXParameters } from '../types';
|
||||||
import { connectionOptions } from '../config';
|
import { convertNamedPlaceholders } from '../config';
|
||||||
|
|
||||||
const convertNamedPlaceholders = connectionOptions.namedPlaceholders && require('named-placeholders')();
|
|
||||||
|
|
||||||
export const parseArguments = (
|
export const parseArguments = (
|
||||||
invokingResource: string,
|
invokingResource: string,
|
||||||
|
|||||||
Reference in new issue
Block a user