Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2002-07

Bug on the FCL?

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Fernando Lozano

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