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!news4.google.com!feeder.news-service.com!2a02:590:1:1::196.MISMATCH!news.teledata-fn.de!noris.net!newsfeed.arcor.de!newsspool1.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> Date: Fri, 25 Feb 2011 21:08:25 +0100 Message-ID: <1dbprbhut7js1.jeytwwyjsya4$.dlg@40tude.net> NNTP-Posting-Date: 25 Feb 2011 21:08:25 CET NNTP-Posting-Host: bde31bbf.newsspool1.arcor-online.net X-Trace: DXC=35\Q0Yk<5cG2:OR3:3gaE@ic==]BZ:afN4Fo<]lROoRA<`=YMgDjhgBd2OU1aaAFVD[6LHn;2LCVN[ On Fri, 25 Feb 2011 19:24:27 +0100, Thomas L�cke wrote: > On 2011-02-25 17:05, Dmitry A. Kazakov wrote: >> I don't understand your code, in particular where the statement prepared is >> actually executed? > > 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. >> Where the cursor gets closed? DBMS does not appreciate >> cursors left unclosed. Does GNATColl maintain cursor states internally? > > Yes. 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. > > Why > > fetch is not called within a loop? > > 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 can only stress that you will >> never get it working with literal values. I've been there. It isn't worth >> to try. > > I don't want it to work with literal values. I want it to work with > prepared and parameterized queries. I simple show an example with > literal values because that actually works. :o) > > The problem is that GNATColl dumps an exception when I try to use > prepared and parameterized queries. That means that you are doing something wrong. Bound values must work. > I like GNATColl's interface. OK >> [ At least ODBC has tracing mode, which sometimes with some drivers indeed >> traces. So that you could see the actual statement. ] > > GNATColl has that too. There's nothing wrong with the actual statement. > The problem occurs when I try to extract the data in the loop using > these two calls: > > Cur.Integer_Value (0) > Cur.Value (1) Tracing usually tells if the result does not contain requested columns, the values cannot be converted, the cursor is wrong etc. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de