Req #63656 [Com]: PostgreSQL PDO methods like pgsqlCopyFromFile are undocumented

From: Date: Tue, 31 Dec 2013 19:52:59 +0000
Subject: Req #63656 [Com]: PostgreSQL PDO methods like pgsqlCopyFromFile are undocumented
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-10778@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 Comment by: thomas dot mayer at 2bis10 dot de Reported by: ch@php.net Summary: PostgreSQL PDO methods like pgsqlCopyFromFile are undocumented Status: Open Type: Feature/Change Request Package: Documentation problem PHP Version: 5.4.9 Block user comment: N Private report: N New Comment: 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(); Previous Comments: ------------------------------------------------------------------------ [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

« previous php.doc.bugs (#10778) next »