@Override public int update() { session.commit(true); prepareDrop(); executeDrop(); return 0; }
public synchronized void setMasterUser(User user) { lockMeta(systemSession); addDatabaseObject(systemSession, user); systemSession.commit(true); }
private void execute(String sql, boolean ddl) { Prepared command = session.prepare(sql); command.update(); if (ddl) { session.commit(true); } }
private void removeOldTempIndexes() { if (tempObjects != null) { metaObjects.putAll(tempObjects); for (PageIndex index: tempObjects.values()) { if (index.getTable().isTemporary()) { index.truncate(pageStoreSession); index.remove(pageStoreSession); } } pageStoreSession.commit(true); tempObjects = null; } metaObjects.clear(); metaObjects.put(-1, metaIndex); }
@Override public int update() { session.commit(true); if (view == null && ifExists) { return 0; } session.getUser().checkRight(view, Right.ALL); DbException e = view.recompile(session, false, true); if (e != null) { throw e; } return 0; }
@Override public int update() { session.commit(true); session.getUser().checkAdmin(); Database db = session.getDatabase(); if (table != null) { analyzeTable(session, table, sampleRows, true); } else { for (Table table : db.getAllTablesAndViews(false)) { analyzeTable(session, table, sampleRows, true); } } return 0; }
@Override public int update() { session.getUser().checkAdmin(); session.commit(true); Database db = session.getDatabase(); UserAggregate aggregate = db.findAggregate(name); if (aggregate == null) { if (!ifExists) { throw DbException.get(ErrorCode.AGGREGATE_NOT_FOUND_1, name); } } else { db.removeDatabaseObject(session, aggregate); } return 0; }
@Override public int update() { session.getUser().checkAdmin(); session.commit(true); Database db = session.getDatabase(); UserDataType type = db.findUserDataType(typeName); if (type == null) { if (!ifExists) { throw DbException.get(ErrorCode.USER_DATA_TYPE_NOT_FOUND_1, typeName); } } else { db.removeDatabaseObject(session, type); } return 0; }
private void execute(String sql) { try { Prepared command = session.prepare(sql); if (command.isQuery()) { command.query(0); } else { command.update(); } if (session.getAutoCommit()) { session.commit(false); } } catch (DbException e) { throw e.addSQL(sql); } }
@Override public int update() { session.commit(true); if (!table.canTruncate()) { throw DbException.get(ErrorCode.CANNOT_TRUNCATE_1, table.getSQL()); } session.getUser().checkRight(table, Right.DELETE); table.lock(session, true, true); table.truncate(session); return 0; }
@Override public int update() { session.getUser().checkAdmin(); session.commit(true); Database db = session.getDatabase(); FunctionAlias functionAlias = getSchema().findFunction(aliasName); if (functionAlias == null) { if (!ifExists) { throw DbException.get(ErrorCode.FUNCTION_ALIAS_NOT_FOUND_1, aliasName); } } else { db.removeSchemaObject(session, functionAlias); } return 0; }
@Override public int update() { session.commit(true); session.getUser().checkAdmin(); TableSynonym synonym = getSchema().getSynonym(synonymName); if (synonym == null) { if (!ifExists) { throw DbException.get(ErrorCode.TABLE_OR_VIEW_NOT_FOUND_1, synonymName); } } else { session.getDatabase().removeSchemaObject(session, synonym); } return 0; }
@Override public int update() { session.getUser().checkAdmin(); session.commit(true); Database db = session.getDatabase(); Constant constant = getSchema().findConstant(constantName); if (constant == null) { if (!ifExists) { throw DbException.get(ErrorCode.CONSTANT_NOT_FOUND_1, constantName); } } else { db.removeSchemaObject(session, constant); } return 0; }
@Override public void truncate(Session session) { if (trace.isDebugEnabled()) { trace.debug("{0} truncate", this); } store.logTruncate(session, tableData.getId()); removeAllRows(); if (tableData.getContainsLargeObject() && tableData.isPersistData()) { // unfortunately, the data is gone on rollback session.commit(false); database.getLobStorage().removeAllForTable(table.getId()); } if (multiVersion) { sessionRowCount.clear(); } tableData.setRowCount(0); }
@Override public int update() { session.commit(true); Database db = session.getDatabase(); TriggerObject trigger = getSchema().findTrigger(triggerName); if (trigger == null) { if (!ifExists) { throw DbException.get(ErrorCode.TRIGGER_NOT_FOUND_1, triggerName); } } else { Table table = trigger.getTable(); session.getUser().checkRight(table, Right.ALL); db.removeSchemaObject(session, trigger); } return 0; }
@Override public int update() { session.commit(true); session.getUser().checkAdmin(); Database db = session.getDatabase(); if (db.findAggregate(name) != null || schema.findFunction(name) != null) { if (!ifNotExists) { throw DbException.get( ErrorCode.FUNCTION_ALIAS_ALREADY_EXISTS_1, name); } } else { int id = getObjectId(); UserAggregate aggregate = new UserAggregate( db, id, name, javaClassMethod, force); db.addDatabaseObject(session, aggregate); } return 0; }
@Override public int update() { session.getUser().checkAdmin(); session.commit(true); Database db = session.getDatabase(); Sequence sequence = getSchema().findSequence(sequenceName); if (sequence == null) { if (!ifExists) { throw DbException.get(ErrorCode.SEQUENCE_NOT_FOUND_1, sequenceName); } } else { if (sequence.getBelongsToTable()) { throw DbException.get(ErrorCode.SEQUENCE_BELONGS_TO_A_TABLE_1, sequenceName); } db.removeSchemaObject(session, sequence); } return 0; }
@Override public int update() { session.commit(true); Constraint constraint = getSchema().findConstraint(session, constraintName); if (constraint == null) { throw DbException.get(ErrorCode.CONSTRAINT_NOT_FOUND_1, constraintName); } if (getSchema().findConstraint(session, newConstraintName) != null || newConstraintName.equals(constraintName)) { throw DbException.get(ErrorCode.CONSTRAINT_ALREADY_EXISTS_1, newConstraintName); } session.getUser().checkRight(constraint.getTable(), Right.ALL); session.getUser().checkRight(constraint.getRefTable(), Right.ALL); session.getDatabase().renameSchemaObject(session, constraint, newConstraintName); return 0; }
@Override public int update() { if (!transactional) { session.commit(true); } session.getUser().checkAdmin(); Database db = session.getDatabase(); data.session = session; db.lockMeta(session); if (data.synonymForSchema.findTableOrView(session, data.synonymName) != null) { throw DbException.get(ErrorCode.TABLE_OR_VIEW_ALREADY_EXISTS_1, data.synonymName); } if (data.synonymForSchema.findTableOrView(session, data.synonymFor) != null) { return createTableSynonym(db); } throw DbException.get(ErrorCode.TABLE_OR_VIEW_NOT_FOUND_1, data.synonymForSchema.getName() + "." + data.synonymFor); }
@Override public int update() { session.commit(true); Constraint constraint = getSchema().findConstraint(session, constraintName); if (constraint == null) { if (!ifExists) { throw DbException.get(ErrorCode.CONSTRAINT_NOT_FOUND_1, constraintName); } } else { session.getUser().checkRight(constraint.getTable(), Right.ALL); session.getUser().checkRight(constraint.getRefTable(), Right.ALL); session.getDatabase().removeSchemaObject(session, constraint); } return 0; }