Req #63656 [Opn->Csd]: PostgreSQL PDO methods like pgsqlCopyFromFile are undocumented
| From: | salathe@php.net | Date: | Thu, 14 May 2015 22:42:16 +0000 |
| Subject: | Req #63656 [Opn->Csd]: PostgreSQL PDO methods like pgsqlCopyFromFile are undocumented | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-12332@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=63656&edit=1
ID: 63656
Updated by: salathe@php.net
Reported by: ch@php.net
Summary: PostgreSQL PDO methods like pgsqlCopyFromFile are
undocumented
-Status: Open
+Status: Closed
Type: Feature/Change Request
Package: Documentation problem
PHP Version: 5.4.9
-Assigned To:
+Assigned To: salathe
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation better.
Previous Comments:
------------------------------------------------------------------------
[2015-05-14 22:41:07] salathe@php.net
Automatic comment from SVN on behalf of salathe
Revision: http://svn.php.net/viewvc/?view=revision&revision=336777
Log: Document pdo_pgsql copy from/to file/array methods. Patch by Alexander N (doc bug #63656)
------------------------------------------------------------------------
[2013-12-31 19:52:59] thomas dot mayer at 2bis10 dot de
Here's an example for reusing a doctrine connection (and db transaction) for the COPY via PDO:
$file = '/tmp/test.csv';
$this->manager->getConnection()->beginTransaction();
// ... do something in doctrine here
$pdo = $this->manager->getConnection()->getWrappedConnection();
$pdo->pgsqlCopyFromFile('testtable', $file, "\t", '', 'field1,
field2');
$this->manager->getConnection()->commit();
------------------------------------------------------------------------
[2013-12-31 17:48:37] thomas dot mayer at 2bis10 dot de
Thank you so much for adding these functions.
This functionality is really needed to use the fast client-side COPY-behaviour of postgresql inside
an existing pdo connection (which allows to reuse PDO's database transaction).
It took me hours to find out that PDO::pgsqlCopy* function exists in PDO. I think they are available
since PHP 5.3.x and still not documented.
I just found some discussion here: http://www.serverphorums.com/read.php?7,151997,page=1
This really needs to be documented now.
------------------------------------------------------------------------
[2012-11-30 12:06:43] ch@php.net
Description:
------------
Several PostgreSQL specific PDO methods are not documented although they do work fine.
Although PDO aims to hide database specific features behind a common API, sometimes one simply wants
to use certain features and for this reason they should not be hidden but rather documented (with a
proper warning).
php5-5.4.4$ grep -B2 PHP_METHOD ext/pdo_pgsql/pgsql_driver.c
/* {{{ proto string PDO::pgsqlCopyFromArray(string $table_name , array $rows [, string $delimiter [,
string $null_as ] [, string $fields])
Returns true if the copy worked fine or false if error */
static PHP_METHOD(PDO, pgsqlCopyFromArray)
--
/* {{{ proto string PDO::pgsqlCopyFromFile(string $table_name , string $filename [, string
$delimiter [, string $null_as ] [, string $fields])
Returns true if the copy worked fine or false if error */
static PHP_METHOD(PDO, pgsqlCopyFromFile)
--
/* {{{ proto string PDO::pgsqlCopyToFile(string $table_name , $filename, [string $delimiter [,
string $null_as [, string $fields]]])
Returns true if the copy worked fine or false if error */
static PHP_METHOD(PDO, pgsqlCopyToFile)
--
/* {{{ proto string PDO::pgsqlCopyToArray(string $table_name , [string $delimiter [, string $null_as
[, string $fields]]])
Returns true if the copy worked fine or false if error */
static PHP_METHOD(PDO, pgsqlCopyToArray)
--
/* {{{ proto string PDO::pgsqlLOBCreate()
Creates a new large object, returning its identifier. Must be called inside a transaction. */
static PHP_METHOD(PDO, pgsqlLOBCreate)
--
/* {{{ proto resource PDO::pgsqlLOBOpen(string oid [, string mode = 'rb'])
Opens an existing large object stream. Must be called inside a transaction. */
static PHP_METHOD(PDO, pgsqlLOBOpen)
--
/* {{{ proto bool PDO::pgsqlLOBUnlink(string oid)
Deletes the large object identified by oid. Must be called inside a transaction. */
static PHP_METHOD(PDO, pgsqlLOBUnlink)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=63656&edit=1