apla / node-clickhouse

Yandex ClickHouse driver for nodejs
MIT License
216 stars 50 forks source link

Backslash escapes not working properly #16

Closed arrterian closed 5 years ago

arrterian commented 6 years ago

The library has a problem with escaping backslashes

In code we have: v.replace (/\\/g, '\\')

Its mean: please replace each one backslash with one backslash Because JS has following rules for backslashes in strings and regular expressions

\ — always escapes the next character \\ — always mean one backslash

So for replacing one backslash with two backslashes, we need double this one in second parameters of replace function

v.replace (/\\/g, '\\') -> v.replace (/\\/g, '\\\\')

arrterian commented 6 years ago

Fixed in PR #15

arrterian commented 5 years ago

Merged