From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b4dc68be41aaee61 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-11-28 23:34:02 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!newsfeed00.sul.t-online.de!t-online.de!blackbush.xlink.net!blackbush.de.kpnqwest.net!news.erfurt.thur.de!eastside.erfurt.thur.de!drcomp.erfurt.thur.de!not-for-mail From: Adrian Knoth Newsgroups: comp.lang.ada Subject: Re: Using MySQL from ADA program Date: 28 Nov 2001 21:58:54 GMT Organization: Modern Electronics Message-ID: <9u3mmu$eus$1@drcomp.erfurt.thur.de> References: <5uaN7.896$y65.2890@nntpserver.swip.net> NNTP-Posting-Host: drcomp.erfurt.thur.de X-Server-Date: 28 Nov 2001 21:58:54 GMT User-Agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (Linux/2.4.16 (i586)) Xref: archiver1.google.com comp.lang.ada:17152 Date: 2001-11-28T21:58:54+00:00 List-Id: MITRONIC 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 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