db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Jefferson <li...@datanucleus.org>
Subject DatabaseMetaData.getIndexInfo() to get unique compound indexes
Date Tue, 28 Jun 2011 14:27:18 GMT
If I create a unique index like this
ALTER TABLE {tblName} ADD CONSTRAINT {constrName} UNIQUE (col1, col2, col3)

and then call DatabaseMetaData.getIndexInfo()

it returns
  tableCat        =
  tableSchem      = null
  tableName       = tblName
  columnName      = col1
  nonUnique       = true
  ordinalPosition = 1
  indexName       = SQL110628145704820

  tableCat        =
  tableSchem      = null
  tableName       = tblName
  columnName      = col2
  nonUnique       = true
  ordinalPosition = 2
  indexName       = SQL110628145704820

  tableCat        =
  tableSchem      = null
  tableName       = tblName
  columnName      = col3
  nonUnique       = true
  ordinalPosition = 3
  indexName       = SQL110628145704820


So I can work out that I have a compound index here ... since all have this 
weird name. But I can't work out that it is UNIQUE.

Questions :
1. How do I get to know that these are parts of "constrName" ... rather than 
"SQLxxxxxxxx" ?

2. How do I get to know that they are part of a UNIQUE ?


TIA
-- 
Andy

Mime
View raw message