Subject: | Fails to tokenize SQL segments containing empty strings (single quotes with nothing inbetween) |
Thank you for a handy module!
It seems like using empty strings (two single-quote marks with nothing
inbetween) seems to cause a hiccup in the parser and it fails to
properly tokenize the string.
The following portion of a SQL statement does not get processed into
tokens properly:
nvl(reward_type,'')='' and group_code = 'XXXX'
It gets incorrectly processed into (notice the 4th line, where there are
several SQL components all inside of the same "token"):
'(',
'reward_type',
',',
'\'\')=\'\' and group_code = \'',
'XXXX\'',
But if I try to parse this:
nvl(reward_type,'x')='x' and group_code = 'XXXX'
It gets properly parsed into:
'nvl',
'(',
'reward_type',
',',
'\'x\'',
')',
'=',
'\'x\'',
' ',
'and',
' ',
'group_code',
' ',
'=',
' ',
'\'XXXX\'',
I've looked at the regex, and it'll take me some digesting to figure it
out so I thought I might throw a bug report your way in case you might
be able to figure it out more quickly.
Thanks again..
--James
Other info:
SQL::Tokenizer 0.07
Perl 5.8.6
SunOS 5.10 Generic sun4u sparc SUNW,Sun-Fire-V440