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

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


public class SQLServerExec_Test extends TestCase {

    public void test_0() throws Exception {
        String sql = "EXEC sp_rename 'rules.temp_plugin_config_key', 'plugin_config_key'";
        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_2() throws Exception {
        String sql = "EXEC @returnstatus = dbo.ufnGetSalesOrderStatusText @Status = 2";
        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 sql = "USE AdventureWorks2008R2;";

        String expect = "USE AdventureWorks2008R2";

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

        String text = TestUtils.outputSqlServer(stmt);

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

        String expect = "UPDATE Cities" + //
                        "\nSET Location = CONVERT(Point, '12.3:46.2')" + //
                        "\nWHERE Name = 'Anchorage'";

        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\tWHERE FRemoveAlert = ?" +
            "\n\t) temp_table" +
            "\nWHERE RowNumber BETWEEN ? AND ?";

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

        String text = TestUtils.outputSqlServer(stmt);

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

                        "\nWHERE GEN_NAME = ?" +
                        "\n\tAND FID = ?" +
                        "\n\tAND FSTATE IN (?)";

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

        String text = outputSqlServer(stmtList);

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

                        "\n(N'a')," + //
                        "\n(N'b')," + //
                        "\n(N'c')";

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

        String text = TestUtils.outputSqlServer(stmt);

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

                     + "    VERSION INTEGER,"//
                     + "CONSTRAINT pk_AO_E8B6CC_ISSUE_MAPPING_V2_ID PRIMARY KEY(ID)"//
                     + ")";

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

        Assert.assertEquals(1, statementList.size());

        String output = SQLUtils.toSQLString(stmt, JdbcConstants.SQL_SERVER);
View Full Code Here

        String sql = "INSERT INTO dbo.AO_B9A0F0_APPLIED_TEMPLATE DEFAULT VALUES";

        String expect = "INSERT INTO dbo.AO_B9A0F0_APPLIED_TEMPLATE DEFAULT VALUES";

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

        String text = TestUtils.outputSqlServer(stmt);

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

                     + "PARENTOPTIONID NUMERIC, SEQUENCE NUMERIC, customvalue NVARCHAR(255), "//
                     + "optiontype NVARCHAR(60), disabled NVARCHAR(60), "//
                     + "CONSTRAINT PK_customfieldoption PRIMARY KEY (ID))";

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

        Assert.assertEquals(1, statementList.size());

        String output = SQLUtils.toSQLString(stmt, JdbcConstants.SQL_SERVER);
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.