Sign in Join

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

Mailing lists / fpc-pascal / 2000-10

FCL-Sample required, please!

6 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

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

Rainer Hantsch

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.

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.

Could somebody -- please -- leave me a ready-to-compile source for a FCL version of testdb to let me understand the differences?

Thanks in advance,

Ing. Rainer Hantsch

\\|// Ing. Rainer HANTSCH - Hardware + Software (o o) Your Partner - Your Supplier - Your Friend! --oOOo-(_)-oOOo-------------------------------------------------- Ing. Rainer HANTSCH | e-Mail:
Khunngasse 21/20 | www : http://www.hantsch.co.at A-1030 Vienna | Tel. : ++43 - 1 - 7988538 0 ---------------------| Fax : ++43 - 1 - 7988538 18 ** AUSTRIA ** | Mobile: ++43 - 663 - 9194382 -----------------------------------------------------------------

Michael Van Canneyt
to Rainer Hantsch
Rainer Hantsch wrote 7 lines
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 paramcount4 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.
Show quoted text 5 lines
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.

Rainer Hantsch
to Michael Van Canneyt

Thanks a lot!

This IS, what I was searching for since months. A SAMPLE. ;-)

Ing. Rainer Hantsch

\\|// Ing. Rainer HANTSCH - Hardware + Software (o o) Your Partner - Your Supplier - Your Friend! --oOOo-(_)-oOOo-------------------------------------------------- Ing. Rainer HANTSCH | e-Mail:
Khunngasse 21/20 | www : http://www.hantsch.co.at A-1030 Vienna | Tel. : ++43 - 1 - 7988538 0 ---------------------| Fax : ++43 - 1 - 7988538 18 ** AUSTRIA ** | Mobile: ++43 - 663 - 9194382 -----------------------------------------------------------------

On Tue, 31 Oct 2000, Michael Van Canneyt wrote:
: 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 !?
You mis-understood. this sample is not _complicated_, there is only relatively much programming required to access the data. The below sample appears much simpler.

: I've made it even more basic:
: ------------------------------------------------------------------------
: program mtest;
:
: uses db,sysutils,mysqldb;
:
: Var
:   Data : TMysqldataset;
:   I,Count : longint;
:
:
: begin
:   if paramcount4 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.

I also think so. It is a huge library!

Keve Gábor
to Rainer Hantsch

Hello All!

Tomorrow i was install the interbase 6.0 server to our linux server. When i try to compile the fpc interbase sample file (testib.pp) i got this error:

Free Pascal Compiler version 0.99.14 [2000/01/26] for i386 Copyright (c) 1993-2000 by Florian Klaempfl
Target OS: Linux for i386
Compiling testib.pp
testib.pp(19,7) Hint: Local typed const DBINFO is not used Assembling testib
Linking testib
/usr/lib/libgds.so: undefined reference to `dlclose' /usr/lib/libgds.so: undefined reference to `dlopen' /usr/lib/libgds.so: undefined reference to `crypt' /usr/lib/libgds.so: undefined reference to `dlsym' Warning: Error while linking
Closing script ppas.sh
146 Lines compiled, 0.0 sec
www:/usr/local/src/fpc-0.99.14/packages/ibase #

please help me, what's the problem?

best regards,
Gabor Keve

p.s.:sorry for my terrible english!

Michael Van Canneyt
to Keve Gábor
Show quoted text 23 lines
Hello All! Tomorrow i was install the interbase 6.0 server to our linux server. When i try to compile the fpc interbase sample file (testib.pp) i got this error: Free Pascal Compiler version 0.99.14 [2000/01/26] for i386 Copyright (c) 1993-2000 by Florian Klaempfl Target OS: Linux for i386 Compiling testib.pp testib.pp(19,7) Hint: Local typed const DBINFO is not used Assembling testib Linking testib /usr/lib/libgds.so: undefined reference to `dlclose' /usr/lib/libgds.so: undefined reference to `dlopen' /usr/lib/libgds.so: undefined reference to `crypt' /usr/lib/libgds.so: undefined reference to `dlsym' Warning: Error while linking Closing script ppas.sh 146 Lines compiled, 0.0 sec www:/usr/local/src/fpc-0.99.14/packages/ibase # please help me, what's the problem?

Try adding

{$linklib dl}
{$linklib crypt}

to the test program.
What version of Interbase is this, and on what system ?

Michael.

Keve Gábor
to Michael Van Canneyt

Hello Michael!

Thanks, now work with "$linklib dl, $linklib crypt" directive!

System:
SuSE Linux 6.2 with several patch,
Interbase for Linux 6.0

best regards,
Gabor Keve

Feladó: "Michael Van Canneyt" Címzett: Elküldve: 2000. október 31. 13:33 Tárgy: Re: [fpc-pascal]interbase
Show quoted text 9 lines
Try adding {$linklib dl} {$linklib crypt} to the test program. What version of Interbase is this, and on what system ? Michael.