Subject: | Fix DBI call to 'tables', oracle schema names |
(tested with DBI 1.601, perl 5.8.8 under cygwin / windows xp)
Autodia fails on Oracle databases with an error when PUBLIC schema
contains no tables.
Oracle should have the schema search pattern set to the login name, not
set to 'PUBLIC' for Autodia to be useful. In Oracle, all schemas are
owned by users, and the schema owner and user are in some ways
synonymous. I've changed the code to refer to the schema owner rather
than the PUBLIC schema for Oracle.
Also, the call to 'tables' should have an undef for the table_type field
rather than an empty string, as DBI turns this into a search for a null
list, generating and error (see error.txt attached)
Attached is an RCS file with a patched version of Handler/DBI.pm that at
least runs with Oracle. I did not create any tests for these conditions
Subject: | error_dbi.txt |
have file : Oracle:datawhd
DBI - processing database type : Oracle
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8/cygwin/DBD/Oracle.pm line 388.
DBD::Oracle::db tables failed: ORA-00936: missing expression (DBD ERROR: error possibly near <*> indicator at char 548 in 'SELECT *
FROM
(
SELECT /*+ RULE*/
NULL TABLE_CAT
, t.OWNER TABLE_SCHEM
, t.TABLE_NAME TABLE_NAME
, decode(t.OWNER
, 'SYS' , 'SYSTEM '
, 'SYSTEM' , 'SYSTEM '
, '' ) || t.TABLE_TYPE TABLE_TYPE
, c.COMMENTS REMARKS
FROM ALL_TAB_COMMENTS c
, ALL_CATALOG t
WHERE c.OWNER (+) = t.OWNER
AND c.TABLE_NAME (+) = t.TABLE_NAME
AND c.TABLE_TYPE (+) = t.TABLE_TYPE
)
WHERE TABLE_SCHEM LIKE 'public' ESCAPE '\'
AND TABLE_NAME LIKE '%' ESCAPE '\'
AND TABLE_TYPE IN (<*>)
ORDER BY TABLE_TYPE, TABLE_SCHEM, TABLE_NAME
') [for Statement "SELECT *
FROM
(
SELECT /*+ RULE*/
NULL TABLE_CAT
, t.OWNER TABLE_SCHEM
, t.TABLE_NAME TABLE_NAME
, decode(t.OWNER
, 'SYS' , 'SYSTEM '
, 'SYSTEM' , 'SYSTEM '
, '' ) || t.TABLE_TYPE TABLE_TYPE
, c.COMMENTS REMARKS
FROM ALL_TAB_COMMENTS c
, ALL_CATALOG t
WHERE c.OWNER (+) = t.OWNER
AND c.TABLE_NAME (+) = t.TABLE_NAME
AND c.TABLE_TYPE (+) = t.TABLE_TYPE
)
WHERE TABLE_SCHEM LIKE 'public' ESCAPE '\'
AND TABLE_NAME LIKE '%' ESCAPE '\'
AND TABLE_TYPE IN ()
ORDER BY TABLE_TYPE, TABLE_SCHEM, TABLE_NAME
"] at /usr/lib/perl5/site_perl/5.8/Autodia/Handler/DBI.pm line 70.
using default (dia) template
Diagram.pm : Classes : no Classes to be printed
Diagram.pm : Superclasses : no superclasses to be printed
Diagram.pm : Components : no Components to be printed
Diagram.pm : Inheritances : no Inheritances to be printed - ignoring..
Diagram.pm : Dependancies : no dependancies to be printed - ignoring..
nothing to output using DBI handler - are you sure you set the language correctly ?
getting handlers..
getting pattern for dbi
AutoDia - version 2.05(c) Copyright 2003 A Trevena
using language : DBI
..using Autodia::Handler::DBI
opening Oracle:datawhd
database type : Oracle public
esc : 1 unescape 0
complete. (processed 1 files)
Subject: | DBI.pm,v |
Message body not shown because it is not plain text.