You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
support MySQL special character escape sequences #23
INSERT INTO externallinks VALUES (23481,120102,'http://home.arcor.de/jean-polmartin/aufsaetze/apliut.htm\'','http://de.arcor.home./jean-polmartin/aufsaetze/apliut.htm\'','http://de.arcor.home./jean-polmartin/aufsaetze/apliut.htm\'');
SQLite escape sequences don't seem to be supported either. According to the README:
We try to support both the SQLite and MySQL syntax; where they disagree, we choose MySQL. (It would be nice to support both via feature flags in the future.)
So I think :
'''' should parse as ' (sqlite-only)
'\' should parse as \ (sqlite-only)
'\\' should parse as \\ (it is a valid string in both SQLite and mysql, but with a different meaning)
Good catch -- I actually independently ran into this issue last week (also parsing MySQL dumps) and made a mental note to fix it!
I originally looked at nom::escaped_transform for this, but didn't yet figure out exactly how to use it for this purpose. Looks like you ended up hand-rolling the parse rule instead, probably for good reasons.
Activity
lovasoa commentedon Sep 14, 2018
SQLite escape sequences don't seem to be supported either. According to the README:
So I think :
''''should parse as'(sqlite-only)'\'should parse as\(sqlite-only)'\\'should parse as\\(it is a valid string in both SQLite and mysql, but with a different meaning)'\''should parse as'(mysql-only)lovasoa commentedon Sep 14, 2018
It should not be difficult to implement using
nom::escaped_transformms705 commentedon Sep 14, 2018
Good catch -- I actually independently ran into this issue last week (also parsing MySQL dumps) and made a mental note to fix it!
I originally looked at
nom::escaped_transformfor this, but didn't yet figure out exactly how to use it for this purpose. Looks like you ended up hand-rolling the parse rule instead, probably for good reasons.I'll check out the PR 👍
lovasoa commentedon Sep 16, 2018
I also tried to use
nom::escaped_transformbut with no success. I think this is because of that part of the documentation:Implement the remaining mysql string escape code
ms705 commentedon Oct 3, 2018
I think we have all of them supported now, thanks to @lovasoa's work 👍