コード例 #1
0
 protected void getColumnsForUniqueConstraint(
     Connection jdbcConnection, UniqueConstraint constraint, String schema) throws SQLException {
   PreparedStatement stmt = null;
   ResultSet rs = null;
   try {
     stmt =
         jdbcConnection.prepareStatement(
             "select ucc.column_name from all_cons_columns ucc where ucc.constraint_name=? and ucc.owner=? order by ucc.position");
     stmt.setString(1, constraint.getName());
     stmt.setString(2, schema);
     rs = stmt.executeQuery();
     while (rs.next()) {
       String columnName = rs.getString("column_name");
       constraint.getColumns().add(columnName);
     }
   } finally {
     if (rs != null) {
       try {
         rs.close();
       } catch (SQLException ignored) {
       }
     }
     if (stmt != null) stmt.close();
   }
 }