ZMySQLDA probably requires there to be some whitespace after the "SELECT" keyword, even if SQL syntax does not strictly require it.
By the way, "does not work" is not a very useful problem support, particularly when you don't even say what you are using; in your original post, you did not say if you were using MySQLdb or ZMySQLDA.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well, a white space after select was my first try, and it did not work. That gave me the idea of trying ' ', and that works except the following string will be header of the first returned column whatever the string contains. Then, komma and white space and column-names works fine. E.g.
select''odd, col1,col1 from mytable;
will return a table with three columns where the first has the name odd with no values. The two next columns has the content of col1 and col2.
select 7+3;
does not work, but
select'''', 7+3;
returns two columns where the first is named ' and filled with '. The second is named 7+3 and is filled with 10.
It looks like ZMysqldb won't recognize a blank space after select. Strange because insert works fine.
Sorry, for not supplying sufficient information.
Flemming
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Could anyone tell my why:
select * from mytable;
select co1,col2 from mytable;
does not work, whereas
select* from mytable;
select(col1) from mytable;
work fine? It is not in accordance with the documentation for mysql, (though all four commands work in mysql).
But how do I select from more collums?
select(col1,col2) from mytable;
does not work???
Flemming
well, I found out that the following strang command works:
select' ' col1, col2, col3 from mytable;
But, it can't retreive that values from col1. It seems that the space behind select is not recognized by ZMysqldb.
Flemming
ZMySQLDA probably requires there to be some whitespace after the "SELECT" keyword, even if SQL syntax does not strictly require it.
By the way, "does not work" is not a very useful problem support, particularly when you don't even say what you are using; in your original post, you did not say if you were using MySQLdb or ZMySQLDA.
Well, a white space after select was my first try, and it did not work. That gave me the idea of trying ' ', and that works except the following string will be header of the first returned column whatever the string contains. Then, komma and white space and column-names works fine. E.g.
select''odd, col1,col1 from mytable;
will return a table with three columns where the first has the name odd with no values. The two next columns has the content of col1 and col2.
select 7+3;
does not work, but
select'''', 7+3;
returns two columns where the first is named ' and filled with '. The second is named 7+3 and is filled with 10.
It looks like ZMysqldb won't recognize a blank space after select. Strange because insert works fine.
Sorry, for not supplying sufficient information.
Flemming
Works fine over here. Can you post relevent code and version numbers for python, mysql, and MySQLdb?
zope 2.6.1 with python2.1.3 (installed with rpm on mdk. 9.0)
mysql4.0.12
MySQL-python-0.9.2.tar.gz
ZMySQLDA-2.0.8.tar.gz
When I ssh to the linuxbox and login to mysql the select works normal, so it must be something with later on.
Thank, you for response. To night, I will try on my machine back home.
Flemming
Don't use semicolons in Z SQL Methods. If you must have multiple statements, separate them with <dtml-var sql_delimiter>.
(you found the answer in another thread, I am repeating it for the benefit of others who find this)