Denis, Could you merge the patches into a single for easier code review. Also, the copy to/from file seems like it would just be a wrapper against the native COPY PostgreSQL command, is there really a need to provide a method for it?
On Mon, May 24, 2010 at 4:57 AM, Denis Gasparin <denis.gaspa...@edistar.com>wrote: > Hi. > > I developed some patches for PDO/Postgresql driver in order to add some > useful methods that were available in the original pgsql driver. > > The attached patches apply on 5.3.2 and svn 5.3.x. > If needed, i have patches also for 5.2.x. > > Please comment and tell me improvements or tips. > > Thank you in advance, > > Denis Gasparin > > Documentation of the added methods follows: > > pgsqlIsInTransaction() > > It uses the native Postgresql functions to check transaction status. > It returns one of the following status codes: > * PDO::PGSQL_TRANSACTION_IDLE: connection in idle status > * PDO::PGSQL_TRANSACTION_ACTIVE: connection is executing a command > * PDO::PGSQL_TRANSACTION_INTRANS: connection is idle in a valid > transaction block > * PDO::PGSQL_TRANSACTION_INERROR: connection is idle, in a failed > transaction block > * PDO::PGSQL_TRANSACTION_UNKNOWN: connection is in a bad status > > > > pgsqlCopyFromArray($table,Array $data,$delimiter,$null, Array $fields) > > It uses the native Postgresql copy construct to append $data to $table. > It returns boolean. > Parameters: > * (mandatory) $table: table to append data to > * (mandatory) $data: Array of rows with data in table field order > (or as specified in the $fields array). Fields > must be separated by $delimiter or by > postgresql standard \t) > * $delimiter: alternative delimiter to use in place of the standard > postgres delimiter ("\t") > * $null: alternative string to use as null value. Default is "\N" > * $fields: array with table fields that are specified in $data > parameter > > > > pgsqlCopyFromFile($table,$filename,$delimiter,$null,$fields) > > It uses the native Postgresql copy construct to append $filename > contents to $table. > It returns boolean. > Parameters: > * (mandatory) $table: table to append data to. > * (mandatory) $filename: file with contents to append to $table. See > Postgresql documentation for the format. > * $delimiter: alternative delimiter to use in place of the standard > postgres delimiter ("\t") > * $null: alternative string to use as null value. Default is "\N" > * $fields: array with table fields that are specified in $filename > file > > pgsqlCopyToArray($table,$delimiter,$null,$fields) > > It uses the native Postgresql copy construct to retrieve $table contents > and store them to an array. > It returns an array of rows or false in case of problems. > The format of the rows into the array is indicated in the $delimiter, > $null and $fields parameters. > Parameters: > * (mandatory) $table: table to retrieve data from. > * $delimiter: alternative delimiter to use in place of the standard > postgres delimiter ("\t") > * $null: alternative string to use as null value. Default is "\N" > * $fields: array with table fields to include in the row of the > array. > > > pgsqlCopyToFile($table,$filename,$delimiter,$null,$fields) > > > It uses the native Postgresql copy construct to retrieve $table contents > and store them into a file. > It returns boolean. > The format of the rows stored into the file is indicated in the > $delimiter, $null and $fields parameters. > Parameters: > * (mandatory) $table: table to retrieve data from. > * (mandatory) $filename: file where to store the contents of the > table > * $delimiter: alternative delimiter to use in place of the standard > postgres delimiter ("\t") > * $null: alternative string to use as null value. Default is "\N" > * $fields: array with table fields to include in the row of the > array. > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >