Skip to content

Commit

Permalink
Allow falsy MySQL variable values
Browse files Browse the repository at this point in the history
  • Loading branch information
evankennedy committed Mar 22, 2023
1 parent 9005faa commit 98ea8fa
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function prepareQuery(sql: string, params: Record<string, string>) {
const trimmedMatch = match.trim().replaceAll(/[']+/g, '');
if (trimmedMatch[0] === '$') {
const varName = trimmedMatch.slice(1);
if (params[varName]) {
if (typeof params[varName] !== 'undefined') {
substitutions.push(params[varName]);
}
return '?';
Expand Down

0 comments on commit 98ea8fa

Please sign in to comment.