Page 1 of 1

TMyScript and quotes around Parameters

Posted: Wed 01 Aug 2012 02:16
by skydvrz
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

Re: TMyScript and quotes around Parameters

Posted: Wed 01 Aug 2012 08:27
by AndreyZ
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';

Re: TMyScript and quotes around Parameters

Posted: Wed 01 Aug 2012 14:23
by skydvrz
Perfect, and thank you for the quick response!

Kevin

Re: TMyScript and quotes around Parameters

Posted: Wed 01 Aug 2012 15:04
by AndreyZ
Feel free to contact us if you have any other questions about MyDAC.