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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,58ca990a20ca948e X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!w34g2000yqm.googlegroups.com!not-for-mail From: Vadim Godunko Newsgroups: comp.lang.ada Subject: Re: QtSql problem Date: Mon, 9 Feb 2009 06:04:42 -0800 (PST) Organization: http://groups.google.com Message-ID: <2b2819b4-46bc-41e7-9c79-6437843586f8@w34g2000yqm.googlegroups.com> References: <498bf574_4@news.bluewin.ch> NNTP-Posting-Host: 83.221.214.192 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1234188283 1593 127.0.0.1 (9 Feb 2009 14:04:43 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 9 Feb 2009 14:04:43 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: w34g2000yqm.googlegroups.com; posting-host=83.221.214.192; posting-account=niG3UgoAAAD7iQ3takWjEn_gw6D9X3ww User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.5) Gecko/2008121300 SUSE/3.0.5-1.1 Firefox/3.0.5,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:4562 Date: 2009-02-09T06:04:42-08:00 List-Id: On Feb 8, 3:09=A0am, tworos...@gmail.com wrote: > > Execution terminated by unhandled exception > Exception name: PROGRAM_ERROR > Message: EXCEPTION_ACCESS_VIOLATION > Call stack traceback locations: > 0x2901dc5 0x77cc3097 0x77cc3069 0x77cc2efd 0x61f0129e > [2009-02-08 10:46:11] process exited with status1 (elapsed time: > 00.40s) I reproduced the behavior, here is two problems: first in your code - Program_Error raised because error occurred until Query.Exec execution; and second - even if statement executed successfully QtAda has bug in Query.Value subprogram. I recommend you download and use new QtAda snapshot, see http://www.qtada.com/en/download.html PS. Here is my test program, it also explains some changes in the QtSql API: with Qt4.Sql_Databases; with Qt4.Sql_Errors; with Qt4.Sql_Queries; with Qt4.Strings; procedure Test_296 is use type Qt4.Strings.Q_String; DB : aliased Qt4.Sql_Databases.Q_Sql_Database :=3D Qt4.Sql_Databases.Add_Database (Qt4.Strings.From_Utf_16 ("QSQLITE")); begin DB.Set_Database_Name (Qt4.Strings.From_Utf_16 (":memory:")); if not DB.Open then raise Program_Error with "Unable to open database"; end if; declare Query : aliased Qt4.Sql_Queries.Q_Sql_Query :=3D Qt4.Sql_Queries.Create (DB); begin if not Query.Exec (Qt4.Strings.From_Utf_16 ("CREATE TABLE images" & " (id INTEGER PRIMARY KEY," & " filename CHARACTER VARYING (20))")) then raise Program_Error with "Unable to create table"; end if; if not Query.Exec (Qt4.Strings.From_Utf_16 ("INSERT INTO images VALUES (1, 'hello.jpg')")) then raise Program_Error with "Unable to insert data"; end if; if not Query.Exec (Qt4.Strings.From_Utf_16 ("SELECT id, filename FROM images")) then raise Program_Error with "Unable to select data"; end if; while Query.Next loop if Query.Value (0).To_String /=3D Qt4.Strings.From_Utf_16 ("1") then raise Program_Error with "Invalid value for field #0"; end if; if Query.Value (1).To_String /=3D Qt4.Strings.From_Utf_16 ("hello.jpg") then raise Program_Error with "Invalid value for field #1"; end if; end loop; if not Query.Exec (Qt4.Strings.From_Utf_16 ("SELECT idx FROM images")) then declare Error : Qt4.Sql_Errors.Q_Sql_Error :=3D Query.Last_Error; begin if Error.Text /=3D Qt4.Strings.From_Utf_16 ("no such column: idx Unable to execute statement") then raise Program_Error with "Unexpected error"; end if; end; else raise Program_Error with "Invalid result of the query"; end if; end; end Test_296;