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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,fc3719e6afe93cd7 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!a30g2000yqn.googlegroups.com!not-for-mail From: tonyg Newsgroups: comp.lang.ada Subject: Re: mysql , gnade and function hanging Date: Thu, 1 Jul 2010 03:19:58 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <9d22007e-b11c-4527-afb5-ae429aeb3f05@c10g2000yqi.googlegroups.com> <773ca91b-2bcb-4b5e-9943-605a852d4dfd@t10g2000yqg.googlegroups.com> <1be70d43-a5f2-40cc-8859-f4e5d34bcd52@w12g2000yqj.googlegroups.com> <9e8008e5-129f-4b9b-b083-44b386a7ce4b@i28g2000yqa.googlegroups.com> <87bpasiue9.fsf@ludovic-brenta.org> <964f5797-eac0-4a2c-9930-fc6137efc8df@w12g2000yqj.googlegroups.com> NNTP-Posting-Host: 89.240.135.62 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1277979598 12074 127.0.0.1 (1 Jul 2010 10:19:58 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 1 Jul 2010 10:19:58 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: a30g2000yqn.googlegroups.com; posting-host=89.240.135.62; posting-account=28F2IwkAAACL1Z5nRC-dE7zuvWdbWC7P User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-GB; rv:1.9.2.3) Gecko/20100423 Ubuntu/10.04 (lucid) Firefox/3.6.3,gzip(gfe) Xref: g2news2.google.com comp.lang.ada:13049 Date: 2010-07-01T03:19:58-07:00 List-Id: On Jul 1, 10:44=A0am, Ludovic Brenta wrote: > tonyg wrote on comp.lang.ada: > > > > > I've sanistised this source of the password and ip address > > > with GNU.DB.MySQL; > > with GNU.DB; > > use GNU.DB.MySQL; > > use GNU.DB; > > with Ada.Text_Io; use Ada.Text_Io; > > with Ada.Strings.Unbounded; > > use Ada.Strings.Unbounded; > > > procedure trymysql is > > > TheDatabase : MySQL.Object; > > TheQuery =A0 =A0: MySQL.Query_Id; > > TheField =A0 =A0 =A0 =A0: MYSQL.Field_Number; > > begin > > Initialize(TheDatabase); > > User (TheDatabase, "heating"); > > Password (TheDatabase,""); > > Connect (TheDatabase,""); > > Select_DB (TheDatabase, "heating"); > > > =A0 =A0TheQuery :=3D Query (TheDatabase, "select * from userid "); > > =A0 =A0TheField :=3D Get_Field_Number (TheDatabase, TheQuery, "email"); > > > =A0 =A0put_line ("Number of Rows :" & > > Integer'Image(Nbr_of_Rows(TheDatabase,TheQuery))); > > > =A0 =A0 =A0 =A0 put_line (" Field Number of Email field : " & > > Integer'Image(TheField)); > > > =A0 =A0 Put_Line(Natural'image (Get_Field_Length(TheDatabase,TheQuery, > > 1))); > > =A0 =A0 Put_Line(Field_Type'image(Get_Field_Type(TheDatabase,TheQuery, > > 1))); > > > =A0 =A0 Put_Line(To_String(String_Field (TheDatabase, TheQuery, > > "email"))); > > end trymysql; > > > Out put is > > > tony@tony-laptop:~/snugbug/main/adastuff/heating/src$ ./trymysql > > Number of Rows : 4 > > =A0Field Number of Email field : =A01 > > =A014 > > > raised CONSTRAINT_ERROR : gnu-db-mysql.adb:883 invalid data > > tony@tony-laptop:~/snugbug/main/adastuff/heating/src$ > > > Other information is that the email field in the database table is a > > VARCHAR(80) and a primary key > > It seems the exception is not raised in the String_Field line as you > initially said, but in the previous line that calls Get_Field_Type > directly (String_Field also calls Get_Field_Type). The exception > message "invalid data" indicates an uninitialized variable. At first I > thought this would be the TheQuery (of type Query_ID) but now I'm not > so sure anymore. I suggest you run this small program in a debugger > and inspect all the parameters passed to Get_Field_Type. > > I do not use gnade myself, or MySQL. I no longer maintain gnade in > Debian; Stephe Leake took over and dropped support fro MySQL because > it was out of sync with recent versions of MySQL. So that, in fact, > might be the cause of your problems. > > What platform do you use? > What version of gnade? > What version of MySQL? > > Maybe you should use the ODBC interface instead; it is more stable > than the MySQL-specific API. > > -- > Ludovic Brenta. Thanks for your help Ludovic, I'll try the odbc or another binding.