Skip to content

Commit

Permalink
Resolution of bug #1325650 - included an optimized version of selectI…
Browse files Browse the repository at this point in the history
…ndexesSql
  • Loading branch information
johncurrier committed Oct 21, 2005
1 parent fca6fda commit 51309b4
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/net/sourceforge/schemaspy/dbTypes/ora.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ dbThreads=1
selectViewSql=select text from all_views where view_name=? and owner=?
selectCheckConstraintsSql=select table_name, constraint_name constname, search_condition text from all_constraints where constraint_type = 'C' and constraint_name not like 'SYS%' and owner = ?

# Oracle's oracle.jdbc.OracleDatabaseMetaData.getIndexInfo() does an executeUpdate() and
# therefore requires write access to the database...which is inappropriate in most cases.
# If we run into that problem (ORA-01031: insufficient privileges) then we'll use this SQL:
selectIndexesSql=select A.INDEX_NAME INDEX_NAME, A.COLUMN_NAME COLUMN_NAME, case when B.UNIQUENESS = 'NONUNIQUE' then '1' else '0' end NON_UNIQUE, 3 TYPE from ALL_IND_COLUMNS A, ALL_INDEXES B where A.INDEX_NAME = B.INDEX_NAME and A.TABLE_NAME = ? and OWNER = ?

# Oracle's driver does 'inappropriate things' when you call DatabaseMetaData.getIndexInfo().
# (Oracle Bug No. 2686037 - IMPROVE IMPLEMENTATION OF DATABASEMETADATA.GETINDEXINFO - per Andrea (bsq99)
# This is an opportunity to bypass that 'badness'
selectIndexesSql=select null as table_cat, owner as table_schem, table_name, 0 as NON_UNIQUE, null as index_qualifier, null as index_name, 0 as type, 0 as ordinal_position, null as column_name, null as asc_or_desc, num_rows as cardinality, blocks as pages, null as filter_condition from all_tables where table_name = ? and owner = ? union select null as table_cat, i.owner as table_schem, i.table_name, decode (i.uniqueness, 'UNIQUE', 0, 1), null as index_qualifier, i.index_name, 1 as type, c.column_position as ordinal_position, c.column_name, null as asc_or_desc, i.distinct_keys as cardinality, i.leaf_blocks as pages, null as filter_condition from all_indexes i, all_ind_columns c where i.table_name = ? and i.owner = ? and i.index_name = c.index_name and i.table_owner = c.table_owner and i.table_name = c.table_name and i.owner = c.index_owner

0 comments on commit 51309b4

Please sign in to comment.