Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:45960 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 62199 invoked from network); 5 Nov 2009 20:59:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Nov 2009 20:59:47 -0000 Authentication-Results: pb1.pair.com smtp.mail=timr@asteriasgi.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=timr@asteriasgi.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain asteriasgi.com from 69.73.20.70 cause and error) X-PHP-List-Original-Sender: timr@asteriasgi.com X-Host-Fingerprint: 69.73.20.70 bigmo.asteriasgi.com Received: from [69.73.20.70] ([69.73.20.70:43235] helo=asteriasgi.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AC/A2-48879-1CC33FA4 for ; Thu, 05 Nov 2009 15:59:47 -0500 Received: (qmail 8957 invoked from network); 5 Nov 2009 20:59:41 -0000 Received: from sneezy.asteriasgi.com (192.168.2.2) by bigmo.asteriasgi.com with ESMTPS (AES128-SHA encrypted); 5 Nov 2009 20:59:41 -0000 Received: from [192.168.2.137] (192.168.2.137) by sneezy.asteriasgi.com (192.168.2.2) with Microsoft SMTP Server (TLS) id 8.1.393.1; Thu, 5 Nov 2009 14:59:41 -0600 Message-ID: <4AF33C96.7040103@asteriasgi.com> Date: Thu, 5 Nov 2009 14:59:02 -0600 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.4pre) Gecko/20090915 Thunderbird/3.0b4 MIME-Version: 1.0 To: Christopher Jones CC: "internals@lists.php.net" , References: <4AF31B63.7000705@asteriasgi.com> <4AF33277.6090301@oracle.com> In-Reply-To: <4AF33277.6090301@oracle.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [patch] add COPY functions to pdo_pgsql From: timr@asteriasgi.com (Tim Ringenbach) On 11/05/2009 02:15 PM, Christopher Jones wrote: > What do these do? I.e. where's the documentation or RFC http://wiki.php.net/rfc ? :) > > So the patch can be found easily, can you update the bug with a link to it? > > > I updated the bug with a link to the list archives. I'm not familiar with http://wiki.php.net/rfc. README.SUBMITTING_PATCH didn't mention anything about it, or really anything about documentation. Should I just tell you, or is there something special I should do? Most of the things on the rfc look like much bigger changes than this. Apparently Ilia Alshanetsky's the maintaining, so I'm CCing them. The version I started working on said unknown, and I didn't think to check again when I switch to subversion. Those functions are basically php wrappers around the 3 similarly named functions found on http://www.postgresql.org/docs/8.1/static/libpq-copy.html You issue a COPY TO STDOUT query and then run pgsqlGetCopyData until it returns false. Or you issue a COPY TO STDIN query and calld pgsqlPutCopyData repeatedly to send your data, then pgsqlPutCopyEnd when you're done. Example php code: $db = new PDO($dsn, $user, $pass, $driver_options); $db->query("COPY users TO STDIN WITH CSV"); while (($ret = $db->pgsqlGetCopyData()) !== false) echo "x: $ret\n"; $db->query("COPY test FROM STDIN WITH CSV"); $db->pgsqlPutCopyData("1,blah\n"); $db->pgsqlPutCopyData("2,asdf\n"); $db->pgsqlPutCopyEnd();