miracle-sharding-jdbc-core/src/main/java/io/shardingjdbc/core/parsing/SQLJudgeEngine.java
/**
     * judge SQL Type only.
     *
     * @return SQL statement
     */
judge SQL Type only.
@return SQL statement
judge SQL Type only . @return SQL statement
public SQLStatement judge() {
    	if(isPgProcedure())
    	{
    		return judgePgProcedureType();
    	}
        Lexer lexer = new Lexer(sql, new Dictionary());
        lexer.nextToken();
        while (true) {
            TokenType tokenType = lexer.getCurrentToken().getType();
            if (tokenType instanceof Keyword) {
                if (DefaultKeyword.SELECT == tokenType) {
                    return new SelectStatement();
                }
                if (DefaultKeyword.INSERT == tokenType || DefaultKeyword.UPDATE == tokenType || DefaultKeyword.DELETE == tokenType) {
                    return new DMLStatement();
                }
                if (DefaultKeyword.CREATE == tokenType || DefaultKeyword.ALTER == tokenType || DefaultKeyword.DROP == tokenType || DefaultKeyword.TRUNCATE == tokenType) {
                    return new DDLStatement();
                }
            }
            if (tokenType instanceof Assist && Assist.END == tokenType) {
                throw new SQLParsingException("Unsupported SQL statement: [%s]", sql);
            }
            lexer.nextToken();
        }
    }
public SQLStatement judge ( ) { if ( isPgProcedure ( ) ) { return judgePgProcedureType ( ) ; } Lexer lexer = new Lexer ( sql , new Dictionary ( ) ) ; lexer . nextToken ( ) ; while ( true ) { TokenType tokenType = lexer . getCurrentToken ( ) . getType ( ) ; if ( tokenType instanceof Keyword ) { if ( DefaultKeyword . SELECT == tokenType ) { return new SelectStatement ( ) ; } if ( DefaultKeyword . INSERT == tokenType || DefaultKeyword . UPDATE == tokenType || DefaultKeyword . DELETE == tokenType ) { return new DMLStatement ( ) ; } if ( DefaultKeyword . CREATE == tokenType || DefaultKeyword . ALTER == tokenType || DefaultKeyword . DROP == tokenType || DefaultKeyword . TRUNCATE == tokenType ) { return new DDLStatement ( ) ; } } if ( tokenType instanceof Assist && Assist . END == tokenType ) { throw new SQLParsingException ( "Unsupported SQL statement: [%s]" , sql ) ; } lexer . nextToken ( ) ; } }
judge SQL Type only.
judge SQL Type only .