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

Examples of com.alibaba.druid.sql.dialect.sqlserver.parser.SQLServerStatementParser.parseStatementList()


            "\nSELECT ManagerID, DirectReports" +
            "\nFROM DirReps" +
            "\nORDER BY ManagerID";

        SQLServerStatementParser parser = new SQLServerStatementParser(sql);
        SQLStatement stmt = parser.parseStatementList().get(0);

        String text = TestUtils.outputSqlServer(stmt);

        Assert.assertEquals(expect, text);
View Full Code Here


    public void test_alter_first() throws Exception {
        String sql = "ALTER TABLE dbo.doc_exc ADD column_b VARCHAR(20) NULL "//
                     + "    CONSTRAINT exb_unique UNIQUE ;";
        SQLServerStatementParser parser = new SQLServerStatementParser(sql);
        SQLStatement stmt = parser.parseStatementList().get(0);
        parser.match(Token.EOF);

        SQLServerSchemaStatVisitor visitor = new SQLServerSchemaStatVisitor();
        stmt.accept(visitor);
View Full Code Here

        String expect = "SELECT Location.Distance(@p)" + //
                        "\nFROM Cities";

        SQLServerStatementParser parser = new SQLServerStatementParser(sql);
        SQLStatement stmt = parser.parseStatementList().get(0);

        String text = TestUtils.outputSqlServer(stmt);

        Assert.assertEquals(expect, text);
View Full Code Here

    public void test_0() throws Exception {
        String sql = "SELECT DeptID, DeptName, DeptMgrID, EmpID, EmpLastName, EmpSalary FROM Departments d CROSS APPLY dbo.GetReports(d.DeptMgrID)";

        SQLServerStatementParser parser = new SQLServerStatementParser(sql);
        List<SQLStatement> statementList = parser.parseStatementList();
        SQLStatement stmt = statementList.get(0);

        SQLSelectStatement selectStmt = (SQLSelectStatement) stmt;

        SQLSelect select = selectStmt.getSelect();
View Full Code Here

        String expect = "SELECT TOP 50 PERCENT *\n" + //
                        "FROM Persons";

        SQLServerStatementParser parser = new SQLServerStatementParser(sql);
        SQLStatement stmt = parser.parseStatementList().get(0);

        String text = TestUtils.outputSqlServer(stmt);

        Assert.assertEquals(expect, text);

View Full Code Here

                        + "\n\t\tVALUES"//
                        + "\n\t\t(@0, @1, @2);"//
                        + "\n\tEND";

        SQLServerStatementParser parser = new SQLServerStatementParser(sql);
        SQLStatement stmt = parser.parseStatementList().get(0);

        String text = TestUtils.outputSqlServer(stmt);

        Assert.assertEquals(expect, text);
View Full Code Here

public class SQLServerAlterTableTest_drop_constraint extends TestCase {

    public void test_alter_constraint() throws Exception {
        String sql = "alter table SSHE.dbo.TUSER drop constraint UK_084c17821a8f47e8b31fbb126b6";
        SQLServerStatementParser parser = new SQLServerStatementParser(sql);
        SQLStatement stmt = parser.parseStatementList().get(0);
        parser.match(Token.EOF);

        SQLServerSchemaStatVisitor visitor = new SQLServerSchemaStatVisitor();
        stmt.accept(visitor);
View Full Code Here

public class SQLServerAlterTableTest_1 extends TestCase {

    public void test_alter_first() throws Exception {
        String sql = "ALTER TABLE dependencies ALTER COLUMN id bigint";
        SQLServerStatementParser parser = new SQLServerStatementParser(sql);
        SQLStatement stmt = parser.parseStatementList().get(0);
        parser.match(Token.EOF);

        SQLServerSchemaStatVisitor visitor = new SQLServerSchemaStatVisitor();
        stmt.accept(visitor);
View Full Code Here

public class SQLServerAlterTableTest_3 extends TestCase {

    public void test_alter_first() throws Exception {
        String sql = "ALTER TABLE extensions ADD [core] bit";
        SQLServerStatementParser parser = new SQLServerStatementParser(sql);
        SQLStatement stmt = parser.parseStatementList().get(0);
        parser.match(Token.EOF);

        SQLServerSchemaStatVisitor visitor = new SQLServerSchemaStatVisitor();
        stmt.accept(visitor);
View Full Code Here

    public void test_0() throws Exception {
        String sql = "SELECT DeptID, DeptName, DeptMgrID, EmpID, EmpLastName, EmpSalary FROM Departments d OUTER APPLY dbo.GetReports(d.DeptMgrID)";

        SQLServerStatementParser parser = new SQLServerStatementParser(sql);
        List<SQLStatement> statementList = parser.parseStatementList();
        SQLStatement stmt = statementList.get(0);

        SQLSelectStatement selectStmt = (SQLSelectStatement) stmt;

        SQLSelect select = selectStmt.getSelect();
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.