double quotes and Invalid Table Name ''

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for MySQL in Delphi and C++Builder
Post Reply
eduardo
Posts: 3
Joined: Mon 09 Jul 2007 17:47

double quotes and Invalid Table Name ''

Post by eduardo » Mon 09 Jul 2007 18:22

Hi all,

we have an application developed with Kylix 2 / midas and connected to MySQL 3.23 with Borland's drivers. Now we are upgrading our Debian systems and MySQL is at 4.1, so those drivers have stopped working. We've downloaded crlab.com drivers to test them out, and the good thing is that, after configuring dbxdrivers and dbxconnections, we can connect again to MySQL using libsqlmda.so.3.20, but the bad news is we still can not access MySQL table data - it seems the driver is adding two single quotes around table names in the queries it sends to the server.

In our application we have TDataSetProvider's linked to a TSQLClientDataSet's with CommandType = 'ctTable' and CommandText set to the table name of each table. Using DBMonitor, the query built and sent by the driver for a table 'Clients' to MySQL is 'select * from ``Clients``' (note the quotes around Clients), so MySQL reasonably returns error Invalid Table Name ''. We've used the UseQuoteChar option (set to false) as explained in the documentation, but the generated sql is the same.

What are we doing wrong in setting up the driver and the Kylix components?

TIA,

Eduardo

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

Post by Antaeus » Tue 10 Jul 2007 08:46

I created a default application using your explanation, but could not reproduce this problem. Please provide the code, or send me a complete small sample to evgeniyd*crlab*com, to demonstrate it.

eduardo
Posts: 3
Joined: Mon 09 Jul 2007 17:47

Post by eduardo » Tue 10 Jul 2007 10:08

Hi Antaeus,

thank you for replying. I've just sent you a project with a minimal application that connects to test.test and, on my system, reproduces the described problem.

TIA,

Eduardo

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

Post by Antaeus » Fri 13 Jul 2007 07:45

Thank you for your sample. It reproduces the problem. Now we are working on it.
As soon as we have any results, we will let you know.

eduardo
Posts: 3
Joined: Mon 09 Jul 2007 17:47

Post by eduardo » Wed 18 Jul 2007 07:30

Thank you for your replay Antaeus. I'll be watching this topic, since we depend on this issue to migrate our systems.

TIA

Eduardo

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

Post by Antaeus » Tue 28 Aug 2007 09:52

We have deeper investigated this problem. The reason of this problem is in dbExpress code. The query with double quoted table name is generated by dbExpress, and then passed to DbxMda. Unfortunately there is no appropriate solution to avoid this issue in the driver. You should use the SQLClientDataSet with the following parameters instead:

Code: Select all

 CommandText = 'select * from Clients'
 CommandType = ctQuery

Post Reply