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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM 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-7-bit Path: g2news2.google.com!postnews.google.com!s18g2000vbe.googlegroups.com!not-for-mail From: Emmanuel Briot Newsgroups: comp.lang.ada 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) Organization: http://groups.google.com Message-ID: <53b7f307-edd1-4e81-b50e-e70befc1a075@s18g2000vbe.googlegroups.com> 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> <1v42jcu30zmag$.1xz86498g3zsm.dlg@40tude.net> <4d6a6559$0$23761$14726298@news.sunsite.dk> NNTP-Posting-Host: 194.98.77.125 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1298900998 27622 127.0.0.1 (28 Feb 2011 13:49:58 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 28 Feb 2011 13:49:58 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: s18g2000vbe.googlegroups.com; posting-host=194.98.77.125; posting-account=6yLzewoAAABoisbSsCJH1SPMc9UrfXBH User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.237 Safari/534.10,gzip(gfe) Xref: g2news2.google.com comp.lang.ada:18610 Date: 2011-02-28T05:49:58-08:00 List-Id: > 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.