It appears that dabo handled several fieldnames as keywords correctly,
but failed to escape them when generating the SQL statement. This is
(as Uwe pointed out) an error of using a SQL keyword, not a python
keyword.

Configuration: MySQL 5.0.27 server, client 5.0.22, all on localhost.

mysql> explain pythontest;
+---------------+--------------+------+-----+---------+----------------+
| Field         | Type         | Null | Key | Default | Extra          |
+---------------+--------------+------+-----+---------+----------------+
| ipythontestpk | bigint(20)   | NO   | PRI | NULL    | auto_increment |
| assert        | char(8)      | NO   |     | "Empty" |                |
| for           | tinyint(4)   | YES  |     | 0       |                |
| print         | mediumint(9) | YES  |     | 0       |                |
| lambda        | bit(1)       | YES  |     | NULL    |                |
+---------------+--------------+------+-----+---------+----------------+
5 rows in set (0.00 sec)


Platform: GTK
Python Version: 2.4.4 on linux2
Dabo Version: Version 0.8a; Revision 2809
UI Version: 2.6.3.2 on wxGTK (gtk2)

(dabo updated via svn before test)

Here's a reproducible test, using the AppWizard: create a new
appwiz-generated form and run it. Hitting requery gives you the error:

(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 'for,\n       pythontest.print as print,\n
pythontest.lambda as lambda\n  from' at line 3")
SQL: select pythontest.ipythontestpk as ipythontestpk,
       pythontest.assert as assert,
       pythontest.for as for,
       pythontest.print as print,
       pythontest.lambda as lambda
  from pythontest
 limit 1000

Workaround: it's highly recommended that you avoid all keywords in
fieldnames, but it can be difficult to keep track of them all. Should
fieldnames in SQL statements (at least in MySQL) be escaped by
default, or does that just lead programmers to doing more silling
things? There are arguments for both sides, I suppose.

-- 
Ted Roche
Ted Roche & Associates, LLC
http://www.tedroche.com

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users

Reply via email to