Package org.lealone.command.ddl

Examples of org.lealone.command.ddl.CreateTable


            // (...) not logged
            schemaName = session.getCurrentSchemaName();
            globalTemp = false;
        }
        Schema schema = getSchema();
        CreateTable command = createTable(session, schema);
        command.setPersistIndexes(persistIndexes);
        command.setTemporary(temp);
        command.setGlobalTemporary(globalTemp);
        command.setIfNotExists(ifNotExists);
        command.setTableName(tableName);
        command.setComment(readCommentIf());
        command.setDynamicTable(dynamicTable);
        if (readIf("(")) {
            if (!readIf(")")) {
                parseTableDefinition(schema, command, tableName);
            }
        }
        if (readIf("ENGINE")) {
            if (readIf("=")) {
                // map MySQL engine types onto H2 behavior
                String tableEngine = readUniqueIdentifier();
                if ("InnoDb".equalsIgnoreCase(tableEngine)) {
                    // ok
                } else if (!"MyISAM".equalsIgnoreCase(tableEngine)) {
                    throw DbException.get(ErrorCode.FEATURE_NOT_SUPPORTED_1, tableEngine);
                }
            } else {
                command.setTableEngine(readUniqueIdentifier());
            }
        } else if (database.getSettings().defaultTableEngine != null) {
            command.setTableEngine(database.getSettings().defaultTableEngine);
        }
        if (readIf("CHARSET")) {
            read("=");
            read("UTF8");
        }
        if (temp) {
            if (readIf("ON")) {
                read("COMMIT");
                if (readIf("DROP")) {
                    command.setOnCommitDrop();
                } else if (readIf("DELETE")) {
                    read("ROWS");
                    command.setOnCommitTruncate();
                }
            } else if (readIf("NOT")) {
                if (readIf("PERSISTENT")) {
                    command.setPersistData(false);
                } else {
                    read("LOGGED");
                }
            }
            if (readIf("TRANSACTIONAL")) {
                command.setTransactional(true);
            }
        } else if (!persistIndexes && readIf("NOT")) {
            read("PERSISTENT");
            command.setPersistData(false);
        }
        if (readIf("HIDDEN")) {
            command.setHidden(true);
        }
        if (readIf("AS")) {
            if (readIf("SORTED")) {
                command.setSortedInsertMode(true);
            }
            command.setQuery(parseSelect());
        }
        return command;
    }
View Full Code Here


    public Command createCommand(Prepared p, String sql) {
        return new CommandContainer(this, sql, p);
    }

    public CreateTable createTable(Session session, Schema schema) {
        return new CreateTable(session, schema);
    }
View Full Code Here

TOP

Related Classes of org.lealone.command.ddl.CreateTable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.