Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cf5bb63

Browse files
committed
fix: fixed an issue where only the first special character of each type would be escaped when building queries
Closes #25
1 parent d2cef88 commit cf5bb63

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/quoteString.js

+4-4
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)