Skip to content

Commit 3029c91

Browse files
authored
Merge pull request #26 from zachary-D/fix/#25-only-first-special-character-is-escaped
fix: #25 an issue where only the first special character of each type would be escaped when building queries
2 parents d2cef88 + cf5bb63 commit 3029c91

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/quoteString.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ function QuoteString(string) {
1515
}
1616
string = string.toString();
1717
string = string.replace(/\\/g, '\\\\');
18-
string = string.replace('\x00', '\\x00');
19-
string = string.replace('\n', '\\n');
20-
string = string.replace('\r', '\\r');
21-
string = string.replace("'", "''");
18+
string = string.replace(/\x00/g, '\\x00');
19+
string = string.replace(/\n/g, '\\n');
20+
string = string.replace(/\r/g, '\\r');
21+
string = string.replace(/'/g, "''");
2222
return "'" + string + "'";
2323
}
2424

0 commit comments

Comments
 (0)