Page 1 of 1

Double quotes problem

Posted: Wed 17 Mar 2021 18:34
by m227
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.

Re: Double quotes problem

Posted: Fri 19 Mar 2021 17:24
by ViktorV
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;

Re: Double quotes problem

Posted: Fri 19 Mar 2021 22:04
by m227
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.

Re: Double quotes problem

Posted: Mon 22 Mar 2021 17:50
by ViktorV
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