📄 sqlparser.java
字号:
int i = 3; int tokKind; do { tokKind = getToken(i).kind; // If we've found nothing but PERIODs until the EQUALS_OPERATOR // it is the beginning of another property list element. if (tokKind == EQUALS_OPERATOR) { retval = true; break; } i += 2; } while (tokKind == PERIOD); } return retval; } /** * Get one of the several types of create alias nodes. * * @param aliasName The name of the alias * @param fullStaticMethodName The full path/method name * @param aliasSpecificInfo Information specific to the type of alias being created. * @param aliasType The type of alias to create * @param delimitedIdentifier Whether or not to treat the class name * as a delimited identifier if trying to * resolve it as a class alias. * * @return A CreateAliasNode matching the given parameters * * @exception StandardException Thrown on error */ QueryTreeNode getCreateAliasNode( Object aliasName, String fullStaticMethodName, Object aliasSpecificInfo, char aliasType, Boolean delimitedIdentifier) throws StandardException { StatementNode aliasNode = (StatementNode) getNodeFactory().getCreateAliasNode ( aliasName, fullStaticMethodName, aliasSpecificInfo, aliasType, delimitedIdentifier, getContextManager() ); return aliasNode; } /** Create a node for the drop alias/procedure call. */ QueryTreeNode dropAliasNode(Object aliasName, char type) throws StandardException { StatementNode stmt = (StatementNode) nodeFactory.getNode( C_NodeTypes.DROP_ALIAS_NODE, aliasName, new Character(type), getContextManager()); return stmt; } /** * Get a substring node from * - the string * - the start position * - the length * - a boolean values for specifying the kind of substring function * @exception StandardException Thrown on error */ ValueNode getSubstringNode( ValueNode stringValue, ValueNode startPosition, ValueNode length, Boolean boolVal ) throws StandardException { return (ValueNode) nodeFactory.getNode( C_NodeTypes.SUBSTRING_OPERATOR_NODE, stringValue, startPosition, length, ReuseFactory.getInteger(TernaryOperatorNode.SUBSTRING), null, getContextManager()); } final public TableName qualifiedName(int id_length_limit) throws ParseException, StandardException { return qualifiedName( C_NodeTypes.TABLE_NAME, id_length_limit); } private void initStatement( String statementSQLText, Object[] paramDefaults) throws StandardException { /* Do per-statement initialization here */ parameterNumber = 0; stringSlicer = null; this.statementSQLText = statementSQLText; this.paramDefaults = paramDefaults; nodeFactory = getNodeFactory(); initUnnamedParameterList(); } // End of initStatement private void checkIdentifierLengthLimit( String identifier, int identifier_length_limit) throws StandardException { if (identifier.length() > identifier_length_limit) throw StandardException.newException(SQLState.LANG_IDENTIFIER_TOO_LONG, identifier, String.valueOf(identifier_length_limit)); } private ValueNode getJdbcIntervalNode( int intervalType) throws StandardException { return (ValueNode) nodeFactory.getNode( C_NodeTypes.INT_CONSTANT_NODE, ReuseFactory.getInteger( intervalType), getContextManager()); }/* * <A NAME="Statement">Statement</A> */ final public QueryTreeNode Statement(String statementSQLText, Object[] paramDefaults) throws ParseException, StandardException { QueryTreeNode statementNode; initStatement(statementSQLText, paramDefaults); statementNode = StatementPart(null); jj_consume_token(0); {if (true) return statementNode;} throw new Error("Missing return statement in function"); } final public QueryTreeNode proceduralStatement(Token[] tokenHolder) throws ParseException, StandardException { QueryTreeNode statementNode; tokenHolder[0] = getToken(1); switch (jj_nt.kind) { case INSERT: statementNode = insertStatement(); break; case UPDATE: statementNode = preparableUpdateStatement(); break; case DELETE: statementNode = preparableDeleteStatement(); break; case SELECT: case VALUES: case LEFT_PAREN: statementNode = preparableSelectStatement(true); break; default: jj_la1[0] = jj_gen; jj_consume_token(-1); throw new ParseException(); } {if (true) return statementNode;} throw new Error("Missing return statement in function"); }/* * <A NAME="StatementPart">StatementPart</A> * * @param tokenHolder returns the token that starts * the statement. If null, ignored. */ final public QueryTreeNode StatementPart(Token[] tokenHolder) throws ParseException, 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); } switch (jj_nt.kind) { case LOCK: case RENAME: switch (jj_nt.kind) { case RENAME: statementNode = spsRenameStatement(); break; case LOCK: // statementNode = SQLTransactionStatement() | statementNode = lockStatement(); break; default: jj_la1[1] = jj_gen; jj_consume_token(-1); throw new ParseException(); } {if (true) return statementNode;} break; default: jj_la1[4] = jj_gen; if (jj_2_2(1)) { switch (jj_nt.kind) { case CREATE: statementNode = createStatements(); break; case DROP: statementNode = dropStatements(); break; case ALTER: statementNode = spsAlterStatement(); break; case DECLARE: statementNode = globalTemporaryTableDeclaration(); break; case DELETE: case INSERT: case ROLLBACK: case SELECT: case UPDATE: case VALUES: case RELEASE: case SAVEPOINT: case CALL: case LEFT_BRACE: case LEFT_PAREN: case QUESTION_MARK: statementNode = preparableSQLDataStatement(); break; default: jj_la1[2] = jj_gen; if (jj_2_1(1)) { statementNode = spsSetStatement(); } else { switch (jj_nt.kind) { case TRUNCATE: statementNode = truncateTableStatement(); break; case EXECUTE: statementNode = execStatement(); break; default: jj_la1[3] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } } {if (true) return statementNode;} } else { jj_consume_token(-1); throw new ParseException(); } } throw new Error("Missing return statement in function"); }/* * <A NAME="createStatements">spsCreateStatement</A> */ final public QueryTreeNode createStatements() throws ParseException, StandardException { QueryTreeNode statementNode; Token beginToken; int tokKind; beginToken = jj_consume_token(CREATE); switch (jj_nt.kind) { case SCHEMA: case VIEW: case SYNONYM: case TRIGGER: switch (jj_nt.kind) { case SCHEMA: statementNode = schemaDefinition(); break; case VIEW: statementNode = viewDefinition(beginToken); break; case TRIGGER: statementNode = triggerDefinition(); break; case SYNONYM: statementNode = synonymDefinition(); break; default: jj_la1[5] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; case TABLE: statementNode = tableDefinition(); break; case PROCEDURE: statementNode = procedureDefinition(); break; case FUNCTION: statementNode = functionDefinition(); break; case UNIQUE: case INDEX: statementNode = indexDefinition(); break; default: jj_la1[6] = jj_gen; jj_consume_token(-1); throw new ParseException(); } {if (true) return statementNode;} throw new Error("Missing return statement in function"); }/* * <A NAME="dropStatements">spsDropStatement</A> */ final public QueryTreeNode dropStatements() throws ParseException, StandardException { QueryTreeNode statementNode; jj_consume_token(DROP); switch (jj_nt.kind) { case SCHEMA: statementNode = dropSchemaStatement(); break; case TABLE: statementNode = dropTableStatement(); break; case INDEX: statementNode = dropIndexStatement(); break; case FUNCTION: case PROCEDURE: case SYNONYM: statementNode = dropAliasStatement(); break; case VIEW: statementNode = dropViewStatement(); break; case TRIGGER: statementNode = dropTriggerStatement(); break; default: jj_la1[7] = jj_gen; jj_con
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -