Search in sources :

Example 1 with MySqlSelectParser

use of com.alibaba.druid.sql.dialect.mysql.parser.MySqlSelectParser in project druid by alibaba.

the class SQLParserTest method test_select.

public void test_select() throws Exception {
    String sql = "   SELECT COUNT(*) FROM close_plan WHERE 1=1          AND close_type = ?             AND target_type = ?             AND target_id = ?         AND(    mi_name=?   )               AND end_time >= ?         ";
    SQLSelectParser parser = new MySqlSelectParser(sql);
    SQLSelect select = parser.select();
    StringBuilder out = new StringBuilder();
    MySql2OracleOutputVisitor visitor = new MySql2OracleOutputVisitor(out);
    select.accept(visitor);
    System.out.println(out);
}
Also used : MySqlSelectParser(com.alibaba.druid.sql.dialect.mysql.parser.MySqlSelectParser) SQLSelectParser(com.alibaba.druid.sql.parser.SQLSelectParser) SQLSelect(com.alibaba.druid.sql.ast.statement.SQLSelect) MySql2OracleOutputVisitor(com.alibaba.druid.sql.dialect.mysql.visitor.MySql2OracleOutputVisitor)

Aggregations

SQLSelect (com.alibaba.druid.sql.ast.statement.SQLSelect)1 MySqlSelectParser (com.alibaba.druid.sql.dialect.mysql.parser.MySqlSelectParser)1 MySql2OracleOutputVisitor (com.alibaba.druid.sql.dialect.mysql.visitor.MySql2OracleOutputVisitor)1 SQLSelectParser (com.alibaba.druid.sql.parser.SQLSelectParser)1