Page 1 of 1

MySQL double quotes get removed

Posted: Thu 25 Jan 2018 16:22
by BKeffer
Hey!

I'm still trying out your components. Now I want to use UniDAC and MySQL.
If I do

Code: Select all

AnyTable.SQL.Text:= 'SELECT * FROM automat WHERE name="Test"'
all double quotes will be replaced by

Code: Select all

`
This is not a single quote, it's a quote for table names, not for strings.
The same happens when

Code: Select all

AnyTable.Connection.MacroByName('any_condition').Value:= 'name="Test"';

How can I solve this Problem?

Re: MySQL double quotes get remove

Posted: Thu 25 Jan 2018 16:56
by ViktorV
To solve the issue, please try to set the EnableUniSQL global variable from the Uni unit to False. For example:

Code: Select all

initialization
  EnableUniSQL := False;

Re: MySQL double quotes get remove

Posted: Thu 25 Jan 2018 17:08
by BKeffer
Yeh, but then the macros will not work anymore :-/

Code: Select all

SQL.Text:= '{select_clause}';

Re: MySQL double quotes get removed

Posted: Mon 29 Jan 2018 13:49
by ViktorV
Since UniDAC is designed to develop applications that support various databases, it converts SQL into universal format. Therefore, for MySQL UniDAC replaces the character " with `.
UniDAC uses the characters "{" and "}" to specify macros within SQL queries. If the SQL parser finds any expression in {}, it replaces this expression with a predefined macro. A global variable EnableUniSQL is responsible for the above functionality. Therefore, when setting EnableUniSQL to False, the conversion of SQL into universal format will be disabled, but macros will stop working either.