pgsql: Binary data support improvement
| From: | Yasuo Ohgaki | Date: | Tue, 25 Jun 2013 22:44:06 +0000 |
| Subject: | pgsql: Binary data support improvement | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-67837@lists.php.net to get a copy of this message | ||
Hi all,
Current pgsql module lacks direct binary support. Therefore, users have to
use pg_escape_bytea/pg_unescape_bytea for binary handling even with
prepared statement type APIs. Use of
pg_escape_bytea/pg_unescape_bytea requires some overheads on both server
and client side.
Following patch enables pg_execute() to handle binary directly.
https://github.com/yohgaki/php-src/compare/pgsql_binary_support
NOTE: This patch is only for PoC and treats all parameters as binary,
returns binary result ALWAYS. i.e. Not only bytea, but int, float, numeric,
etc are returned as binary.
I'm planning to add $params_format(array) and $binary_result(bool)
parameter.
pg_execute() will look like
Current:
resource pg_execute ([ resource $connection ], string $stmtname , array
$params )
New:
resource pg_execute ([ resource $connection ], string $stmtname , array
$params [, array $params_format [, bool $binary_result]] )
Any thoughts?
--
Yasuo Ohgaki
yohgaki@ohgaki.net