Skip to content

Commit

Permalink
0001227: Reading of MySQL tables can sometimes include the PRIMARY in…
Browse files Browse the repository at this point in the history
…dex if the primary key columns aren't at the start
  • Loading branch information
chenson42 committed May 16, 2013
1 parent 842c20d commit fb83c96
Showing 1 changed file with 9 additions and 10 deletions.
Expand Up @@ -762,21 +762,20 @@ && isInternalForeignKeyIndex(connection, metaData, table, fk, index)) {
* @return <code>true</code> if the index matches the columns
*/
protected boolean matches(IIndex index, List<String> columnsToSearchFor) {
if (index.getColumnCount() != columnsToSearchFor.size()) {
return false;
}
for (int columnIdx = 0; columnIdx < index.getColumnCount(); columnIdx++) {
try {
if (!columnsToSearchFor.get(columnIdx).equals(index.getColumn(columnIdx).getName())) {
return false;
for (String column : columnsToSearchFor) {
boolean found = false;
for (int i = 0; i < index.getColumnCount(); i++) {
if (column != null && column.equals(index.getColumn(i).getName())) {
found = true;
}
}
} catch (NullPointerException ex) {
ex.printStackTrace();
if (!found) {
return false;
}
}
return true;
}

/*
* Tries to determine whether the index is the internal database-generated
* index for the given table's primary key. Note that only unique indices
Expand Down

0 comments on commit fb83c96

Please sign in to comment.