X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 5B50CD1D163 for ; Wed, 14 Apr 2004 10:42:52 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 26325-06 for ; Wed, 14 Apr 2004 10:42:54 -0300 (ADT) Received: from fzkmail2.fzk.de (fzkmail2.fzk.de [141.52.27.52]) by svr1.postgresql.org (Postfix) with SMTP id EEFBED1D174 for ; Wed, 14 Apr 2004 10:42:48 -0300 (ADT) Received: FROM resy5.fzk.de BY fzkmail2.fzk.de ; Wed Apr 14 15:42:41 2004 +0200 Received: œby rodos.fzk.de with ESMTP (8.8.6 (PHNE_17135)/8.7.1) id PAA15726; Wed, 14 Apr 2004 15:42:40 +0200 (METDST) From: Christoph Haller Message-Id: <200404141342.PAA21729@rodos> Subject: Re: Help with COPY command To: reina_ga@hotmail.com (Tony Reina) Date: Wed, 14 Apr 2004 15:42:39 METDST Cc: pgsql-sql@postgresql.org In-Reply-To: <272e4be7.0404071132.4ed06afc@posting.google.com>; from "Tony Reina" at Apr 10, 104 3:04 am X-Mailer: Elm [revision: 212.4] X-Virus-Scanned: by amavisd-new at postgresql.org X-Amavis-Alert: BAD HEADER Non-encoded 8-bit data (char 9C hex) in message header 'Received' Received: \234by rodos.fzk.de... ^ X-Archive-Number: 200404/126 X-Sequence-Number: 17501 > > Ok. I found the libpq syntax for COPY in the Programmer's manual. I've > got a working version, but wanted to verify something. > > PQexec(conn, "COPY foo FROM STDIN"); > PQputline(conn, "3\thello world\t4.5\n"); > PQputline(conn,"4\tgoodbye world\t7.11\n"); > ... > PQputline(conn,"\\.\n"); > PQendcopy(conn); > > 1. I'm assuming that I can put in as many PQputline statements as I > want to between the PQexec("COPY ... FROM ...") and the terminator > line. Is that correct? No limit? > > 2. Do any of these lines need to be followed by a PQclear(res)? What > about the first PQexec? > > -Tony > ad 1. Yes, no limit. ad 2. I use PQclear following the PQexec. Regards, Christoph