database.addSchemaObject(ses, idx); database.addSchemaObject(ses, cloneIdx);
db.addSchemaObject(targetSession, recursiveTable);
Sequence seq = new Sequence(schema, id, sequenceName, start, increment); seq.setTemporary(temporary); session.getDatabase().addSchemaObject(session, seq); setAutoIncrement(false, 0, 0); SequenceValue seqValue = new SequenceValue(seq);
db.addSchemaObject(session, view); view.lock(session, true, true); session.getDatabase().removeSchemaObject(session, view);
if (!view.isRecursiveQueryDetected() && allowRecursiveQueryDetection) { if (isPersistent) { db.addSchemaObject(targetSession, view); view.lock(targetSession, true, true); targetSession.getDatabase().removeSchemaObject(targetSession, view); if (addViewToSession) { if (isPersistent) { db.addSchemaObject(targetSession, view); view.unlock(targetSession); db.unlockMeta(targetSession);
@Override public int update() { session.commit(true); session.getUser().checkAdmin(); Database db = session.getDatabase(); if (getSchema().findConstant(constantName) != null) { if (ifNotExists) { return 0; } throw DbException.get(ErrorCode.CONSTANT_ALREADY_EXISTS_1, constantName); } int id = getObjectId(); Constant constant = new Constant(getSchema(), id, constantName); expression = expression.optimize(session); Value value = expression.getValue(session); constant.setValue(value); db.addSchemaObject(session, constant); return 0; }
@Override public int update() { session.commit(true); Database db = session.getDatabase(); if (getSchema().findSequence(sequenceName) != null) { if (ifNotExists) { return 0; } throw DbException.get(ErrorCode.SEQUENCE_ALREADY_EXISTS_1, sequenceName); } int id = getObjectId(); Long startValue = getLong(start); Long inc = getLong(increment); Long cache = getLong(cacheSize); Long min = getLong(minValue); Long max = getLong(maxValue); Sequence sequence = new Sequence(getSchema(), id, sequenceName, startValue, inc, cache, min, max, cycle, belongsToTable); db.addSchemaObject(session, sequence); return 0; }
@Override public int update() { session.commit(true); session.getUser().checkAdmin(); Database db = session.getDatabase(); if (getSchema().findFunction(aliasName) != null) { if (!ifNotExists) { throw DbException.get( ErrorCode.FUNCTION_ALIAS_ALREADY_EXISTS_1, aliasName); } } else { int id = getObjectId(); FunctionAlias functionAlias; if (javaClassMethod != null) { functionAlias = FunctionAlias.newInstance(getSchema(), id, aliasName, javaClassMethod, force, bufferResultSetToLocalTemp); } else { functionAlias = FunctionAlias.newInstanceFromSource( getSchema(), id, aliasName, source, force, bufferResultSetToLocalTemp); } functionAlias.setDeterministic(deterministic); db.addSchemaObject(session, functionAlias); } return 0; }
private int createTableSynonym(Database db) { TableSynonym old = getSchema().getSynonym(data.synonymName); if (old != null) { if (orReplace) { // ok, we replacing the existing synonym } else if (ifNotExists) { return 0; } else { throw DbException.get(ErrorCode.TABLE_OR_VIEW_ALREADY_EXISTS_1, data.synonymName); } } TableSynonym table; if (old != null) { table = old; data.schema = table.getSchema(); table.updateData(data); table.setComment(comment); table.setModified(); db.updateMeta(session, table); } else { data.id = getObjectId(); table = getSchema().createSynonym(data); table.setComment(comment); db.addSchemaObject(session, table); } table.updateSynonymFor(); return 0; }
@Override public int update() { session.commit(true); Database db = session.getDatabase(); session.getUser().checkAdmin(); if (getSchema().resolveTableOrView(session, tableName) != null) { if (ifNotExists) { return 0; } throw DbException.get(ErrorCode.TABLE_OR_VIEW_ALREADY_EXISTS_1, tableName); } int id = getObjectId(); TableLink table = getSchema().createTableLink(id, tableName, driver, url, user, password, originalSchema, originalTable, emitUpdates, force); table.setTemporary(temporary); table.setGlobalTemporary(globalTemporary); table.setComment(comment); table.setReadOnly(readOnly); if (temporary && !globalTemporary) { session.addLocalTempTable(table); } else { db.addSchemaObject(session, table); } return 0; }
db.addSchemaObject(session, view); db.unlockMeta(session); } else {
} else { db.lockMeta(session); db.addSchemaObject(session, table);
session.addLocalTempTableIndex(index); } else { database.addSchemaObject(session, index);
trigger.setTriggerSource(triggerSource, force); db.addSchemaObject(session, trigger); table.addTrigger(trigger); return 0;
session.addLocalTempTableIndex(index); } else { database.addSchemaObject(session, index);
session.addLocalTempTableConstraint(constraint); } else { db.addSchemaObject(session, constraint);
public int update() throws SQLException { session.commit(true); Database db = session.getDatabase(); session.getUser().checkAdmin(); if (getSchema().findTableOrView(session, tableName) != null) { if (ifNotExists) { return 0; } throw Message.getSQLException(ErrorCode.TABLE_OR_VIEW_ALREADY_EXISTS_1, tableName); } int id = getObjectId(false, true); TableLink table = getSchema().createTableLink(id, tableName, driver, url, user, password, originalTable, emitUpdates, force); table.setComment(comment); db.addSchemaObject(session, table); return 0; }
public int update() throws SQLException { session.commit(true); session.getUser().checkAdmin(); Database db = session.getDatabase(); if (getSchema().findConstant(constantName) != null) { if (ifNotExists) { return 0; } throw Message.getSQLException(ErrorCode.CONSTANT_ALREADY_EXISTS_1, constantName); } int id = getObjectId(false, true); Constant constant = new Constant(getSchema(), id, constantName); expression = expression.optimize(session); Value value = expression.getValue(session); constant.setValue(value); db.addSchemaObject(session, constant); return 0; }
@Override public int update() { session.commit(true); session.getUser().checkAdmin(); Database db = session.getDatabase(); if (getSchema().findConstant(constantName) != null) { if (ifNotExists) { return 0; } throw DbException.get(ErrorCode.CONSTANT_ALREADY_EXISTS_1, constantName); } int id = getObjectId(); Constant constant = new Constant(getSchema(), id, constantName); expression = expression.optimize(session); Value value = expression.getValue(session); constant.setValue(value); db.addSchemaObject(session, constant); return 0; }
public int update() throws SQLException { session.commit(true); Database db = session.getDatabase(); if (getSchema().findSequence(sequenceName) != null) { if (ifNotExists) { return 0; } throw Message.getSQLException(ErrorCode.SEQUENCE_ALREADY_EXISTS_1, sequenceName); } int id = getObjectId(false, true); Sequence sequence = new Sequence(getSchema(), id, sequenceName, belongsToTable); sequence.setStartValue(getLong(start, 1)); sequence.setIncrement(getLong(increment, 1)); sequence.setCacheSize(getLong(cacheSize, Sequence.DEFAULT_CACHE_SIZE)); db.addSchemaObject(session, sequence); return 0; }