SQL syntax error on ApplyUpdates()

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Sotharr

SQL syntax error on ApplyUpdates()

Post by Sotharr » Mon 13 Dec 2004 09:25

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

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Re: SQL syntax error on ApplyUpdates()

Post by Ikar » Mon 13 Dec 2004 15:48

Post please script to create table.

Sotharr

Post by Sotharr » Tue 14 Dec 2004 09:22

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

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Tue 14 Dec 2004 16:18

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.

Sotharr
Posts: 1
Joined: Tue 14 Dec 2004 09:23

Post by Sotharr » Wed 15 Dec 2004 09:03

Yes, that was the problem. It works now, thank you very much.

regards
Pawel

Post Reply