Skip to content

Commit 6059e7f

Browse files
committed
ext/pdo_pgsql: set PDO column's table field from describer
1 parent 55ae0c7 commit 6059e7f

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎ext/pdo_pgsql/pgsql_statement.c‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@
5858
#define FIN_CLOSE 0x2
5959
#define FIN_ABORT 0x4
6060

61+
static zend_always_inline char * pdo_pgsql_translate_oid_to_table(Oid oid, PGconn *conn);
62+
6163
static bool pgsql_result_status_ok(ExecStatusType status)
6264
{
6365
switch (status) {
@@ -720,6 +722,13 @@ static int pgsql_stmt_describe(pdo_stmt_t *stmt, int colno)
720722
return 0;
721723
}
722724

725+
/* XXX: Performance implication from doing a query for relname? */
726+
Oid table_oid = PQftable(S->result, colno);
727+
str = pdo_pgsql_translate_oid_to_table(table_oid, S->H->server);
728+
if (str) {
729+
cols[colno].table = zend_string_init(str, strlen(str), 0);
730+
efree(str);
731+
}
723732
str = PQfname(S->result, colno);
724733
cols[colno].name = zend_string_init(str, strlen(str), 0);
725734
cols[colno].maxlen = PQfsize(S->result, colno);

0 commit comments

Comments
 (0)