Page 1 of 1

user variables with ":="

Posted: Tue 29 Aug 2006 14:49
by Odelaine
Hi,

I've a big problem with setting user variables in MySQL.
Always when I try to use the syntax with ":", e.g. "SET @A := 1",
I get a strange error message (Exception EDatabaseError):
"Fehlender Wert fuer Parameter '='" --> "Missing value for parameter '='".

Example in Delphi:

SQLQLocalOnly.SQL.Add('SET @counter := 0; ');
SQLQLocalOnly.SQL.Add(
'UPDATE tbl1, ' +
'( ' +
'SELECT ' +
'(@counter := @counter+1) AS nummerierung, ... ' +
'FROM tbl3 ' +
'WHERE (...) ' +
'ORDER BY ... DESC ' +
') AS tbl2 ' +
'SET tbl1.platzierung = tbl2.nummerierung ' +
'WHERE (...) ';
SQLQLocalOnly.ExecSQL;

This example is working with phpMyAdmin properly, so Database and Statement should be OK.
All other MySQL-Statements are working properly with the corelab driver so far, so Installation should be OK.
In the first line I can use 'SET @counter = 0; ' instead of 'SET @counter := 0; ' which is working, but this syntax isn't allowed in the SELECT statement.

EDIT: I use dbexpmda.dll version 3.0 in TSQLConnection (Delphi 7.0)

Please give me any advices to solve this issue.

Best Regards
Ingolf :?

Re: user variables with ":="

Posted: Wed 30 Aug 2006 08:42
by Guest
Odelaine wrote:Hi,

I've a big problem with setting user variables in MySQL.
Always when I try to use the syntax with ":", e.g. "SET @A := 1",
I get a strange error message (Exception EDatabaseError):
"Fehlender Wert fuer Parameter '='" --> "Missing value for parameter '='".

Example in Delphi:

SQLQLocalOnly.SQL.Add('SET @counter := 0; ');
SQLQLocalOnly.SQL.Add(
'UPDATE tbl1, ' +
'( ' +
'SELECT ' +
'(@counter := @counter+1) AS nummerierung, ... ' +
'FROM tbl3 ' +
'WHERE (...) ' +
'ORDER BY ... DESC ' +
') AS tbl2 ' +
'SET tbl1.platzierung = tbl2.nummerierung ' +
'WHERE (...) ';
SQLQLocalOnly.ExecSQL;

This example is working with phpMyAdmin properly, so Database and Statement should be OK.
All other MySQL-Statements are working properly with the corelab driver so far, so Installation should be OK.
In the first line I can use 'SET @counter = 0; ' instead of 'SET @counter := 0; ' which is working, but this syntax isn't allowed in the SELECT statement.

EDIT: I use dbexpmda.dll version 3.0 in TSQLConnection (Delphi 7.0)

Please give me any advices to solve this issue.

Best Regards
Ingolf :?

Posted: Wed 30 Aug 2006 10:06
by Antaeus
Parameters are parsed by SQLQuery of dbExpress (in unit SqlExpr, TSQLQuery.QueryChanged method) but not by our driver. To prevent this behaviour you can set ParamCheck option of SQLQuery to False.

Re: user variables with ":="

Posted: Wed 30 Aug 2006 11:31
by Odelaine
That easy is this!

Many Thanks for giving me this small, but vital hint.

Ingolf