mysql5-specific bug or feature

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
cyrilo
Posts: 18
Joined: Wed 11 Oct 2006 08:47

mysql5-specific bug or feature

Post by cyrilo » Tue 11 Mar 2008 04:55

my app (D7 with 5.20.1.14) designed for mysql server 4.1
I'm upgraded to mysql 5.0 and found problem with TMyTable - it's not working with mysql 5.0.41 (community, win32).

Example:
mysql 4.1

Code: Select all

use test;
SELECT * from table1
OK

Code: Select all

SELECT * from test.table1
OK

mysql 5.0

Code: Select all

use test;
SELECT * from table1
error in SQL query

Code: Select all

SELECT * from test.table1
OK

TMyTable is use SQL-query "SELECT * from table1" for fetching data from table. When application tried to open TMyTable, exception is raised every time.

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Tue 11 Mar 2008 08:09

I could not reproduce the problem. What is the exact error message?

Note, using the USE command in scripts that are executed with components of MyDAC is not recommended. It is better changing the TMyConnection.Database property.

cyrilo
Posts: 18
Joined: Wed 11 Oct 2006 08:47

Post by cyrilo » Wed 12 Mar 2008 03:14

Antaeus wrote:What is the exact error message?
in my real case:
#42000You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'schemas ORDER BY Name' at line 1
My real SQL is (from DBMonitor log):

Code: Select all

SELECT * FROM schemas ORDER BY Name
I tried to launch this SQL in mysql command-line client and got the same error message.

Code: Select all

SELECT * FROM phone.schemas ORDER BY Name
executed successfully without any errors.
Antaeus wrote: Note, using the USE command in scripts that are executed with components of MyDAC is not recommended.
I never use USE command with MyDAC. It's only for better understanding of my example.

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Thu 13 Mar 2008 15:33

You should quote schemas. Set the QuoteNames option of TMyQuery to True.

cyrilo
Posts: 18
Joined: Wed 11 Oct 2006 08:47

Post by cyrilo » Sat 15 Mar 2008 03:11

with QuoteNames=True it works.
Thanks!

Post Reply