class CreateDatabase extends DatabaseStatement {

    private final boolean ifNotExists;

    public CreateDatabase(ServerSession session, String dbName, boolean ifNotExists, RunMode runMode,
            CaseInsensitiveMap<String> parameters) {
        super(session, dbName);
        if (parameters == null)
            parameters = new CaseInsensitiveMap<>();
        this.ifNotExists = ifNotExists;
        this.parameters = parameters;
        validateParameters();
    }

    @Override
    public int getType() {
        return SQLStatement.CREATE_DATABASE;
    }

    @Override
    public int update() {<FILL_FUNCTION_BODY>}
}

        LealoneDatabase.checkAdminRight(session, "create database");
        LealoneDatabase lealoneDB = LealoneDatabase.getInstance();
        DbObjectLock lock = lealoneDB.tryExclusiveDatabaseLock(session);
        if (lock == null)
            return -1;

        if (LealoneDatabase.isMe(dbName) || lealoneDB.findDatabase(dbName) != null) {
            if (ifNotExists) {
                return 0;
            }
            throw DbException.get(ErrorCode.DATABASE_ALREADY_EXISTS_1, dbName);
        }
        // 设置默认SQL引擎
        if (!parameters.containsKey(DbSetting.DEFAULT_SQL_ENGINE.name())) {
            Mode mode = session.getDatabase().getMode();
            if (mode.isMySQL()) {
                parameters.put(DbSetting.DEFAULT_SQL_ENGINE.name(), mode.getName());
            }
        }
        int id = getObjectId(lealoneDB);
        Database newDB = new Database(id, dbName, parameters);
        newDB.setRunMode(RunMode.CLIENT_SERVER);
        lealoneDB.addDatabaseObject(session, newDB, lock);
        // 将缓存过期掉
        lealoneDB.getNextModificationMetaId();

        // LealoneDatabase在启动过程中执行CREATE DATABASE时，不对数据库初始化
        if (!lealoneDB.isStarting()) {
            newDB.init();
            newDB.createRootUserIfNotExists();
        }
        return 0;
    
<methods>public java.lang.String getDatabaseName() ,public boolean isDatabaseStatement() <variables>protected final non-sealed java.lang.String dbName,protected CaseInsensitiveMap<java.lang.String> parameters