Hello,
over the last few days I have been playing with pdo_pgsql a bit in
order to make some wishes I've always had finally come true.
So far, I've added
- support for automatically parsing JSON result column (if the json
extension is enabled) - support for automatically parsing array columns
- support for turning timestamp and date columns into DateTime objects
- a pgsqlQuoteIdentifier method to correctly quote table and column
names (arguably, this should maybe go into PDO base)
The first three features need enabling by setting
PDO::PGSQL_ATTR_ADVANCED_TYPE_CONVERSIONS to true on either the PDO
object or as a driver specific parameter to prepare().
Parsing the arrays feels especially important to me as the various
userland solutions out here are either quite slow, unreadable or
outright buggy. Arrays are a core feature of Postgres and map really
well to arrays in PHP.
1 and 4 also have unit tests. Tests for 2 and 3 will be coming too.
I'm writing here in order to find out whether you think that improving
the pdo_pgsql driver is something you would think makes sense for you,
in which case I will write an official RFC.
My work so far is on
https://github.com/pilif/php-src/commits/pdo_pgsql-improvements
Stuff I still would also want to add is
- support for DateTimeInterface bound parameters
- support for Array as bound parameters (maybe - not sure if doable)
- support for the new features of PGResult (9.3 and later) that
expose information of what columns have failed a unique key
constraint, for example. - Unit tests for everything, of course
So, asking again: Do you guys think, this is worth writing an RFC for?
Thank you in advance
Philip
Hello,
over the last few days I have been playing with pdo_pgsql a bit in
order to make some wishes I've always had finally come true.
…
So, asking again: Do you guys think, this is worth writing an RFC for?
Probably yes! If in doubt I’d suggest to go for the RFC.
You might also want to look at http://pecl.php.net/pq if you’re interested in more sophisticated Postgresql support in PHP. It’s still work-in-progress, though.
Mike