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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c9d5fc258548b22a X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news2.google.com!news.glorb.com!news-xxxfer.readnews.com!news-out.readnews.com!postnews3.readnews.com!postbox2.readnews.com!not-for-mail Date: Thu, 03 Mar 2011 03:50:17 -0500 From: Hyman Rosen User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.14) Gecko/20110221 Thunderbird/3.1.8 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: How do I write directly to a memory address? References: <67063a5b-f588-45ea-bf22-ca4ba0196ee6@l11g2000yqb.googlegroups.com> <31c357bd-c8dc-4583-a454-86d9c579e5f4@m13g2000yqb.googlegroups.com> <05a3673e-fb97-449c-94ed-1139eb085c32@x1g2000yqb.googlegroups.com> <4d4c232a$0$28967$882e7ee2@usenet-news.net> <4D4D6506.50909@obry.net> <4d50095f$0$22393$882e7ee2@usenet-news.net> <4d6d56c4$0$11509$882e7ee2@usenet-news.net> <16u9ka51wbukr$.1fj2sb73j9rv6.dlg@40tude.net> <4d6d627b$0$11509$882e7ee2@usenet-news.net> <29c4lixc0ght$.14kkfz1kij135.dlg@40tude.net> <4d6d6afb$0$11509$882e7ee2@usenet-news.net> <1gz9984wwizn5.r619fw4z9o56.dlg@40tude.net> <4d6e5614$0$21954$882e7ee2@usenet-news.net> <4d6e64f5$0$21954$882e7ee2@usenet-news.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <4d6f564f$0$17959$a8266bb1@postbox2.readnews.com> NNTP-Posting-Host: 198.186.190.52 X-Trace: 1299142223 postbox2.readnews.com 17959 198.186.190.52:60094 Xref: g2news1.google.com comp.lang.ada:17765 Date: 2011-03-03T03:50:17-05:00 List-Id: On 3/3/2011 3:04 AM, Simon Wright wrote: > Actually, Dmitry, - as reported by Thomas - the value returned by > PostgreSQL was the required string, but because the result had been > mistakenly requested in binary format, when the string was returned in > the PQresult it was annotated (I expect via PQformat) as binary, so the > quotes got added (by the Ada) on the way out. Thomas found two different bugs. The one I'm talking about is this: > 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. No return values, no binary data, just a plain old logic error.