Parsing bug under Oracle

30 views
Skip to first unread message

Richard Jones

unread,
Feb 14, 2012, 10:01:32 PM2/14/12
to sqlp...@googlegroups.com
Hi all. I use and love sqlpython but I've run into this rather annoying bug in the most recent public release:

"""
0:user@DB> select * from ac_ids where account='2080808080';
ORA-00936: missing expression

0:user@DB> select * from ac_ids where account='2080808080' and 1=1;

AC_ID  ACCOUNT
------ ----------
751806 2080808080

1 row selected.
"""

Any expression with a string literal at the end results in the "missing expression" response from Oracle. I would like to get this fixed but there's no public sqlpython project information that I can find. I'm also at a little bit of a loss regarding where to start looking to fix the parse bug.

Any advice?

nkiesel

unread,
Feb 17, 2012, 2:57:30 PM2/17/12
to sqlpython
Hi,

ran into the same problem. Not 100% sure what I'm doing there, but
the following change fixed it for me:

--- /tmp/cmd2.py 2012-02-17 11:52:52.261190542 -0800
+++ /usr/local/lib/python2.7/dist-packages/cmd2-0.6.3-py2.7.egg/
cmd2.py 2012-02-17 11:55:10.533190145 -0800
@@ -682,7 +682,8 @@
self.blankLineTerminationParser |
self.multilineCommand + pyparsing.SkipTo(stringEnd)
)
-
self.parser.ignore(pyparsing.quotedString).ignore(self.commentGrammars)
+ #NKNK
self.parser.ignore(pyparsing.quotedString).ignore(self.commentGrammars)
+ self.parser.ignore(self.commentGrammars)

inputMark = pyparsing.Literal('<')
inputMark.setParseAction(lambda x: '')
@@ -693,7 +694,8 @@
# as in "lesser than"
self.inputParser = inputMark + pyparsing.Optional(inputFrom)
+ pyparsing.Optional('>') + \
pyparsing.Optional(fileName) +
(pyparsing.stringEnd | '|')
-
self.inputParser.ignore(pyparsing.quotedString).ignore(self.commentGrammars).ignore(self.commentInProgress)
+ #NKNK
self.inputParser.ignore(pyparsing.quotedString).ignore(self.commentGrammars).ignore(self.commentInProgress)
+
self.inputParser.ignore(self.commentGrammars).ignore(self.commentInProgress)

def preparse(self, raw, **kwargs):
return raw

Python is ws-sensitive, so not sure if that patch can be automatically
applied correctly.

</nk>

nkiesel

unread,
Feb 17, 2012, 3:16:54 PM2/17/12
to sqlpython
(Not sure why my previous reply does not show up. Perhaps it will in
time)

Try removing the .ignore(pyparsing.quotedString) from self.inputParser
and self.parser in cmd2.py. This at least passed my simple tests.

</nk>


On Feb 14, 7:01 pm, Richard Jones <r1chardj0...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages