Cannot detect blob writin in hex x'0f0f0f0f' and places an invalid space
SQL code formatter / beautifier
Status: Beta
Brought to you by:
dnsmkl
Grammar seems to lack support of BLOBs written in hex format like x'0f0f0f0f'.
That x and '0f0f0f0f' are recognized as speparate tokens and a space is added between them which causes invalid SQL.
Example:
select x'0f0f0f0f0f' where 1
Anonymous
Hello,
since I cannot edit ticked I've created accidentaly without logging, I just put an update here.
I have already implemented a simple hack for this bug. I did it without many thinking but it seems to be working. Hopefully it will help to get a proper solution.
See attached patch.
The patch is created againts sources downloaded in a zip: fsqlf.v0.03-94-g5d4a0a4.zip
Mi-La
Last edit: Mi-La 2014-07-11
Hi,
Thanks for reporting and taking time to solve it.
I'll make a bit simpler change.
(instead of treating them as separate tokens, treat them as one)
fsqlf.v0.03-105-gf6a9e49.zip contains the fixed version.
http://sourceforge.net/projects/fsqlf/files/fsqlf.v0.03/fsqlf.v0.03-105-gf6a9e49.zip/download
(if possible please, notify if "ok"/"not ok")
Hi, now it seems to be handling BLOBs properly, thanks for the fix. I had thougt it would be best to fix it in lexer but I didn't want to spend time on understanding it :-).
Anyway I have found yet another very similar problem. If I have numbers in a scientific notation (E notation), it's also not handled as a single token and space is inserted between a number and 'e'.
E.g:
1e10 will be formated as an invalid 1 e10.
Same for 1e-10, 1e+10.
Although 1.e10 works fine.
I suppose that the solution should be very similar. Just modifying the definition for NUMBERs.
again forgot to log in when posting previous post ... sorry :-)
Number scientific notation support added in fsqlf.v0.03-109-g0431d94.zip
http://sourceforge.net/projects/fsqlf/files/fsqlf.v0.03/fsqlf.v0.03-109-g0431d94.zip/download
Hi, thanks for the fixes, it works well.
Good work!