web.py - I can't select query tables in mysql, but only with certain names -


i have couple tables in database named 19efdf22eeefaa6dc322be094bb2da475d4d457c , 8e0b5a906b375bc5f6c44ca4274d7374ea43435a.

when run code

select *  table_name order name asc 

where table_name 1 of above tables, query fails on second 1 not first 1 , not sure why.

this seems happen randomly , found if surround table names "`" (the grave mark), works fine, using web.py web framework , there useful wrappers easy queries involving insert , select.

i generating these string using python hash function pretty same (not same, per say, similar).

i not sure either should put backquotes around every identifier this:

select *  `table_name` order `name` asc 

mysql understands backquote around database name, table name, , column name in way. here old url how did indeed recommended : http://mail.python.org/pipermail/db-sig/2007-august/005172.html

you insert before , after \x60 (the backquote) table name. forgive me, not conversant in python.

update 2013-05-20 22:08 edt

here conjecture: first 2 characters, if taken hexadecimal value, less 128 , think character set information_schema.tables may interfering table name's interpretation. have experiment table names first 2 characters less or equal 7f. way know if case add python code retries sha1 hash again if first 2 characters (in terms of hexadecimal value) greater 7f.

give try !!!


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -