[fpc-devel] Bug in TSQLQuery.ApplyRecUpdate
Luiz Américo
pascalive at bol.com.br
Tue May 3 23:17:46 CEST 2005
While trying to use mysql through sqldb i found some problems trying to
apply the updates using TSqlQuery.ApplyUpdates:
Database info:
TableName = mysql_bench
Table structure = CREATE TABLE `mysql_bench` (`AInt` int(11) default
NULL,`AFloat` float(13,5) default NULL,`AStr` varchar(100) default
NULL)TYPE=MyISAM;
1 - FTableName was storing the ; caracter if it's near to the tablename
in sql query. For example Select * from ATable; -> FTablename = 'ATable;'
I fixed it with this
sqldb.pp:699 -> Move(PS^,FTableName[1],(P-PS-1));
but its buggy in the case there's no ; in the end
2- After fixing the table name i got the following:
Sql executed through TSQLQuery.ApplyRecUpdate = insert into mysql_bench
(AInt,AFloat,AStr) values
(0,10,123456789,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaa');
Gives this error (also when used with a mysql management tool)
An unhandled exception occurred at $0040F0DD :
EDatabaseError : : Error executing query: You have an error in your SQL
syntax.
Check the manual that corresponds to your MySQL server version for
the right s
yntax to use near '' at line 1
3- I noticed that could be the Float format so i added the following
line in TSqlConnection.GetAsSQLText
sqldb.pp:299 -> ftFloat : Str(Double(Field.AsFloat),Result);
Now the sql is
insert into mysql_bench (AInt,AFloat,AStr) values
(0,1.012345678900000E+001,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaa');
But still gives the same error. Although the same sql can be executed
with a mysql management tool.
I hope this info can help resolve this bug
Luiz
More information about the fpc-devel
mailing list