Package com.alibaba.druid.sql.parser

Examples of com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList()


    public void test_2() throws Exception {
        String sql = "SELECT x'4D7953514C';";

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

        String text = output(stmtList);

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


    public void test_3() throws Exception {
        String sql = "SELECT 0x65 USING utf8;";

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

        String text = output(stmtList);

        Assert.assertEquals("SELECT 0x65 USING utf8;", text);
    }
View Full Code Here

    public void test_4() throws Exception {
        String sql = "SELECT 0x41, CAST(0x41 AS UNSIGNED)";

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

        String text = output(stmtList);

        Assert.assertEquals("SELECT 0x41, CAST(0x41 AS UNSIGNED);", text);
    }
View Full Code Here

    public void test_5() throws Exception {
        String sql = "SELECT HEX('cat')";

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

        String text = output(stmtList);

        Assert.assertEquals("SELECT HEX('cat');", text);
    }
View Full Code Here

    public void test_0() throws Exception {
        String sql = "SELECT 'Monty!' REGEXP '.*'";

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

        String text = output(stmtList);

        Assert.assertEquals("SELECT 'Monty!' REGEXP '.*';", text);
    }
View Full Code Here

    public void test_1() throws Exception {
        String sql = "SELECT 'new*\n*line' REGEXP 'new\\\\*.\\\\*line'";

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

        String text = output(stmtList);

        Assert.assertEquals("SELECT 'new*\n*line' REGEXP 'new\\*.\\*line';", text);
    }
View Full Code Here

    public void test_2() throws Exception {
        String sql = "SELECT 'a' REGEXP 'A', 'a' REGEXP BINARY 'A'";

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

        String text = output(stmtList);

        Assert.assertEquals("SELECT 'a' REGEXP 'A', 'a' REGEXP BINARY 'A';", text);
    }
View Full Code Here

    public void test_3() throws Exception {
        String sql = "SELECT 'a' REGEXP '^[a-d]'";

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

        String text = output(stmtList);

        Assert.assertEquals("SELECT 'a' REGEXP '^[a-d]';", text);
    }
View Full Code Here

    public void test_4() throws Exception {
        String sql = "SELECT 'fo\nfo' REGEXP '^fo$'";

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

        String text = output(stmtList);

        Assert.assertEquals("SELECT 'fo\nfo' REGEXP '^fo$';", text);
    }
View Full Code Here

    public void test_5() throws Exception {
        String sql = "SELECT 'fofo' REGEXP '^fo'";

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

        String text = output(stmtList);

        Assert.assertEquals("SELECT 'fofo' REGEXP '^fo';", 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.