private TransactionCommand parseSavepoint() { TransactionCommand command = new TransactionCommand(session, CommandInterface.SAVEPOINT); command.setSavepointName(readUniqueIdentifier()); return command; }
private Prepared parseReleaseSavepoint() { TransactionCommand command = new TransactionCommand(session, CommandInterface.RELEASE_SAVEPOINT); readIf("SAVEPOINT"); command.setSavepointName(readUniqueIdentifier()); return command; }
private CreateRole parseCreateRole() { CreateRole command = new CreateRole(session); command.setIfNotExists(readIfNotExists()); command.setRoleName(readUniqueIdentifier()); return command; }
private CreateSchema parseCreateSchema() { CreateSchema command = new CreateSchema(session); command.setIfNotExists(readIfNotExists()); command.setSchemaName(readUniqueIdentifier()); if (readIf("AUTHORIZATION")) { command.setAuthorization(readUniqueIdentifier()); } else { command.setAuthorization(session.getUser().getName()); } 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; }
private TransactionCommand parseCommit() { TransactionCommand command; if (readIf("TRANSACTION")) { command = new TransactionCommand(session, CommandInterface.COMMIT_TRANSACTION); command.setTransactionName(readUniqueIdentifier()); return command; } command = new TransactionCommand(session, CommandInterface.COMMIT); readIf("WORK"); return command; }
private TransactionCommand parseRollback() { TransactionCommand command; if (readIf("TRANSACTION")) { command = new TransactionCommand(session, CommandInterface.ROLLBACK_TRANSACTION); command.setTransactionName(readUniqueIdentifier()); return command; } if (readIf("TO")) { read("SAVEPOINT"); command = new TransactionCommand(session, CommandInterface.ROLLBACK_TO_SAVEPOINT); command.setSavepointName(readUniqueIdentifier()); } else { readIf("WORK"); command = new TransactionCommand(session, CommandInterface.ROLLBACK); } return command; }
schema = readUniqueIdentifier(); paramValues.add(ValueString.get(tableName)); if (readIf("FROM")) { schemaName = readUniqueIdentifier();
private Prepared parsePrepare() { if (readIf("COMMIT")) { TransactionCommand command = new TransactionCommand(session, CommandInterface.PREPARE_COMMIT); command.setTransactionName(readUniqueIdentifier()); return command; } readAliasIdentifier(); if (readIf("(")) { ArrayList<Column> list = New.arrayList(); for (int i = 0;; i++) { Column column = parseColumnForTable("C" + i, true); list.add(column); if (readIf(")")) { break; } read(","); } } read("AS"); parsePrepared(); return new NoOperation(session); }
private CreateUserDataType parseCreateUserDataType() { boolean ifNotExists = readIfNotExists(); CreateUserDataType command = new CreateUserDataType(session); command.setTypeName(readUniqueIdentifier()); read("AS"); Column col = parseColumnForTable("VALUE", true); if (readIf("CHECK")) { Expression expr = readExpression(); col.addCheckConstraint(session, expr); } col.rename(null); command.setColumn(col); command.setIfNotExists(ifNotExists); return command; }
private CreateAggregate parseCreateAggregate(boolean force) { boolean ifNotExists = readIfNotExists(); CreateAggregate command = new CreateAggregate(session); command.setForce(force); String name = readIdentifierWithSchema(); if (isKeyword(name) || Function.getFunction(database, name) != null || getAggregateType(name) >= 0) { throw DbException.get(ErrorCode.FUNCTION_ALIAS_ALREADY_EXISTS_1, name); } command.setName(name); command.setSchema(getSchema()); command.setIfNotExists(ifNotExists); read("FOR"); command.setJavaClassMethod(readUniqueIdentifier()); return command; }
private AlterUser parseAlterUser() { String userName = readUniqueIdentifier(); if (readIf("SET")) { AlterUser command = new AlterUser(session); command.setType(CommandInterface.ALTER_USER_RENAME); command.setUser(database.getUser(userName)); String newName = readUniqueIdentifier(); command.setNewName(newName); return command;
private CreateUser parseCreateUser() { CreateUser command = new CreateUser(session); command.setIfNotExists(readIfNotExists()); command.setUserName(readUniqueIdentifier()); command.setComment(readCommentIf()); if (readIf("PASSWORD")) { command.setPassword(readExpression()); } else if (readIf("SALT")) { command.setSalt(readExpression()); read("HASH"); command.setHash(readExpression()); } else if (readIf("IDENTIFIED")) { read("BY"); // uppercase if not quoted command.setPassword(ValueExpression.get(ValueString .get(readColumnIdentifier()))); } else { throw getSyntaxError(); } if (readIf("ADMIN")) { command.setAdmin(true); } return command; }
if (readIf("=")) { String tableEngine = readUniqueIdentifier(); if ("InnoDb".equalsIgnoreCase(tableEngine)) { command.setTableEngine("InnoDb"); command.setTableEngine(readUniqueIdentifier()); if (readIf("WITH")) { ArrayList<String> tableEngineParams = New.arrayList(); do { tableEngineParams.add(readUniqueIdentifier()); } while (readIf(",")); command.setTableEngineParams(tableEngineParams); read("="); String charset = StringUtils.toLowerEnglish(readUniqueIdentifier()); command.setCharset(charset);
boolean ifExists = readIfExists(false); DropUser command = new DropUser(session); command.setUserName(readUniqueIdentifier()); ifExists = readIfExists(ifExists); readIf("CASCADE"); boolean ifExists = readIfExists(false); DropRole command = new DropRole(session); command.setRoleName(readUniqueIdentifier()); ifExists = readIfExists(ifExists); command.setIfExists(ifExists); boolean ifExists = readIfExists(false); DropSchema command = new DropSchema(session); command.setSchemaName(readUniqueIdentifier()); ifExists = readIfExists(ifExists); command.setIfExists(ifExists);
command.setTableName(tableName); if (!readIf("(")) { command.setIndexName(readUniqueIdentifier()); read("("); command.setType(CommandInterface.ALTER_TABLE_ADD_CONSTRAINT_UNIQUE); if (!readIf("(")) { constraintName = readUniqueIdentifier(); read("(");