use of org.h2.command.ddl.CreateFunctionAlias in project h2database by h2database.
the class Parser method parseCreateFunctionAlias.
private CreateFunctionAlias parseCreateFunctionAlias(boolean force) {
boolean ifNotExists = readIfNotExists();
String aliasName = readIdentifierWithSchema();
final boolean newAliasSameNameAsBuiltin = Function.getFunction(database, aliasName) != null;
if (database.isAllowBuiltinAliasOverride() && newAliasSameNameAsBuiltin) {
// fine
} else if (isKeyword(aliasName) || newAliasSameNameAsBuiltin || getAggregateType(aliasName) != null) {
throw DbException.get(ErrorCode.FUNCTION_ALIAS_ALREADY_EXISTS_1, aliasName);
}
CreateFunctionAlias command = new CreateFunctionAlias(session, getSchema());
command.setForce(force);
command.setAliasName(aliasName);
command.setIfNotExists(ifNotExists);
command.setDeterministic(readIf("DETERMINISTIC"));
command.setBufferResultSetToLocalTemp(!readIf("NOBUFFER"));
if (readIf("AS")) {
command.setSource(readString());
} else {
read("FOR");
command.setJavaClassMethod(readUniqueIdentifier());
}
return command;
}
Aggregations