Page 1 of 1

Unable to post when fieldname contains a period.

Posted: Thu 03 Sep 2009 13:26
by jepdk
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?

component error?

Posted: Thu 03 Sep 2009 19:37
by jepdk
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

Posted: Fri 04 Sep 2009 08:57
by Dimon
Thank you for information. We have reproduced this problem and fixed it. This fix will be included in the next MyDAC build.

Posted: Fri 04 Sep 2009 09:00
by jepdk
When do you think it is available, I have som urgent updates to do regarding this

Posted: Fri 04 Sep 2009 09:53
by Dimon
Try to set the QuoteNames option to True.

Posted: Fri 04 Sep 2009 10:13
by jepdk
Dosen't fix it, same problem.

Posted: Fri 04 Sep 2009 11:57
by Dimon
Then we will fix this problem in the next MyDAC build.