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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,65f26d981c0edb76,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news1.google.com!news.glorb.com!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail Date: Wed, 23 Feb 2011 12:58:11 +0100 From: =?ISO-8859-1?Q?Thomas_L=F8cke?= User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101210 Thunderbird/3.1.7 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: GNATcoll and parameterized queries have me confused Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Message-ID: <4d64f653$0$23761$14726298@news.sunsite.dk> Organization: SunSITE.dk - Supporting Open source NNTP-Posting-Host: 83.91.213.86 X-Trace: news.sunsite.dk DXC=c6?LMGPE@Il^Yj[LZVmDVlYSB=nbEKnkk[R[7PZBi8on1GQX8;5?CngRED9SjB8:6iQo^8G8>Andmao[CF[a04Kad< Hey all, When I insert data into a PostgreSQL database using parameterized queries, I end up with more characters than I've bargained for. If I do this: Conn.Execute ("INSERT INTO tbl (name) VALUES ('Peter')"); I end up with Peter in the database. Plain Peter. 5 characters. If I instead do this: N : aliased constant String := "Peter"; P : constant Prepared_Statement := Prepare ("INSERT INTO tbl (name) VALUES ($1)"); Conn.Execute (Stmt => P, Params => (1 => +N'Access)); I end up with 'Peter' in the database. 7 characters. Two single quotes added by GNATcoll. I've tried doing a manual parameterized insert using psql: PREPARE foo (text) AS INSERT INTO tbl VALUES($1); EXECUTE foo ('Peter'); I've also fired up the phpPgAdmin web-tool and tried using that. And the result is, for both, as expected; plain old 5 character Peter. So PostgreSQL is apparently not at fault here. Am I doing something wrong with GNATcoll? I'd rather not have those extra single quotes added to all my string data. :o) -- Thomas L�cke Email: tl at ada-dk.org Web: http//:ada-dk.org http://identi.ca/thomaslocke