protected AstNode parseCreateStatement ( DdlTokenStream tokens , AstNode parentNode ) throws ParsingException { assert tokens != null ; assert parentNode != null ; AstNode stmtNode = null ; // DEFAULT DOES NOTHING // Subclasses can implement additional parsing // System.out.println(" >>> FOUND [CREATE] STATEMENT: TOKEN = " + tokens.consume() + " " + tokens.consume() + " " + // tokens.consume()); // SQL 92 CREATE OPTIONS: // CREATE SCHEMA // CREATE DOMAIN // CREATE [ { GLOBAL | LOCAL } TEMPORARY ] TABLE // CREATE VIEW // CREATE ASSERTION // CREATE CHARACTER SET // CREATE COLLATION // CREATE TRANSLATION if ( tokens . matches ( STMT_CREATE_SCHEMA ) ) { stmtNode = parseCreateSchemaStatement ( tokens , parentNode ) ; } else if ( tokens . matches ( STMT_CREATE_TABLE ) || tokens . matches ( STMT_CREATE_GLOBAL_TEMPORARY_TABLE ) || tokens . matches ( STMT_CREATE_LOCAL_TEMPORARY_TABLE ) ) { stmtNode = parseCreateTableStatement ( tokens , parentNode ) ; } else if ( tokens . matches ( STMT_CREATE_VIEW ) || tokens . matches ( STMT_CREATE_OR_REPLACE_VIEW ) ) { stmtNode = parseCreateViewStatement ( tokens , parentNode ) ; } else if ( tokens . matches ( STMT_CREATE_ASSERTION ) ) { stmtNode = parseCreateAssertionStatement ( tokens , parentNode ) ; } else if ( tokens . matches ( STMT_CREATE_CHARACTER_SET ) ) { stmtNode = parseCreateCharacterSetStatement ( tokens , parentNode ) ; } else if ( tokens . matches ( STMT_CREATE_COLLATION ) ) { stmtNode = parseCreateCollationStatement ( tokens , parentNode ) ; } else if ( tokens . matches ( STMT_CREATE_TRANSLATION ) ) { stmtNode = parseCreateTranslationStatement ( tokens , parentNode ) ; } else if ( tokens . matches ( STMT_CREATE_DOMAIN ) ) { stmtNode = parseCreateDomainStatement ( tokens , parentNode ) ; } else { markStartOfStatement ( tokens ) ; stmtNode = parseIgnorableStatement ( tokens , "CREATE UNKNOWN" , parentNode ) ; Position position = getCurrentMarkedPosition ( ) ; String msg = DdlSequencerI18n . unknownCreateStatement . text ( position . getLine ( ) , position . getColumn ( ) ) ; DdlParserProblem problem = new DdlParserProblem ( DdlConstants . Problems . WARNING , position , msg ) ; stmtNode . setProperty ( DDL_PROBLEM , problem . toString ( ) ) ; markEndOfStatement ( tokens , stmtNode ) ; } return stmtNode ; }
Parses DDL CREATE statement based on SQL 92 specifications .