Skip to content

PDO: Make PDO_ATTR_FETCH_TABLE_NAMES generic in PDO - #23872

Draft
NattyNarwhal wants to merge 12 commits into
php:masterfrom
NattyNarwhal:fetch-table-name-generic
Draft

NattyNarwhal wants to merge 12 commits into
php:masterfrom
NattyNarwhal:fetch-table-name-generic

Conversation

@NattyNarwhal

@NattyNarwhal NattyNarwhal commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

Rather than having to be re-implemented by each driver. Also makes "table" in getColumnMeta generic as well due to this refactor.

Some notes:

  • ODBC: I was not able to get SQLColAttribute with SQL_DESC_TABLE_NAME to work with the Db2i or SQL Server drivers; SQL Server does not return table info for the reason below.
  • DBLIB: Getting the table name out of the protocol requires FOR BROWSE.
  • PGSQL: Fetching the table name may be expensive due to the query needed. I have not measured; there may also be a better way, but I'm not familiar with libpq.

Required to make PDO_ATTR_FETCH_TABLE_NAMES generic across drivers.
Note I was not able to get a table name from the Db2i driver at least.
Previously drivers had to implement this attribute themselves, and only
MySQL and Firebird did so, in spite of support being generic. Remove
driver-specific logic for this as well (Firebird's was harrowing).
Now that we need this for ATTR_FETCH_TABLE_NAMES, we might as well make
this part of the generic PDO method and not driver specific ones.
@NattyNarwhal
NattyNarwhal force-pushed the fetch-table-name-generic branch from 55c246f to 40851ba Compare September 24, 2026 20:46
@NattyNarwhal
NattyNarwhal force-pushed the fetch-table-name-generic branch 4 times, most recently from aed85d2 to 172251c Compare September 25, 2026 07:19
@NattyNarwhal
NattyNarwhal force-pushed the fetch-table-name-generic branch from a021428 to 2174b9b Compare September 25, 2026 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant