Skip Menu |

This queue is for tickets about the DBD-InterBase CPAN distribution.

Report information
The Basics
Id: 55234
Status: open
Priority: 0/
Queue: DBD-InterBase

Owner: Nobody in particular
Requestors: mjp [...]

Bug Information
Severity: Normal
Broken in: 0.48
Fixed in: (no value)

Subject: table_info TABLE_SCHEM incorrect, TABLE_TYPE and interface incomplete
Download (untitled) / with headers
text/plain 1.5k
Issue (DBD-InterBase-0.48): 1) [Incorrectness] Interbase/Firebird does not support schema in the DBI sense of the term, yet $dbh->table_info() non-NULL for TABLE_SCHEM. 2) [Incompleteness] $dbh->table_info() accepts no parameters, so that one cannot search for tables of a specific type or name pattern, nor list all supported TABLE_TYPE. Expectation: 1) (Schema) TABLE_SCHEM should always be NULL -- a DBI "schema" is a namespace prefix which can discriminate tables of the same name. DBD-InterBase incorrectly returns rdb$relations.rdb$owner_name here, which is perhaps appropriate in the Oracle world but not here. You cannot have a table "SYSDBA"."TBL" and a table "A_USER"."TBL" in the same database file. rdb$owner_name is useful, however, and could be returned as an additional column (suggested field name: IB_OWNER_NAME). 2) (Incompleteness) All versions of IB/FB that I'm aware of support object types 'TABLE', 'VIEW' and 'SYSTEM TABLE' (rdb$% or mon$% tables). FB2.1 and later IB (7+ ?) additionally support 'GLOBAL TEMPORARY' types. 'SYSTEM VIEW', which is not defined in the DBI but is supported in at least DBD::Pg, is clearly possible given the rdb$relations table's structure, but is perhaps nowhere implemented. Moreover, one cannot use this function to search for specific catalogs and schema (neither of which are supported by IB/FB), tables/views/system tables and enumerate types. Background: table_info() is an awkward, complicated function whose implementation across DBD drivers is rather inconsistent.
Download (untitled) / with headers
text/plain 823b
See for a possible approach. That code is working, but has no tests and doesn't cover IB7. The above approach is a class framework solely for answering table_info() requests. DBD::InterBase::db::table_info normalizes its arguments and calls a factory to create a $dbh->{private_...} helper object which groks rdb$relations for the "isc_info_isc_version" behind our $dbh connection. The basic class, compatible with the oldest IB engines (I think), puts together a UNION of desired TABLE_TYPEs, since we don't have subqueries nor CASE statements. It returns an additional column, "IB_OWNER_NAME". It also handles catalogs (no support) and schema (no support). A subclass for Firebird 2.1 adds 'GLOBAL TEMPORARY', a better query, and more additional columns.
Download (untitled) / with headers
text/plain 152b now includes new tests for table_info() and tables() (whose behavior is now DBI compliant).

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to