📄 sqlgrammar.jj
字号:
"\u0559", "\u0561" - "\u0587", "\u05d0" - "\u05ea", "\u05f0" - "\u05f2", "\u0621" - "\u063a", "\u0640" - "\u064a", "\u0671" - "\u06b7", "\u06ba" - "\u06be", "\u06c0" - "\u06ce", "\u06d0" - "\u06d3", "\u06d5", "\u06e5" - "\u06e6", "\u0905" - "\u0939", "\u093d", "\u0958" - "\u0961", "\u0985" - "\u098c", "\u098f" - "\u0990", "\u0993" - "\u09a8", "\u09aa" - "\u09b0", "\u09b2", "\u09b6" - "\u09b9", "\u09dc" - "\u09dd", "\u09df" - "\u09e1", "\u09f0" - "\u09f1", "\u0a05" - "\u0a0a", "\u0a0f" - "\u0a10", "\u0a13" - "\u0a28", "\u0a2a" - "\u0a30", "\u0a32" - "\u0a33", "\u0a35" - "\u0a36", "\u0a38" - "\u0a39", "\u0a59" - "\u0a5c", "\u0a5e", "\u0a72" - "\u0a74", "\u0a85" - "\u0a8b", "\u0a8d", "\u0a8f" - "\u0a91", "\u0a93" - "\u0aa8", "\u0aaa" - "\u0ab0", "\u0ab2" - "\u0ab3", "\u0ab5" - "\u0ab9", "\u0abd", "\u0ae0", "\u0b05" - "\u0b0c", "\u0b0f" - "\u0b10", "\u0b13" - "\u0b28", "\u0b2a" - "\u0b30", "\u0b32" - "\u0b33", "\u0b36" - "\u0b39", "\u0b3d", "\u0b5c" - "\u0b5d", "\u0b5f" - "\u0b61", "\u0b85" - "\u0b8a", "\u0b8e" - "\u0b90", "\u0b92" - "\u0b95", "\u0b99" - "\u0b9a", "\u0b9c", "\u0b9e" - "\u0b9f", "\u0ba3" - "\u0ba4", "\u0ba8" - "\u0baa", "\u0bae" - "\u0bb5", "\u0bb7" - "\u0bb9", "\u0c05" - "\u0c0c", "\u0c0e" - "\u0c10", "\u0c12" - "\u0c28", "\u0c2a" - "\u0c33", "\u0c35" - "\u0c39", "\u0c60" - "\u0c61", "\u0c85" - "\u0c8c", "\u0c8e" - "\u0c90", "\u0c92" - "\u0ca8", "\u0caa" - "\u0cb3", "\u0cb5" - "\u0cb9", "\u0cde", "\u0ce0" - "\u0ce1", "\u0d05" - "\u0d0c", "\u0d0e" - "\u0d10", "\u0d12" - "\u0d28", "\u0d2a" - "\u0d39", "\u0d60" - "\u0d61", "\u0e01" - "\u0e2e", "\u0e30", "\u0e32" - "\u0e33", "\u0e40" - "\u0e46", "\u0e81" - "\u0e82", "\u0e84", "\u0e87" - "\u0e88", "\u0e8a", "\u0e8d", "\u0e94" - "\u0e97", "\u0e99" - "\u0e9f", "\u0ea1" - "\u0ea3", "\u0ea5", "\u0ea7", "\u0eaa" - "\u0eab", "\u0ead" - "\u0eae", "\u0eb0", "\u0eb2" - "\u0eb3", "\u0ebd", "\u0ec0" - "\u0ec4", "\u0ec6", "\u0edc" - "\u0edd", "\u0f40" - "\u0f47", "\u0f49" - "\u0f69", "\u10a0" - "\u10c5", "\u10d0" - "\u10f6", "\u1100" - "\u1159", "\u115f" - "\u11a2", "\u11a8" - "\u11f9", "\u1e00" - "\u1e9b", "\u1ea0" - "\u1ef9", "\u1f00" - "\u1f15", "\u1f18" - "\u1f1d", "\u1f20" - "\u1f45", "\u1f48" - "\u1f4d", "\u1f50" - "\u1f57", "\u1f59", "\u1f5b", "\u1f5d", "\u1f5f" - "\u1f7d", "\u1f80" - "\u1fb4", "\u1fb6" - "\u1fbc", "\u1fbe", "\u1fc2" - "\u1fc4", "\u1fc6" - "\u1fcc", "\u1fd0" - "\u1fd3", "\u1fd6" - "\u1fdb", "\u1fe0" - "\u1fec", "\u1ff2" - "\u1ff4", "\u1ff6" - "\u1ffc", "\u207f", "\u2102", "\u2107", "\u210a" - "\u2113", "\u2115", "\u2118" - "\u211d", "\u2124", "\u2126", "\u2128", "\u212a" - "\u2131", "\u2133" - "\u2138", "\u3005", "\u3031" - "\u3035", "\u3041" - "\u3094", "\u309b" - "\u309e", "\u30a1" - "\u30fa", "\u30fc" - "\u30fe", "\u3105" - "\u312c", "\u3131" - "\u318e", "\u4e00" - "\u9fa5", "\uac00" - "\ud7a3", "\uf900" - "\ufa2d", "\ufb00" - "\ufb06", "\ufb13" - "\ufb17", "\ufb1f" - "\ufb28", "\ufb2a" - "\ufb36", "\ufb38" - "\ufb3c", "\ufb3e", "\ufb40" - "\ufb41", "\ufb43" - "\ufb44", "\ufb46" - "\ufbb1", "\ufbd3" - "\ufd3d", "\ufd50" - "\ufd8f", "\ufd92" - "\ufdc7", "\ufdf0" - "\ufdfb", "\ufe70" - "\ufe72", "\ufe74", "\ufe76" - "\ufefc", "\uff21" - "\uff3a", "\uff41" - "\uff5a", "\uff66" - "\uffbe", "\uffc2" - "\uffc7", "\uffca" - "\uffcf", "\uffd2" - "\uffd7", "\uffda" - "\uffdc" ]>}TOKEN :{ <#DIGIT: [ "0" - "9", "\u0660" - "\u0669", "\u06f0" - "\u06f9", "\u0966" - "\u096f", "\u09e6" - "\u09ef", "\u0a66" - "\u0a6f", "\u0ae6" - "\u0aef", "\u0b66" - "\u0b6f", "\u0be7" - "\u0bef", "\u0c66" - "\u0c6f", "\u0ce6" - "\u0cef", "\u0d66" - "\u0d6f", "\u0e50" - "\u0e59", "\u0ed0" - "\u0ed9", "\u0f20" - "\u0f29", "\uff10" - "\uff19" ]>}TOKEN :{ /* Delimited Identifiers - NOTE: this does not allow zero-length identifiers */ <DELIMITED_IDENTIFIER: "\"" ( ("\"\"") | (~["\""]) ) + "\"">}TOKEN :{ /* Literals */ <EXACT_NUMERIC: ( <UINT> ( "." ( <UINT> )? )? | "." <UINT> )>| <UINT: (["0" - "9"])+ >/* This is for an unsigned exact numeric */| <LENGTH_MODIFIER: ( <UINT> ["K","M","G","k","m","g"] )>| <STRING: "'" ( "''" | ~["'"] ) * "'">| <HEX_STRING: ["X","x"] "'" (["0"-"9","a"-"f","A"-"F"])*"'"> /* RESOLVE: does not allow separators */| <APPROXIMATE_NUMERIC: <EXACT_NUMERIC> ["e","E"] ( ("+" | "-") )? ( ["0" - "9"] )+ >/***** The tokenizer can't handle the date/time literals because they are constructed of two tokens with arbitrary whitespace between them. INTERVAL_LITERAL will also have to be upgraded at some point.| <DATE_LITERAL: "DATE" "'" <DATE_VALUE> "'" >| <#DATE_VALUE: <UINT> "-" <UINT> "-" <UINT> >| <TIME_LITERAL: "TIME" "'" <TIME_VALUE> ( <TIMEZONE_INTERVAL> ) ? "'" >| <#TIME_VALUE: <UINT> ":" <UINT> ":" <SECONDS_VALUE> >| <#TIMEZONE_INTERVAL: ("+" | "-") <UINT> ":" <UINT> >| <TIMESTAMP_LITERAL: "TIMESTAMP" "'" <DATE_VALUE> " " <TIME_VALUE> ( <TIMEZONE_INTERVAL> ) ? "'" >*****/| <INTERVAL_LITERAL: "INTERVAL" "'" (["+","-"])? <INTERVAL_STRING> <INTERVAL_QUALIFIER> >| <#INTERVAL_STRING: "'" ( <YEAR_MONTH_LITERAL> | <DAY_TIME_LITERAL> ) "'" >| <#INTERVAL_QUALIFIER: <SINGLE_DATETIME_FIELD> | ( <START_FIELD> <TO> <END_FIELD> ) >| <#SINGLE_DATETIME_FIELD: <NON_SECOND_DATETIME_FIELD> ( <LEFT_PAREN> <UINT> <RIGHT_PAREN> ) ? >| <#START_FIELD: <NON_SECOND_DATETIME_FIELD> ( <LEFT_PAREN> <UINT> <RIGHT_PAREN> ) ? >| <#END_FIELD: <NON_SECOND_DATETIME_FIELD> >| <#NON_SECOND_DATETIME_FIELD: <YEAR> | <MONTH> | <DAY> | <HOUR> | <MINUTE> >| <#YEAR_MONTH_LITERAL: (<UINT> | ( <UINT> "-" ) )? <UINT> >| <#DAY_TIME_LITERAL: ( <DAY_TIME_INTERVAL> | <TIME_INTERVAL> ) >| <#DAY_TIME_INTERVAL: <UINT> ( " " <UINT> ( ":" <UINT> ( ":" <SECONDS_VALUE> ) ? ) ? ) ? >| <#SECONDS_VALUE: <UINT> ( "." ( <UINT> ) ? ) ? >| <#TIME_INTERVAL: <UINT> ( ":" <UINT> ( ":" <SECONDS_VALUE> ) ? ) ? | <UINT> ( ":" <SECONDS_VALUE> ) ? | <SECONDS_VALUE> >}/* * <A NAME="Statement">Statement</A> */QueryTreeNodeStatement( String statementSQLText, Object[] paramDefaults) throws StandardException :{ QueryTreeNode statementNode; initStatement(statementSQLText, paramDefaults);}{ statementNode = StatementPart(null) <EOF> { return statementNode; }}QueryTreeNode proceduralStatement(Token[] tokenHolder) throws StandardException : { QueryTreeNode statementNode; tokenHolder[0] = getToken(1);} { ( statementNode = insertStatement()| statementNode = preparableUpdateStatement()| statementNode = preparableDeleteStatement()| statementNode = preparableSelectStatement(true) ) { return statementNode; } }/* * <A NAME="StatementPart">StatementPart</A> * * @param tokenHolder returns the token that starts * the statement. If null, ignored. */QueryTreeNodeStatementPart(Token[] tokenHolder) throws StandardException :{ QueryTreeNode statementNode; //before starting new statements, initialize this variables. Otherwise, the left //over values from previously failed sql will affect the next sql. explicitNotNull = false; explicitNull = false; explicitlyNullableColumnsList = new Vector(); /* ** Grab the token preceding this production */ if (tokenHolder != null) { tokenHolder[0] = getToken(1); }}{ /* * The present method of invoking the parser is * via JDBC, which uses preparable SQL statements only. * the only place this makes a difference from other * flavors of SQL (direct SQL, embedded SQL, dynamic SQL) * is in the select and positioned update/delete statements, * and in whether transaction and connection statements are * allowed. * * When it becomes necessary to differentiate, we should * define a way to put the parser into different modes * (preparable SQL, dynamic SQL, direct SQL, embedded SQL, etc.) * and have it accept/reject statements based on the mode * it is in. */ ( statementNode = spsRenameStatement() | // statementNode = SQLTransactionStatement() | statementNode = lockStatement() ) { return statementNode; }| ( statementNode = createStatements() | statementNode = dropStatements() | statementNode = spsAlterStatement() | statementNode = globalTemporaryTableDeclaration() | statementNode = preparableSQLDataStatement() | statementNode = spsSetStatement() | statementNode = truncateTableStatement() | statementNode = execStatement() // statementNode = SQLTransactionStatement() ) { return statementNode; }}/* * <A NAME="createStatements">spsCreateStatement</A> */QueryTreeNodecreateStatements() throws StandardException :{ QueryTreeNode statementNode; Token beginToken; int tokKind;}{ beginToken = <CREATE> ( ( statementNode = schemaDefinition() | statementNode = viewDefinition(beginToken) | statementNode = triggerDefinition() | statementNode = synonymDefinition() ) { }| statementNode = tableDefinition() { }| statementNode = procedureDefinition()| statementNode = functionDefinition()| statementNode = indexDefinition() { } ) { return statementNode; }}/* * <A NAME="dropStatements">spsDropStatement</A> */QueryTreeNodedropStatements() throws StandardException :{ QueryTreeNode statementNode;}{ <DROP> ( statementNode = dropSchemaStatement() | statementNode = dropTableStatement() | statementNode = dropIndexStatement() | statementNode = dropAliasStatement() | statementNode = dropViewStatement() | statementNode = dropTriggerStatement() ) { return statementNode; }}/* * <A NAME="spsAlterStatement">spsAlterStatement</A> */QueryTreeNodespsAlterStatement() throws StandardException :{ QueryTreeNode statementNode;}{ <ALTER> ( statementNode = alterTableStatement() ) { return statementNode; }}/* * <A NAME="spsSetStatement">spsSetStatement</A> */QueryTreeNodespsSetStatement() throws StandardException :{ QueryTreeNode statementNode;}{ LOOKAHEAD ( { getToken(1).kind == SET && getToken(2).kind != CURRENT } ) <SET> ( statementNode = setIsolationStatement() | statementNode = setSchemaStatement() | statementNode = setMessageLocaleStatement() ) { return statementNode; }| LOOKAHEAD ( { getToken(1).kind == SET && getToken(2).kind == CURRENT } ) <SET> ( statementNode = setSchemaStatement() | statementNode = setIsolationStatement() ) { return statementNode; }} /* * <A NAME="preparableSQLDataStatement">preparableSQLDataStatement</A> * * preparableSQLDataStatement differs from * directSQLDataStatement in that it * supports positioned update and delete * and a preparable select (with FOR UPDATE) * instead of a direct select (without FOR UPDATE) */QueryTreeNodepreparableSQLDataStatement() throws StandardException :{ QueryTreeNode dmlStatement;}{ /* ** RESOLVE: Ignoring temporary table declarations for now. */ dmlStatement = preparableDeleteStatement() { return dmlStatement; }| dmlStatement = preparableSelectStatement(true) { return dmlStatement; }| dmlStatement = insertStatement() { return dmlStatement; }| dmlStatement = preparableUpdateStatement() { return dmlStatement; }| dmlStatement = callStatement() { return dmlStatement; }| dmlStatement = savepointStatement() { return dmlStatement; }}/* * <A NAME="preparableDeleteStatement">preparableDeleteStatement</A> * * This may be a search or positioned delete statem
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -