Пример #1
0
 public void refreshPrimaryKeys(DatabaseMetaData metaData) throws SQLException {
   primaryKeys.clear();
   ResultSet rs = null;
   try {
     rs = metaData.getPrimaryKeys(catalog, schema, name);
     while (rs.next()) {
       PrimaryKey pk = new PrimaryKey();
       primaryKeys.add(pk);
       pk.setOwner(this);
       pk.setColumnName(rs.getString("COLUMN_NAME"));
       pk.setKeySequence(rs.getShort("KEY_SEQ"));
       pk.setName(rs.getString("PK_NAME"));
     }
   } catch (SQLException sqle) {
     throw sqle;
   } finally {
     try {
       rs.close();
     } catch (Exception ex) {
     }
   }
 }
Пример #2
0
 public boolean removePrimaryKey(PrimaryKey primaryKey) {
   primaryKey.setOwner(null);
   return primaryKeys.remove(primaryKey);
 }
Пример #3
0
 public void addPrimaryKey(PrimaryKey primaryKey) {
   primaryKeys.add(primaryKey);
   primaryKey.setOwner(this);
 }