comp.lang.ada
 help / color / mirror / Atom feed
From: Emmanuel Briot <briot.emmanuel@gmail.com>
Subject: Re: Problem in GNATColl when using prepared queries: GNATCOLL.SQL.POSTGRES.GNADE.POSTGRESQL_ERROR is raised
Date: Mon, 28 Feb 2011 05:49:58 -0800 (PST)
Date: 2011-02-28T05:49:58-08:00	[thread overview]
Message-ID: <53b7f307-edd1-4e81-b50e-e70befc1a075@s18g2000vbe.googlegroups.com> (raw)
In-Reply-To: 4d6a6559$0$23761$14726298@news.sunsite.dk

> I've done some further digging, and it appears that GNATColl thinks the
> result is binary data when the query is prepared. When the same query is
> executed without preparing it, the data is returned just fine as Integer
> and String respectively.

Your analysis is correct.
The fix here is actually trivial.

in gnatcoll-sql-postgres-gnade.adb, replace the code for

 function PQexecPrepared
           (Conn : System.Address;
            Name : String;
            Nparams : Natural := 0;
            Values  : CS.chars_ptr_array;
            Lengths : System.Address := System.Null_Address;
            Formats : System.Address := System.Null_Address;
            Format  : Natural := 0) return System.Address;

so that "Format" defaults to 1 instead of 0.

That forces postgreSQL to return values as text instead of binary. The
latter format is not supported by GNATCOLL (nor was it supported by
GNADE). There is too much machine-dependent handling here.



  parent reply	other threads:[~2011-02-28 13:49 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
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 [this message]
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