Package com.alibaba.druid.sql.dialect.mysql.parser

Examples of com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser.parseStatementList()


    public void test_11() throws Exception {
        String sql = "SELECT 0 || NULL;";

        SQLStatementParser parser = new MySqlStatementParser(sql);
        List<SQLStatement> stmtList = parser.parseStatementList();

        String text = output(stmtList);

        Assert.assertEquals("SELECT 0\n\tOR NULL;", text);
    }
View Full Code Here


    public void test_12() throws Exception {
        String sql = "SELECT 0 XOR NULL;";

        SQLStatementParser parser = new MySqlStatementParser(sql);
        List<SQLStatement> stmtList = parser.parseStatementList();

        String text = output(stmtList);

        Assert.assertEquals("SELECT 0 XOR NULL;", text);
    }
View Full Code Here

    public void test_13() throws Exception {
        String sql = "SELECT 1 XOR 1 XOR 1;";

        SQLStatementParser parser = new MySqlStatementParser(sql);
        List<SQLStatement> stmtList = parser.parseStatementList();

        String text = output(stmtList);

        Assert.assertEquals("SELECT 1 XOR 1 XOR 1;", text);
    }
View Full Code Here

    public void test_0() throws Exception {
        String sql = "SELECT something FROM tbl_name WHERE DATE_SUB(CURDATE(),INTERVAL 30 DAY) <= date_col";

        SQLStatementParser parser = new MySqlStatementParser(sql);
        List<SQLStatement> stmtList = parser.parseStatementList();

        String text = output(stmtList);

        Assert.assertEquals("SELECT something\nFROM tbl_name\nWHERE DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= date_col;",
                            text);
View Full Code Here

    public void test_1() throws Exception {
        String sql = "SELECT DAYOFMONTH('2001-11-00'), MONTH('2005-00-00')";

        SQLStatementParser parser = new MySqlStatementParser(sql);
        List<SQLStatement> stmtList = parser.parseStatementList();

        String text = output(stmtList);

        Assert.assertEquals("SELECT DAYOFMONTH('2001-11-00'), MONTH('2005-00-00');", text);
    }
View Full Code Here

    public void test_2() throws Exception {
        String sql = "SELECT DAYNAME('2006-05-00')";

        SQLStatementParser parser = new MySqlStatementParser(sql);
        List<SQLStatement> stmtList = parser.parseStatementList();

        String text = output(stmtList);

        Assert.assertEquals("SELECT DAYNAME('2006-05-00');", text);
    }
View Full Code Here

    public void test_3() throws Exception {
        String sql = "SELECT DAYNAME('2006-05-00')";

        SQLStatementParser parser = new MySqlStatementParser(sql);
        List<SQLStatement> stmtList = parser.parseStatementList();

        String text = output(stmtList);

        Assert.assertEquals("SELECT DAYNAME('2006-05-00');", text);
    }
View Full Code Here

    public void test_4() throws Exception {
        String sql = "SELECT DATE_ADD('2008-01-02', INTERVAL 31 DAY)";

        SQLStatementParser parser = new MySqlStatementParser(sql);
        List<SQLStatement> stmtList = parser.parseStatementList();

        String text = output(stmtList);

        Assert.assertEquals("SELECT DATE_ADD('2008-01-02', INTERVAL 31 DAY);", text);
    }
View Full Code Here

    public void test_5() throws Exception {
        String sql = "SELECT ADDDATE('2008-01-02', INTERVAL 31 DAY)";

        SQLStatementParser parser = new MySqlStatementParser(sql);
        List<SQLStatement> stmtList = parser.parseStatementList();

        String text = output(stmtList);

        Assert.assertEquals("SELECT ADDDATE('2008-01-02', INTERVAL 31 DAY);", text);
    }
View Full Code Here

    public void test_6() throws Exception {
        String sql = "SELECT ADDDATE('2008-01-02', 31)";

        SQLStatementParser parser = new MySqlStatementParser(sql);
        List<SQLStatement> stmtList = parser.parseStatementList();

        String text = output(stmtList);

        Assert.assertEquals("SELECT ADDDATE('2008-01-02', 31);", text);
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.