digglife / ibm-db

Automatically exported from code.google.com/p/ibm-db
0 stars 0 forks source link

Improper specification of the illegal_initial_characters #133

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
ibm_db_sa-0.3.0-py27.egg/ibm_db_sa/base.py:509
    illegal_initial_characters = set(xrange(0, 10)).union(["_", "$"])

The expression 'set(xrange(0, 10))' gives set made of 10 integers, where set of 
10 single-char strings is needed.

This can be compared to the specification of this variable originally done in 
SQLAlchemy (I'm using versions 0.8.2, file sqlalchemy/sql/compiler.py:54):
ILLEGAL_INITIAL_CHARACTERS = set([str(x) for x in xrange(0, 10)]).union(['$'])

The problem shows up later, when this is used for checking 
(sqlalchemy/sql/compiler.py:2419):
                or value[0] in self.illegal_initial_characters

You can see below the results of the test made in Python 2.7:
>>> '1test'[0] in set(xrange(0, 10)).union(["_", "$"])
False
>>> '1test'[0] in set([str(x) for x in xrange(0, 10)]).union(['$'])
True

The line mentioned at the beginning should be changed to:
    illegal_initial_characters = set([str(x) for x in xrange(0, 10)]).union(["_", "$"])

Original issue reported on code.google.com by Adam.J.M...@gmail.com on 26 Aug 2013 at 2:01

GoogleCodeExporter commented 8 years ago
Thanks Adam for reporting this issue, we will remove this issue in our next 
release

Original comment by rahul.pr...@in.ibm.com on 2 Sep 2013 at 6:36

GoogleCodeExporter commented 8 years ago

Original comment by rahul.pr...@in.ibm.com on 18 Nov 2013 at 6:10