[fpc-pascal]FCL-Sample required, please!
Michael Van Canneyt
michael.vancanneyt at wisa.be
Tue Oct 31 09:43:55 CET 2000
On Tue, 31 Oct 2000, Rainer Hantsch wrote:
> Hello, everybody!
>
> Since a lot of time I am trying to write FPC programs which use MySQL in
> the background.
>
> Well, there exists a sample from Michael V.C., which shows a very basic
> way of accessing MySQL. It works, but very complicated.
Complicated ?! The most basic example !?
I've made it even more basic:
------------------------------------------------------------------------
program mtest;
uses db,sysutils,mysqldb;
Var
Data : TMysqldataset;
I,Count : longint;
begin
if paramcount<>4 then
begin
Writeln ('Usage : mtest db user pwd sql');
Halt(1);
end;
Data:=TMysqlDataset.Create(Nil);
With Data do
begin
Database:=Paramstr(1);
User:=Paramstr(2);
PassWord := Paramstr(3);
SQL.text := Paramstr(4);
Open;
While NOT EOF do
begin
With Fields do
For I:=0 to FieldCount-1 do
Writeln(Fields[i].FieldName:20,': ',Fields[i].AsString);
Next;
end;
Free;
end;
end.
-------------------------------------------------------------------------
More simple than this is not possible.
>
> Since a while I hear and read that FCL shall support MySQL. However, I
> have never seen a sample program compareaable to the good old
> "testdb", but written in FCL, nor any documentation on FCL anyway.
Documentation on FCL is being written. It's a lot of work.
Michael.
More information about the fpc-pascal
mailing list