Search in sources :

Example 1 with CreateUser

use of org.h2.command.ddl.CreateUser in project h2database by h2database.

the class Parser method parseCreateUser.

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;
}
Also used : CreateUser(org.h2.command.ddl.CreateUser)

Aggregations

CreateUser (org.h2.command.ddl.CreateUser)1