Re: [patch] add COPY functions to pdo_pgsql

From: Date: Thu, 05 Nov 2009 20:59:02 +0000
Subject: Re: [patch] add COPY functions to pdo_pgsql
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-45960@lists.php.net to get a copy of this message
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();

« previous php.internals (#45960) next »