comp.lang.ada
 help / color / mirror / Atom feed
From: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Subject: Re: Using MySQL from ADA program
Date: 28 Nov 2001 21:58:54 GMT
Date: 2001-11-28T21:58:54+00:00	[thread overview]
Message-ID: <9u3mmu$eus$1@drcomp.erfurt.thur.de> (raw)
In-Reply-To: 5uaN7.896$y65.2890@nntpserver.swip.net

 MITRONIC <mitronic@swipnet.se> wrote:

> Hello, I want to access a MySQL database from my ADA program. What is the
> best way? Anyone who can give me an example?

I can't tell you what to use for MySQL, but for PostgreSQL there are
several possibilities which should be comparable to MySQL.

www.adapower.com surely has at least one thick binding to MySQL.
Usage should be simple, but at the cost of very much overhead.

Second way is to have a look at gnade, the GNU Ada Database Environment,
which might be found at iirc gnade.sourceforge.net

Third way is to find a direct implementation of libmysql written in Ada,
probably using socket() via Pragma-Import from C or something else.

I guess there is no libmysql avaible which is not using some C.

Now following an example for PostgreSQL which won't work for MySQL but
it might give you an overview, how it'd like to be...

        procedure do_work (dbname : in string) is
                package Pg is new Pg2("dbname=" & dbname & " user=adi");
                ergebnis : Pg.Result_Type;
                buffer : UString;
        begin
         loop
                Put_Line("Enter an SQL-Command or <CR> to stop:");
                Get_Line(buffer);
                exit when (buffer = "");
                Pg.Submit(buffer,ergebnis);
                for I in 0 .. ergebnis.Tuples_Qt-1 loop
                        for J in 0 .. ergebnis.Fields_Qt-1 loop
                                Pg.Get(ergebnis,I,J,buffer);
                                Put(buffer & ASCII.HT);
                        end loop;
                New_Line;
                end loop;
                Pg.Forget(ergebnis);
         end loop;
         Put_Line("Finished");
         Pg.Disconnect;
        end do_work;



-- 
mail: adi@thur.de  	http://adi.thur.de	PGP: v2-key via keyserver

Lieber Erstattung als Bestattung



  reply	other threads:[~2001-11-28 21:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-28 19:01 Using MySQL from ADA program  MITRONIC
2001-11-28 21:58 ` Adrian Knoth [this message]
2001-11-28 22:21 ` Preben Randhol
2002-01-02 14:22 ` Michael Erdmann
     [not found] <mailman.1007051645.24907.comp.lang.ada@ada.eu.org>
2001-11-29 17:59 ` Preben Randhol
2001-11-29 19:00   ` M. A. Alves
2001-11-29 20:10     ` Preben Randhol
2001-11-30 16:19       ` M. A. Alves
     [not found] <Pine.LNX.4.33.0111301606360.21868-100000@lagoa.niaad.liacc.up.pt>
2001-11-30 18:44 ` M. A. Alves
2001-11-30 22:39   ` Pascal Obry
2001-12-02  1:09     ` Juergen Pfeifer
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox