Hi,
     Is there is any update on the usage of reserved keywords in the table 
definition. In this thread 

https://groups.google.com/forum/?fromgroups=#!newtopic/web2py/web2py/hCsxVaDLfT4
 Massimo 
says "we need to change it in dal.py."

I need to create a table in mysql db as:

    db.define_table('rms_rule', 
            Field('condition', 
requires=IS_IN_SET(['IsEqual','IsNotEqual','IsGreater','IsLesser','IsNull','IsNotNull','Likeliness','IsMatch','IsNotMatch','In'])),
    )

I tried with backticks(`) as mysql stats and different combinations of 
qoutes.

If I use it as given above the error is a mysql programming error:

ProgrammingError: (1064, "You have an error in your SQL syntax; check the 
manual that corresponds to your MySQL server version for the right syntax 
to use near 'condition VARCHAR(255),\n    description VARCHAR(255) NOT 
NULL,\n    params VARCHA' at line 13")

So it passed DAL but escaping might be the problem. But using the backticks 
as mysql says, it generates syntax error which is caught by DAL. 

db.define_table('rms_rule', 
            Field('`condition`', 
requires=IS_IN_SET(['IsEqual','IsNotEqual','IsGreater','IsLesser','IsNull','IsNotNull','Likeliness','IsMatch','IsNotMatch','In'])),
    )

SyntaxError: invalid table or field name: `condition`

is there any way in escaping these reserve keywords. Its difficult to 
change the field name as its already defined by third party in mysql.

The above thread was one year back.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to