Page 1 of 1

SQL syntax error on ApplyUpdates()

Posted: Mon 13 Dec 2004 09:25
by Sotharr
Hi,

I use MyDAC 3.30.1.13 with Borland C++ 6 and MySQL 4.1.7. When I edit MyTable and then call connection's ApplyUpdates (or table's Post() when cache is disabled), I get "You have an error in your SQL syntax" error. The query is, for example:
UPDATE project SET Archived=:8 WHERE :8(Boolean,IN)=True
The server seems to reject the ":8 WHERE :8(Boolean,IN)=True" part of the query. What's the problem? Is the MySQL server misconfigured or is it MyDAC bug?

Thank you, regards
Pawel Sobocinski

Re: SQL syntax error on ApplyUpdates()

Posted: Mon 13 Dec 2004 15:48
by Ikar
Post please script to create table.

Posted: Tue 14 Dec 2004 09:22
by Sotharr
To create table, I use TMyQuery and following SQL statement:

Code: Select all

CREATE TABLE `tpm`.`project` (
  `IntID` FLOAT UNSIGNED NOT NULL AUTO_INCREMENT,
  `ID` VARCHAR(20) NOT NULL, 
  `Name` VARCHAR(50) NOT NULL, 
  `Description` VARCHAR(200) NOT NULL, 
  `DirName` VARCHAR(200) NOT NULL,
  `Suspended` BOOLEAN NOT NULL, 
  `Closed` BOOLEAN NOT NULL, 
  `Archived` BOOLEAN NOT NULL, 
  `CustomerIntID` FLOAT UNSIGNED NOT NULL,
  `CustomerName` VARCHAR(150) NOT NULL, 
   PRIMARY KEY(`IntID`), 
   INDEX `CustomerIntIDIndex`(`CustomerIntID`)
) TYPE = InnoDB COLLATE Default;
Regards,
Pawel

Posted: Tue 14 Dec 2004 16:18
by Ikar
The problem is in using FLOAT-field as a key field. As a method and precision of storing these values in MySQL and Delphi a little bit different this field cannot be used as a key field. Try to change it on INT.

Posted: Wed 15 Dec 2004 09:03
by Sotharr
Yes, that was the problem. It works now, thank you very much.

regards
Pawel