Double quotes problem

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
m227
Posts: 75
Joined: Mon 06 Aug 2007 12:41

Double quotes problem

Post by m227 » Wed 17 Mar 2021 18:34

Hi, I use UniDAC 6.1.3 for Delphi 2006 and 8.2.4 for RAD Studio 10.2 to connect with MySQL 8.0.23.

My simple code like:

Code: Select all

procedure TForm34.Button1Click(Sender: TObject);
begin
  UniQuery1.SQL.Text := 'SELECT "0"';
  UniQuery1.Open;
end;
produces error:
Exception class EMySqlException with message '#42S22Unknown column '0' in 'field list''.
While the same query with apostrophes (single quotes) instead double quotes runs ok.
I checked global and session variables sql_mode and there is not ANSI_QUOTES in it.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Double quotes problem

Post by ViktorV » Fri 19 Mar 2021 17:24

Most likely this behavior is related to the MySQL server settings, and not to the functionality of MyDAC.
Try using the following code:

Code: Select all

   UniConnection1.ExecSQL ('SET SESSION sql_mode = TRADITIONAL');
   UniQuery1.SQL.Text: = 'SELECT "0"';
   UniQuery1.Open;
or

Code: Select all

   UniConnection1.ExecSQL ('SET SESSION sql_mode =' '' '');
   UniQuery1.SQL.Text: = 'SELECT "0"';
   UniQuery1.Open;

m227
Posts: 75
Joined: Mon 06 Aug 2007 12:41

Re: Double quotes problem

Post by m227 » Fri 19 Mar 2021 22:04

Thank you for hints Viktor. I tried both your solutions, but none worked :/
Still get the same error.
What's more the same query run in Workbench works without problem.

This is my line from my.ini:
sql_mode=NO_ZERO_IN_DATE,NO_ZERO_DATE,NO_ENGINE_SUBSTITUTION

Here I prepared simple source code to program I run:
http://www.bazydlafirm.home.pl/e-storm/ ... problem.7z

I put there my.ini also.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Double quotes problem

Post by ViktorV » Mon 22 Mar 2021 17:50

Unfortunately, we are unable to reproduce the issue in our environment based on the information you provide.
In order for us to be able to give you a detailed answer, please compose a small sample demonstrating the described behavior with permanent test access and send it to us using contact form https://devart.com/company/contactform.html

Post Reply