adminConnUtil.getDbHandler().dropSchema(schemaInfos.get(0), userName); } else { adminConnUtil.getDbHandler().dropSchema(schemaInfos.get(0)); String.format("ju-dbutil-test.%s.jtaRecoveryGrants", profile), Boolean.class, "false"); adminConnUtil.getDbHandler().createSchema() .name(schemaName)
convertedColumn = this.emUtil.asConnUtil().getDbHandler().wrapInLowerString(mappedName); value = value.toString().toLowerCase();
this.connUtil.getDbHandler().resetIdentityGenerationOrSequences(1);
/** * Gets a list of the primery key columns for the specified table * <p> * Column names are kept the way the driver returns them (may be upper, lower or mixed case) * @param tableName Table name * @return List of all columns that make up the primary key. If no primary key is applied, an empty list is returned. */ public List<String> getPrimaryKeyColumns(final String tableName) { final String actualTableName = this.getDbType().getDbSpecificHandler(this.asConnUtil()).convertTableNameCasing(tableName); List<String> columnNames = this.extractDatabaseMetaData(new DatabaseMetaDataCallback<List<String>>() { @Override public List<String> processMetaData(DatabaseMetaData dbmd) throws SQLException { ResultSet rs = dbmd.getPrimaryKeys(null, null, actualTableName); List<String> columnNames = new ArrayList<>(); while (rs.next()) { columnNames.add(rs.getString("COLUMN_NAME")); } rs.close(); return columnNames; } }); return columnNames; }
@Override public List<String> getPrimaryKeyColumns(String tableName) { final String actualTableName = this.connUtil.getDbType().getDbSpecificHandler(this.connUtil).convertTableNameCasing(tableName); List<String> columnNames = this.connUtil.extractDatabaseMetaData(new DatabaseMetaDataCallback<List<String>>() { @Override public List<String> processMetaData(DatabaseMetaData dbmd) throws SQLException { ResultSet rs = dbmd.getPrimaryKeys(null, null, actualTableName); List<String> columnNames = new ArrayList<>(); while (rs.next()) { columnNames.add(rs.getString("COLUMN_NAME")); } rs.close(); return columnNames; } }); return columnNames; }
public Long getNextValueFromSequence(String sequenceName) throws JuDbException { return this.getDbType().getDbSpecificHandler(this.asConnUtil()).getNextValueFromSequence(sequenceName); }
/** * Resets identity generation of all tables or sequences to allow for predictable * and repeatable entity generation. * <p> * The exact behaviour of identity generation may vary from DB to DB. * @param val Value for the next primary key */ public void resetIdentityGenerationOrSequences(int val) { this.getDbType().getDbSpecificHandler(this.asConnUtil()).resetIdentityGenerationOrSequences(val); }
/** * Gets a list of all sequence names of the DB. Sequences names are returned the * way the DB driver returns them, which is usually upper case. * @return List of Sequences names * @throws JuDbException If the list cannot be evaluated */ public List<String> getSequenceNames() throws JuDbException { // There doesn't seem to be a generic way to retrieve sequences using JDBC meta data, so // we have to use native queries. The queries are stored in the DB specific handlers. return this.getDbType().getDbSpecificHandler(this.asConnUtil()).getSequenceNames(); }