[fpc-pascal]FCL bug? [ was: fpc and MySQL]

Fernando Lozano fsl at centroin.com.br
Wed Aug 7 22:23:06 CEST 2002


Hi Michael,

> > > > > Maybe zlib is missing, some distro's have zlib in libc, some not.
> > > >
> > > > But adding -lz to the command line don't solve the problem. :-(
> > >
> > > Adding -lz to the compiler command-line is useless. This will only
> > > display the logo of the compiler.
> >
> > So there's no to add a library to the linking phase on the command line? I must use compiler directives?

Thanks a lot. Now it works.

But the same program using the MySQL FCL unit presents on Linux the same bug as on Windows: When I get a field value using method "AsString", the value is mixed with previous values.

The program using the mysql unit:

bash$./testemysql
codigo: INFO, nome: Informatica
codigo: MARK, nome: Marketing
bash$

The program using the FCL:

bash$ ./testedbmysql
codigo: INFO, nome: Informatica
codigo: MARKrmatica, nome: Marketing
bash$

It may be my mistake? Here's the program:

program testedbmysql;

uses db, mysqldb;

const
    host = 'localhost';
    banco = 'banco';
    login = 'teste';
    senha = 'senha';
    
var
    bd : TMysqlDataset;

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.


The program works the same way on Linux and on Windows (and shows the same bug).


[]s, Fernando Lozano




More information about the fpc-pascal mailing list