[fpc-devel] Bug in TSQLQuery.ApplyRecUpdate

Joost van der Sluis joost at cnoc.nl
Wed May 4 14:19:55 CEST 2005


On Tue, 2005-05-03 at 18:17 -0300, Luiz Américo wrote:
> 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));

I'm rewriting this whole parser. It was more a proof-of-concept. It'll
get soon better.

> 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');

I've never tested it with float's. And i'm pretty sure they won't work.
I'll have a look at it.

-- 
Met vriendelijke groeten,

  Joost van der Sluis
  CNOC Informatiesystemen en Netwerken
  http://www.cnoc.nl






More information about the fpc-devel mailing list