Specs:
fedora core 3
python 2.3.5
zope 2.7.6-final
mysql-python 1.2.1g3
ZMySQLDA 2.0.9
<br>
I'm having difficulties running simples queries in a Z SQL Method. This is the methods code:
select * from <dtml-var tabela>;
where tabela is passed as an argument. This will always give the same error when testing:
Module Products.ZMySQLDA.db, line 326, in query
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 '; LIMIT 1000' at line 1")
I've tried various different values for the 'max results to retrieve', but it's all the same. I've also tried specifying the table directly, instead of passing it as an argument, but the error is the same. The rendered SQL shown actually works on the db. Is this release of MySQLDA broken, is this a bug, or am I messing up somewhere?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
As it turns out, and with the help of a more experienced user (thnx, tinow :) ) it turns out that the query actually works, what doesn't work is displaying the query results... Running the same SQL from the connection test gives the correct result, and calling it from another object, like this:
return context.test_sqlquery().dictionaries()
works. So I suppose there's a problem with displaying the results from the Z SQL method test. Is this a bug? Should it be reported?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You are messing up. If you want a limit, set it in the max_rows property of the Z SQL Method. If you really want to put it in your SQL statement, add a comment to the beginning of your query; a simple line of two dashes will do this.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've investigated further, and the problem goes beyond this. I've set the limit to 0, and changed the query to simply
SELECT * FROM input
where input is the name of the table. Now I get this error:
<li> Module DocumentTemplate.DT_String, line 474, in call</li> <li> Module DocumentTemplate.DT_In, line 602, in renderwb</li> <li> Module DocumentTemplate.DT_Var, line 219, in render</li> </ul>KeyError: 'query' </p>
However, this same query works from the db connection test. Also, inserts and truncates work. I'm completely lost here....
BTW, thnx for the quick response andy...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Specs:
fedora core 3
python 2.3.5
zope 2.7.6-final
mysql-python 1.2.1g3
ZMySQLDA 2.0.9
<br>
I'm having difficulties running simples queries in a Z SQL Method. This is the methods code:
select * from <dtml-var tabela>;
where tabela is passed as an argument. This will always give the same error when testing:
Module Products.ZMySQLDA.db, line 326, in query
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 '; LIMIT 1000' at line 1")
I've tried various different values for the 'max results to retrieve', but it's all the same. I've also tried specifying the table directly, instead of passing it as an argument, but the error is the same. The rendered SQL shown actually works on the db. Is this release of MySQLDA broken, is this a bug, or am I messing up somewhere?
As it turns out, and with the help of a more experienced user (thnx, tinow :) ) it turns out that the query actually works, what doesn't work is displaying the query results... Running the same SQL from the connection test gives the correct result, and calling it from another object, like this:
return context.test_sqlquery().dictionaries()
works. So I suppose there's a problem with displaying the results from the Z SQL method test. Is this a bug? Should it be reported?
You are messing up. If you want a limit, set it in the max_rows property of the Z SQL Method. If you really want to put it in your SQL statement, add a comment to the beginning of your query; a simple line of two dashes will do this.
I've investigated further, and the problem goes beyond this. I've set the limit to 0, and changed the query to simply
SELECT * FROM input
where input is the name of the table. Now I get this error:
<li> Module DocumentTemplate.DT_String, line 474, in call</li> <li> Module DocumentTemplate.DT_In, line 602, in renderwb</li> <li> Module DocumentTemplate.DT_Var, line 219, in render</li> </ul>KeyError: 'query' </p>
However, this same query works from the db connection test. Also, inserts and truncates work. I'm completely lost here....
BTW, thnx for the quick response andy...