Avoid database query in getColumnMeta for pdo_pgsql connector#1534
Avoid database query in getColumnMeta for pdo_pgsql connector#1534jbylund wants to merge 6 commits intophp:masterfrom jbylund:master
Conversation
ext/pdo_pgsql/pgsql_statement.c
Outdated
There was a problem hiding this comment.
Shouldn't PQclear go outside the if?
…y leak inside the if
|
@jbylund thanks for the patch, especially with regard to bug #62498 the fix seems useful. Not a complete meta info cache solution, but simple and straight forward enough improvement. A test for this would make sense, could you please add one? Basically a test that could be run with and without your patch, to see it brings same results. Thanks. |
| $select = $db->query('SELECT intcol, stringcol, boolcol, datecol FROM bugtest_62498'); | ||
| $meta = []; | ||
| for ($i=0; $i < 4; $i++) { | ||
| $meta[] = $select->getColumnMeta(0); |
|
Comment on behalf of ab at php.net: Applied to 7.0 in e10257b, also i've fixed and extended the test in the follow up commit. Thanks! |
|
Funny that your test failing on my (admitedly bad) first implementation of #16249, |
I think there are a handful of bugs related to this issue. Essentially the current behavior is to run a query per column of the result set, even though we usually know the data type in most instances. This avoids the roundtrips for common types, but still does a roundtrip for user types.
Should close: https://bugs.php.net/bug.php?id=62498 (possibly related duplicates)