comp.lang.ada
 help / color / mirror / Atom feed
From: "Thomas Løcke" <tl@ada-dk.org>
Subject: Re: Problem in GNATColl when using prepared queries: GNATCOLL.SQL.POSTGRES.GNADE.POSTGRESQL_ERROR is raised
Date: Fri, 25 Feb 2011 22:50:47 +0100
Date: 2011-02-25T22:50:47+01:00	[thread overview]
Message-ID: <4d682437$0$23760$14726298@news.sunsite.dk> (raw)
In-Reply-To: <1dbprbhut7js1.jeytwwyjsya4$.dlg@40tude.net>

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



  reply	other threads:[~2011-02-25 21:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-25 15:45 Problem in GNATColl when using prepared queries: GNATCOLL.SQL.POSTGRES.GNADE.POSTGRESQL_ERROR is raised Thomas Løcke
2011-02-25 16:05 ` Dmitry A. Kazakov
2011-02-25 18:24   ` Thomas Løcke
2011-02-25 20:08     ` Dmitry A. Kazakov
2011-02-25 21:50       ` Thomas Løcke [this message]
2011-02-26 19:33         ` Dmitry A. Kazakov
2011-02-27 14:53           ` Thomas Løcke
2011-02-27 15:36             ` Dmitry A. Kazakov
2011-02-27 15:49               ` Thomas Løcke
2011-02-27 20:15                 ` Dmitry A. Kazakov
2011-02-27 21:53                   ` Thomas Løcke
2011-02-28 13:49             ` Emmanuel Briot
2011-03-01  8:34               ` Thomas Løcke
2011-03-01 10:28                 ` Emmanuel Briot
2011-03-01 20:33                   ` Thomas Løcke
2011-03-01 20:54                     ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox