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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no 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!news2.google.com!goblin2!goblin.stu.neva.ru!news.karotte.org!uucp.gnuu.de!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Problem in GNATColl when using prepared queries: GNATCOLL.SQL.POSTGRES.GNADE.POSTGRESQL_ERROR is raised Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH 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> <4d682437$0$23760$14726298@news.sunsite.dk> Date: Sat, 26 Feb 2011 20:33:41 +0100 Message-ID: <1v42jcu30zmag$.1xz86498g3zsm.dlg@40tude.net> NNTP-Posting-Date: 26 Feb 2011 20:33:40 CET NNTP-Posting-Host: b80ba690.newsspool2.arcor-online.net X-Trace: DXC=h;kki9MPbP5QbA1[CgMQ00A9EHlD;3Yc24Fo<]lROoR18kF[ On Fri, 25 Feb 2011 22:50:47 +0100, Thomas L�cke wrote: > On 2011-02-25 21:08, Dmitry A. Kazakov wrote: >>> 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? Does execution of the statement pre-fetches the first row? Traditionally the semantics of such stuff rather refers to the following row, like when file reading: while not EOF (File) loop -- No line read yet, EOF refers to the next one Read_Line (File, ...); end loop; I.e. is Has_Row "there is another row to fetch", or "the row is already fetched and column values are cached." >> 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. Possible reasons: 1. Value conversion failed 1.1. type is wrong 1.2. address is broken 1.3. alignment is illegal 1.4. no value 1.5. constraint error 2. The requested column number is wrong 3. The cursor is wrong You should get the extended error code to determine the problem. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de