Unable to post when fieldname contains a period.

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
jepdk
Posts: 13
Joined: Mon 23 Oct 2006 13:48
Location: Denmark

Unable to post when fieldname contains a period.

Post by jepdk » Thu 03 Sep 2009 13:26

Using Delphi 2009 and MySql Data Access components v. 5.80.0.48. I am unable to update when tablefieldname contains a period.

To reproduce:
CREATE TABLE `test` (
`ID` int(11) NOT NULL auto_increment,
`Field1` varchar(20) default NULL,
`Field.1` varchar(20) default NULL,
`Field1.` varchar(20) default NULL,
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1

If posting to
1) Table.FieldbyName('Field1').AsString := 'Test'; -- this is ok
2) Table.FieldbyName('Field.1').AsString := 'Test'; -- this fails with error "Unknown column 'Field.1' in 'field list'
3) Table.FieldbyName('Field1.').AsString := 'Test'; -- this fails with error "#42000You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')
VALUES
('Test1')' at line 2.
---------------------------
OK
---------------------------"

Before upgrading to Delphi 2009 I used Delphi 2006, and here all worked ok.

Do you have a solution for this big problem?

jepdk
Posts: 13
Joined: Mon 23 Oct 2006 13:48
Location: Denmark

component error?

Post by jepdk » Thu 03 Sep 2009 19:37

Setting debug on shows this

FIELDNAME = Field.1

UPDATE `test`
SET
`Field`.`1` = ?
WHERE
`ID` = ?


:`Field`.`1`(String[2],IN)='xx'
:`Old_ID`(Integer,IN)=1

I think it should do this:
UPDATE `test`
SET
`Field.1` = ? ------ here changed
WHERE
`ID` = ?


:`Field`.`1`(String[2],IN)='xx'
:`Old_ID`(Integer,IN)=1


where Fieldname = Field1 debug shows

UPDATE `test`
SET
`Field1`. = ?
WHERE
`ID` = ?


:`Field1`.(String[4],IN)='test'
:`Old_ID`(Integer,IN)=1

and this should be
UPDATE `test`
SET
`Field1. = ? ------- here changed
WHERE
`ID` = ?


:`Field1`.(String[4],IN)='test'
:`Old_ID`(Integer,IN)=1

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Fri 04 Sep 2009 08:57

Thank you for information. We have reproduced this problem and fixed it. This fix will be included in the next MyDAC build.

jepdk
Posts: 13
Joined: Mon 23 Oct 2006 13:48
Location: Denmark

Post by jepdk » Fri 04 Sep 2009 09:00

When do you think it is available, I have som urgent updates to do regarding this

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Fri 04 Sep 2009 09:53

Try to set the QuoteNames option to True.

jepdk
Posts: 13
Joined: Mon 23 Oct 2006 13:48
Location: Denmark

Post by jepdk » Fri 04 Sep 2009 10:13

Dosen't fix it, same problem.

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Fri 04 Sep 2009 11:57

Then we will fix this problem in the next MyDAC build.

Post Reply