Menu

#9 Cannot detect blob writin in hex x'0f0f0f0f' and places an invalid space

closed
hex-string (1)
5
2014-07-23
2014-07-11
Anonymous
No

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

Discussion

  • Mi-La

    Mi-La - 2014-07-11

    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
  • Danas Mikelinskas

    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)

    --- old/core/fsqlf.lex
    +++ new/core/fsqlf.lex
    @@ -81,7 +81,7 @@ COMMENT_ML_PART1 [^*]+
     COMMENT_ML_PART2 [*]+[^/]
     COMMENT_ML_END   [*]+[/]
    
    -STRING (['][^']*['])+
    +STRING ([xX]?['][^']*['])+
     SEMICOLON ;
    
     INSERTINTO (?i:(ins|insert){SPACE}+into)
    
     
  • Anonymous

    Anonymous - 2014-07-22

    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.

     
  • Mi-La

    Mi-La - 2014-07-22

    again forgot to log in when posting previous post ... sorry :-)

     
  • Danas Mikelinskas

    • labels: blob -->
    • status: open --> accepted
     
  • Danas Mikelinskas

    • status: accepted --> closed
     
  • Danas Mikelinskas

    • labels: --> hex-string
     
  • Mi-La

    Mi-La - 2014-07-23

    Hi, thanks for the fixes, it works well.
    Good work!

     

Anonymous
Anonymous

Add attachments
Cancel





Auth0 Logo