private void revokeRight() { if (schema != null) { revokeRight(schema); } for (Table table : tables) { revokeRight(table); } }
private CreateIndex createAffinityIndex(Schema schema, String tableName, IndexColumn[] indexColumns) { CreateIndex idx = new CreateIndex(session, schema); idx.setTableName(tableName); idx.setIndexColumns(indexColumns); idx.setAffinity(true); return idx; }
private void grantRight() { if (schema != null) { grantRight(schema); } for (Table table : tables) { grantRight(table); } }
private CreateRole parseCreateRole() { CreateRole command = new CreateRole(session); command.setIfNotExists(readIfNotExists()); command.setRoleName(readUniqueIdentifier()); return command; }
private DropUserDataType parseDropUserDataType() { boolean ifExists = readIfExists(false); DropUserDataType command = new DropUserDataType(session); command.setTypeName(readUniqueIdentifier()); ifExists = readIfExists(ifExists); command.setIfExists(ifExists); return command; }
private DropAggregate parseDropAggregate() { boolean ifExists = readIfExists(false); DropAggregate command = new DropAggregate(session); command.setName(readUniqueIdentifier()); ifExists = readIfExists(ifExists); command.setIfExists(ifExists); return command; }
/** * Add a constraint statement to this statement. The primary key definition is * one possible constraint statement. * * @param command * the statement to add */ public void addConstraintCommand(DefineCommand command) { if (command instanceof CreateIndex) { getConstraintCommands().add(command); } else { AlterTableAddConstraint con = (AlterTableAddConstraint) command; boolean alreadySet; if (con.getType() == CommandInterface.ALTER_TABLE_ADD_CONSTRAINT_PRIMARY_KEY) { alreadySet = setPrimaryKeyColumns(con.getIndexColumns()); } else { alreadySet = false; } if (!alreadySet) { getConstraintCommands().add(command); } } }
@Override public int update() { session.commit(true); prepareDrop(); executeDrop(); return 0; }
private DeallocateProcedure parseDeallocate() { readIf("PLAN"); String procedureName = readAliasIdentifier(); DeallocateProcedure command = new DeallocateProcedure(session); command.setProcedureName(procedureName); return command; }
private Prepared parseTruncate() { read("TABLE"); Table table = readTableOrView(); TruncateTable command = new TruncateTable(session); command.setTable(table); return command; }
/** * Create the constraints. */ protected void createConstraints() { if (constraintCommands != null) { for (DefineCommand command : constraintCommands) { command.setTransactional(transactional); command.update(); } } }
public void setIfExists(boolean b) { ifExists = b; if (next != null) { next.setIfExists(b); } }
/** * Chain another drop table statement to this statement. * * @param drop the statement to add */ public void addNextDropTable(DropTable drop) { if (next == null) { next = drop; } else { next.addNextDropTable(drop); } }
private void copyData(Table table) { copyData(table, null, false); }
/** * Set the salt and hash for the given user. * * @param user the user * @param session the session * @param salt the salt * @param hash the hash */ static void setSaltAndHash(User user, Session session, Expression salt, Expression hash) { user.setSaltAndHash(getByteArray(session, salt), getByteArray(session, hash)); }
private String generateConstraintName(Table table) { if (constraintName == null) { constraintName = getSchema().getUniqueConstraintName( session, table); } return constraintName; }
private static Index getIndex(Table t, IndexColumn[] cols, boolean moreColumnOk) { if (t.getIndexes() == null) { return null; } for (Index idx : t.getIndexes()) { if (canUseIndex(idx, t, cols, moreColumnOk)) { return idx; } } return null; }
private static Index getUniqueIndex(Table t, IndexColumn[] cols) { if (t.getIndexes() == null) { return null; } for (Index idx : t.getIndexes()) { if (canUseUniqueIndex(idx, t, cols)) { return idx; } } return null; }
public void setDropAction(ConstraintActionType dropAction) { this.dropAction = dropAction; if (next != null) { next.setDropAction(dropAction); } }