Skip to content

Commit

Permalink
Compile
Browse files Browse the repository at this point in the history
  • Loading branch information
grassick committed Jul 21, 2021
1 parent 7d47282 commit 822593e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/SqlFragment.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ class SqlFragment {
let n = 0;
// All the question marks not followed by | or &
// ?| and ?& are jsonb operators (so is ?, but it can be replaced by one of the others)
const sql = this.sql.replace(/\?(?!\||&)/g, (str) => {
// This complex expression is to not match 'xyz?'. See https://stackoverflow.com/questions/6462578/regex-to-match-all-instances-not-inside-quotes
const sql = this.sql.replace(/\?(?!\||&)(?=([^']*'[^']*')*[^']*$)/g, (str) => {
// Insert nth parameter
// Check type
const param = this.params[n];
Expand Down

0 comments on commit 822593e

Please sign in to comment.