Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.microsoft.sqlserver.jdbc.SQLServerConnection;
import com.microsoft.sqlserver.jdbc.SQLServerException;
import com.microsoft.sqlserver.testframework.AbstractTest;
import com.microsoft.sqlserver.testframework.Utils;
import com.microsoft.sqlserver.testframework.util.RandomUtil;

@RunWith(JUnitPlatform.class)
Expand Down Expand Up @@ -129,9 +130,7 @@ public void testSocketTimeout() throws Exception {
}

private void dropWaitForDelayProcedure(SQLServerConnection conn) throws SQLException {
String sql = " IF EXISTS (select * from sysobjects where id = object_id(N'" + waitForDelaySPName
+ "') and OBJECTPROPERTY(id, N'IsProcedure') = 1)" + " DROP PROCEDURE " + waitForDelaySPName;
conn.createStatement().execute(sql);
Utils.dropProcedureIfExists(waitForDelaySPName, conn.createStatement());
}

private void createWaitForDelayPreocedure(SQLServerConnection conn) throws SQLException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import com.microsoft.sqlserver.jdbc.SQLServerException;
import com.microsoft.sqlserver.testframework.AbstractTest;
import com.microsoft.sqlserver.testframework.Utils;
import com.microsoft.sqlserver.testframework.util.RandomUtil;

@RunWith(JUnitPlatform.class)
Expand All @@ -49,8 +50,7 @@ public void testParameterMetaDataWrapper() throws SQLException {
assertSame(parameterMetaData, parameterMetaData.unwrap(ParameterMetaData.class));
}
} finally {
stmt.executeUpdate("IF EXISTS (select * from sysobjects where id = object_id(N'" + tableName + "') and OBJECTPROPERTY(id, N'IsTable') = 1)"
+ " DROP TABLE " + tableName);
Utils.dropTableIfExists(tableName, stmt);
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import com.microsoft.sqlserver.jdbc.ISQLServerResultSet;
import com.microsoft.sqlserver.testframework.AbstractTest;
import com.microsoft.sqlserver.testframework.Utils;
import com.microsoft.sqlserver.testframework.util.RandomUtil;

@RunWith(JUnitPlatform.class)
Expand Down Expand Up @@ -97,8 +98,7 @@ public void testResultSetWrapper() throws SQLException {
assertSame(rs, rs.unwrap(ResultSet.class));
assertSame(rs, rs.unwrap(ISQLServerResultSet.class));
} finally {
stmt.executeUpdate("IF EXISTS (select * from sysobjects where id = object_id(N'" + tableName + "') and OBJECTPROPERTY(id, N'IsTable') = 1)"
+ " DROP TABLE " + tableName);
Utils.dropTableIfExists(tableName, stmt);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,19 @@

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Types;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.platform.runner.JUnitPlatform;
import org.junit.runner.RunWith;

import com.microsoft.sqlserver.testframework.AbstractTest;
import com.microsoft.sqlserver.testframework.Utils;

/**
* Multipart parameters
Expand All @@ -46,8 +44,7 @@ public class NamedParamMultiPartTest extends AbstractTest {
public static void beforeAll() throws SQLException {
connection = DriverManager.getConnection(connectionString);
Statement statement = connection.createStatement();
statement.executeUpdate(
"if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[mystoredproc]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) DROP PROCEDURE [mystoredproc]");
Utils.dropProcedureIfExists("mystoredproc", statement);
statement.executeUpdate("CREATE PROCEDURE [mystoredproc] (@p_out varchar(255) OUTPUT) AS set @p_out = '" + dataPut + "'");
statement.close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.microsoft.sqlserver.jdbc.SQLServerConnection;
import com.microsoft.sqlserver.testframework.AbstractTest;
import com.microsoft.sqlserver.testframework.DBConnection;
import com.microsoft.sqlserver.testframework.Utils;

@RunWith(JUnitPlatform.class)
public class RegressionTest extends AbstractTest {
Expand Down Expand Up @@ -126,11 +127,8 @@ public void testSelectIntoUpdateCount() throws SQLException {
public static void terminate() throws SQLException {
SQLServerConnection con = (SQLServerConnection) DriverManager.getConnection(connectionString);
Statement stmt = con.createStatement();
stmt.executeUpdate("IF EXISTS (select * from sysobjects where id = object_id(N'" + tableName + "') and OBJECTPROPERTY(id, N'IsTable') = 1)"
+ " DROP TABLE " + tableName);
stmt.executeUpdate("IF EXISTS (select * from sysobjects where id = object_id(N'" + procName + "') and OBJECTPROPERTY(id, N'IsProcedure') = 1)"
+ " DROP PROCEDURE " + procName);

Utils.dropTableIfExists(tableName, stmt);
Utils.dropProcedureIfExists(procName, stmt);
}

}
Loading