Tim Bunce wrote:
> 
> On Tue, Mar 19, 2002 at 12:20:43PM +0100, Steffen Goeldner wrote:
> > Tim Bunce wrote:
> > >
> > > On Mon, Mar 18, 2002 at 12:05:28PM +0100, Steffen Goeldner wrote:
> >
> > > A more realistic example would be for drivers that return empty
> > > strings or NULL for the catalog portion.
> >
> > Currently, DBD::Oracle's table_info() method returns '' -> NULL ->
> > undef for the PUBLIC pseudo-schema:
> >
> >   , decode( t.OWNER, 'PUBLIC', '', t.OWNER ) TABLE_SCHEM
> >
> > Oracle's weird '' -> NULL conversion has one advantage: DBI's
> > tables() method does the right thing (it omits the schema part).
> > BTW: Should tables() really return something like '""."DBA_TABLES"'
> > for empty schemas?
> 
> I'm not sure what you mean by empty schema.

A defined but empty schema name ('') returned by table_info().
>From the ODBC spec:

 | If a driver supports schemas for some tables but not for others,
 | such as when the driver retrieves data from different DBMSs, it
 | returns an empty string ("") for those tables that do not have
 | schemas.

If some 'tables [...] do not have schemas', will the driver accept

  select * from ""."MyTable"

?

> > Unfortunately, an empty schema argument (currently) does not match
> > the PUBLIC schema.
> > Should I generate another predicate for that case?
> 
> What does Oracle's ODBC driver do?

SQLTables:
  In: StatementHandle = 0x008A1860
      CatalogName     = SQL_NULL_HANDLE, NameLength1 = 0
      SchemaName      = ""             , NameLength2 = 0
      TableName       = "DBA_TABLES"   , NameLength3 = 10
      TableType       = SQL_NULL_HANDLE, NameLength4 = 0
  Return: SQL_SUCCESS=0

Get Data All:
"TABLE_CAT" "TABLE_SCHEM" "TABLE_NAME" "TABLE_TYPE"  "REMARKS"
----------- ------------- ------------ ------------- ---------
     <Null> "PUBLIC"      "DBA_TABLES" "SYNONYM"     <Null>
     <Null> "SYS"         "DBA_TABLES" "SYSTEM VIEW" <Null>

2 rows fetched from 5 columns.

Thus, I'd better change:

  , decode( t.OWNER, 'PUBLIC', '', t.OWNER ) TABLE_SCHEM

to 

 , t.OWNER  TABLE_SCHEM

?


Steffen

Reply via email to