Patch for #42589

php.internals

Martin Jansen

18 years ago
Attached is a patch for the MySQL and SQLite drivers of PDO that implements the feature request from #42589 by adding the name of the table where the column is from to the output of getColumnMeta(). The change for MySQL seems to be pretty straightforward, but for SQLite I had to add the SQLITE_ENABLE_COLUMN_METADATA preprocessor symbol to the build chain of the bundled SQLite in order to make it work [1]. This means that people who are using their own SQLite build for PDO will not be able to get the table name when their build didn't use the symbol. In this case the corresponding unit test will fail as well. (I haven't found a way to figure out from userland if PDO uses the bundled lib.) This is my first not-totally-trivial patch for PHP and the first time I wrote .phpt unit tests, so please bear with me. - Martin [1] http://www.sqlite.org/capi3ref.html#sqlite3_column_table_name

Martin Jansen

18 years ago
On Sat Oct 13, 2007 at 11:4625AM +0200, Martin Jansen wrote:
> Attached is a patch for the MySQL and SQLite drivers of PDO that > implements the feature request from #42589 by adding the name of the > table where the column is from to the output of getColumnMeta().
Antony already implemented this in PECL's pdo_mysql 4 months ago, but these changes haven't yet been merged into HEAD. The SQLite driver in PECL however also lacks this feature. - Martin

Martin Jansen

18 years ago
Martin Jansen wrote:
> On Sat Oct 13, 2007 at 11:4625AM +0200, Martin Jansen wrote: >> Attached is a patch for the MySQL and SQLite drivers of PDO that >> implements the feature request from #42589 by adding the name of the >> table where the column is from to the output of getColumnMeta(). > > Antony already implemented this in PECL's pdo_mysql 4 months ago, but > these changes haven't yet been merged into HEAD. The SQLite driver in > PECL however also lacks this feature.
An updated patch for the SQLite driver in PHP_5_3 is attached. - Martin