TMyScript and quotes around Parameters

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
skydvrz
Posts: 32
Joined: Tue 23 Feb 2010 23:49
Location: Kissimmee, Florida USA
Contact:

TMyScript and quotes around Parameters

Post by skydvrz » Wed 01 Aug 2012 02:16

I have the following lines in my (very long) script file:

Code: Select all

CREATE SCHEMA IF NOT EXISTS &destschema;
USE &destschema;
TMyScript translates the &destschema to "myschemaname" with double quotes. The trouble is that I think it should use a special single quote like so: `myschemaname`.

If I manually execute the script with (`) quotes using the MySQL query browser, it works. If I use double quotes (") in a manual query it fails with a syntax error.

The TMyScript is failing with syntax errors, so I think the problem is the quotes. Any ideas?

Best regards,

Kevin G. McCoy

AndreyZ

Re: TMyScript and quotes around Parameters

Post by AndreyZ » Wed 01 Aug 2012 08:27

Hello,

This is a correct behaviour. If you set the macro value using the AsString property, its value is set to ''value'' (it's not a double quotes) that means that it stores the string 'value'. To avoid this problem, you should use the following code:

Code: Select all

MyScript.MacroByName('destschema').Value := 'schemaname';

skydvrz
Posts: 32
Joined: Tue 23 Feb 2010 23:49
Location: Kissimmee, Florida USA
Contact:

Re: TMyScript and quotes around Parameters

Post by skydvrz » Wed 01 Aug 2012 14:23

Perfect, and thank you for the quick response!

Kevin

AndreyZ

Re: TMyScript and quotes around Parameters

Post by AndreyZ » Wed 01 Aug 2012 15:04

Feel free to contact us if you have any other questions about MyDAC.

Post Reply