[fpc-pascal]Bug on the FCL?
Fernando Lozano
fsl at centroin.com.br
Thu Jul 25 17:23:25 CEST 2002
Hi there,
After I got a compatible libmysql.dll my test program for the FCL database classes shows a strange result:
C:\usuarios\lozano\fpc>testedbmysql
codigo: INFO, nome: Informatica
codigo: MARKrmat, nome: Marketing
Please note how the strings 'Informatica' and 'MARK' got intermixed. It looks like the fileds variables are not being empitied between rows. Please see the program code and tell me if I made a mistake or if this is a real bug (and if you can imagien a workaround).
program testedbmysql;
uses db, mysqldb;
const
host = 'linuxfs';
banco = 'banco';
login = 'teste';
senha = 'senha';
var
bd : TMysqlDataset;
procedure erro (bd : TMysqlDataset; msg : string);
begin
writeln (stderr, msg);
//writeln (stderr, mysql_error(bd));
readln;
halt(1);
end;
begin
bd := TMysqlDataset.Create (nil);
bd.Host := host;
bd.Database := banco;
bd.User := login;
bd.Password := senha;
bd.SQL.text := 'SELECT codigo, nome FROM departamento';
bd.Open;
while not bd.EOF do begin
write ('codigo: ', bd.Fields[0].AsString, ', ');
write ('nome: ', bd.Fields[1].AsString);
writeln;
bd.Next;
end;
bd.Close;
bd.Free;
readln;
end.
[]s, Fernando Lozano
More information about the fpc-pascal
mailing list