Re: [fpc-devel] Bug in TSQLQuery.ApplyRecUpdate

2005-05-04 Thread Joost van der Sluis

On Tue, 2005-05-03 at 18:17 -0300, Luiz Amrico 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,'
 ');
 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.01234567890E+001,'a
 aaa');

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



___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] Bug in TSQLQuery.ApplyRecUpdate

2005-05-03 Thread Luiz Américo
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,'
');

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.01234567890E+001,'a
aaa');

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
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel