X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 10DF35286A for ; Fri, 3 Jun 2005 15:04:14 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 36659-09 for ; Fri, 3 Jun 2005 18:04:11 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.201]) by svr1.postgresql.org (Postfix) with ESMTP id 07A5D52802 for ; Fri, 3 Jun 2005 15:04:10 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id 68so930056wra for ; Fri, 03 Jun 2005 11:04:11 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=INzKXsrdjpYZKRpehSQP3vjjrLJL98FXspItCN1J6rgh/zjKPKZOQrb0BNNoPN4f+SEj22tnE1Tmjqx0/lO4xu2cHgidqVLi0ASxR8MTFmryB1e/NAORuXeDbffhg+OIPyh9L7shDZnG7qCUlw9eGzNr3xyRgjedeBkMVxzHQdY= Received: by 10.54.54.44 with SMTP id c44mr1359646wra; Fri, 03 Jun 2005 11:04:11 -0700 (PDT) Received: by 10.54.53.40 with HTTP; Fri, 3 Jun 2005 11:04:11 -0700 (PDT) Message-ID: Date: Fri, 3 Jun 2005 13:04:11 -0500 From: David Hinkle Reply-To: David Hinkle To: pgsql-interfaces@postgresql.org Subject: Re: libpq, PQExecParams and the inserting of binary data In-Reply-To: <6424.1117820918@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <6424.1117820918@sss.pgh.pa.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.024 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/11 X-Sequence-Number: 5579 I read all the examples and documentation thouroughly. I would not bother you guys otherwise. That example doesn't show you how to use any binary parameters... All the parameters are text, it only shows you how get binary results. I think it's a huge oversight myself. I could probably figure out how to use the parameters as binary, but I have no idea what to do with the OID field. David On 6/3/05, Tom Lane wrote: > David Hinkle writes: > > As you can see, I assumed I could use PQexapeBytea to escape the > > binary data and then just use the returned value as a text parameter. >=20 > No, because PQescapeBytea is designed to do the escaping that would be > needed to put the bytea value into a string literal in a SQL command. > There's an extra level of backslashing involved to do that (because > backslashes are special to both the string-literal syntax and the > text input syntax for bytea). >=20 > But this is really the hard way to do it considering that you are using > PQexecParams. Just tell PQexecParams that you want this parameter to be > binary format, and pass the *raw* binary string as the parameter. >=20 > > I couldn't find any documentation on using PQExecParams > > with binary parameters, >=20 > src/test/examples/testlibpq3.c ... that example is reproduced in > the libpq manual, as well. >=20 > regards, tom lane >