X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5B43CDA80F for ; Thu, 20 Oct 2005 04:15:22 -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 26238-04 for ; Thu, 20 Oct 2005 07:15:18 +0000 (GMT) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.188]) by svr1.postgresql.org (Postfix) with ESMTP id C2FC0DA82B for ; Thu, 20 Oct 2005 04:15:17 -0300 (ADT) Received: from p508E5E86.dip.t-dialin.net [80.142.94.134] (helo=swtexchange2.technology.de) by mrelayeu.kundenserver.de with ESMTP (Nemesis), id 0ML21M-1ESUdy0Ezn-0002S3; Thu, 20 Oct 2005 09:15:18 +0200 content-class: urn:content-classes:message Subject: Re: Inefficient escape codes. MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Date: Thu, 20 Oct 2005 09:15:17 +0200 X-MimeOLE: Produced By Microsoft Exchange V6.0.6556.0 Message-ID: <16F953410A0F1346848DCB476A989CFE01D557@swtexchange2.technology.de> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Inefficient escape codes. Thread-Index: AcXUYc4J45L1KvnPROegqnDqsT3t0AA48ZRA From: =?iso-8859-1?Q?N=F6rder-Tuitje=2C_Marcus?= To: X-Provags-ID: kundenserver.de abuse@kundenserver.de login:24478085a861b01e05bdc3b8f80dc176 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.131 required=5 tests=[AWL=0.081, FORGED_RCVD_HELO=0.05] X-Spam-Level: X-Archive-Number: 200510/274 X-Sequence-Number: 15042 I guess, You should check, if a blob field and large object access is = suitable for you - no escaping etc, just raw binary large objects. AFAIK, PQExecParams is not the right solution for You. Refer the "Large = object" section: "28.3.5. Writing Data to a Large Object The function int lo_write(PGconn *conn, int fd, const char *buf, size_t len);writes = len bytes from buf to large object descriptor fd. The fd argument must = have been returned by a previous lo_open. The number of bytes actually = written is returned. In the event of an error, the return value is = negative." regards, Narcus -----Urspr=FCngliche Nachricht----- Von: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org]Im Auftrag von Michael Fuhr Gesendet: Dienstag, 18. Oktober 2005 22:47 An: Rodrigo Madera Cc: pgsql-performance@postgresql.org Betreff: Re: [PERFORM] Inefficient escape codes. [Please copy the mailing list on replies so others can participate in and learn from the discussion.] On Tue, Oct 18, 2005 at 07:09:08PM +0000, Rodrigo Madera wrote: > > What language and API are you using? >=20 > I'm using libpqxx. A nice STL-style library for C++ (I am 101% C++). I've only dabbled with libpqxx; I don't know if or how you can make it send data in binary instead of text. See the documentation or ask in a mailing list like libpqxx-general or pgsql-interfaces. > > Binary transfer sends data in binary, not by automatically = converting > > to and from text. >=20 > Uh, I'm sorry I didn't get that... If I send: insert into foo > values('\\001\\002') will libpq send 0x01, 0x02 or "\\\\001\\\\002"?? If you do it that way libpq will send the string as text with escape sequences; you can use a sniffer like tcpdump or ethereal to see this for yourself. To send the data in binary you'd call PQexecParams() with a query like "INSERT INTO foo VALUES ($1)". The $1 is a placeholder; the other arguments to PQexecParams() provide the data itself, the data type and length, and specify whether the data is in text format or binary. See the libpq documentation for details. --=20 Michael Fuhr ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org