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-Thread: 103376,89e2ed92b27de792 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!news4.google.com!feeder2.cambriumusenet.nl!feed.tweaknews.nl!195.96.0.7.MISMATCH!newsfeed.utanet.at!weretis.net!feeder4.news.weretis.net!nuzba.szn.dk!news.szn.dk!pnx.dk!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail Date: Fri, 25 Feb 2011 22:50:47 +0100 From: =?ISO-8859-1?Q?Thomas_L=F8cke?= User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101210 Thunderbird/3.1.7 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Problem in GNATColl when using prepared queries: GNATCOLL.SQL.POSTGRES.GNADE.POSTGRESQL_ERROR is raised References: <4d67ce9c$0$23765$14726298@news.sunsite.dk> <1on2yzc25jxpr.1offs3nb41fqk$.dlg@40tude.net> <4d67f3db$0$23762$14726298@news.sunsite.dk> <1dbprbhut7js1.jeytwwyjsya4$.dlg@40tude.net> In-Reply-To: <1dbprbhut7js1.jeytwwyjsya4$.dlg@40tude.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Message-ID: <4d682437$0$23760$14726298@news.sunsite.dk> Organization: SunSITE.dk - Supporting Open source NNTP-Posting-Host: 83.91.213.86 X-Trace: news.sunsite.dk DXC=d]Ad3EgVAnd=]eASFMgYEi8T1MLbPdK;C4 X-Complaints-To: staff@sunsite.dk Xref: g2news2.google.com comp.lang.ada:18575 Date: 2011-02-25T22:50:47+01:00 List-Id: On 2011-02-25 21:08, Dmitry A. Kazakov wrote: >> Cur.Fetch (Connection => Connection, >> Stmt => P, >> Params => (1 => +Some_Name'Access)); >> > > That does not look like an execution of the statement P. I would expect > fetch rather walking through the result set than executing anything. But I > don't know GNATColl. The comment for the Fetch procedure reads: -- Execute a prepared statement on the connection. > Does it that right? I am asking this, because it is an issue in ODBC, where > the cursor state depends on many factors and that the same sequence of > calls may either close the cursor or not depending on the operation > outcome. I've not experienced any problems with GNATColl and cursors. It just works. Except of course in this specific case, where I can't make it work. hehe >> while Cur.Has_Row loop >> Put_Line ("id="& Cur.Integer_Value (0)'Img); >> Put_Line ("name="& Cur.Value (1)); >> Cur.Next; >> end loop; > > What is the semantics of Has_Row does it refer the current row or that Next > would not fail when called? I'm not quite sure I understand what you mean Dmitry. Could you elaborate? > That means that you are doing something wrong. Bound values must work. Exactly. And that part does work. I can see in the trace that the query is correct, and I can see it executed perfectly in the PostgreSQL log. The problem occurs _after_ the query has been executed. Things go bad when I try to extract the data, and it only fails when I'm using a prepared and parameterized query, re. my original post: If I get rid of the Cur.Integer_Value (0) and Cur.Value (1) calls in the while loop from the prepared example, then I also get rid of the exception, so it appears to be some sort of issue with the *Value functions and prepared queries. I'm pretty sure this is a bug somewhere in GNATColl. -- Thomas L�cke Email: tl at ada-dk.org Web: http//:ada-dk.org http://identi.ca/thomaslocke