use of com.microsoft.sqlserver.testframework.DBStatement in project mssql-jdbc by Microsoft.
the class BulkCopyAllTypes method setupVariation.
private void setupVariation() throws SQLException {
try (DBConnection dbConnection = new DBConnection(connectionString);
DBStatement dbStmt = dbConnection.createStatement()) {
tableSrc = new DBTable(true);
tableDest = tableSrc.cloneSchema();
dbStmt.createTable(tableSrc);
dbStmt.createTable(tableDest);
dbStmt.populateTable(tableSrc);
}
}
use of com.microsoft.sqlserver.testframework.DBStatement in project mssql-jdbc by Microsoft.
the class BulkCopyISQLServerBulkRecordTest method testISQLServerBulkRecord.
@Test
void testISQLServerBulkRecord() throws SQLException {
try (DBConnection con = new DBConnection(connectionString);
DBStatement stmt = con.createStatement()) {
DBTable dstTable = new DBTable(true);
stmt.createTable(dstTable);
BulkData Bdata = new BulkData(dstTable);
BulkCopyTestWrapper bulkWrapper = new BulkCopyTestWrapper(connectionString);
bulkWrapper.setUsingConnection((0 == ThreadLocalRandom.current().nextInt(2)) ? true : false);
BulkCopyTestUtil.performBulkCopy(bulkWrapper, Bdata, dstTable);
}
}
use of com.microsoft.sqlserver.testframework.DBStatement in project mssql-jdbc by Microsoft.
the class BulkCopyTestSetUp method setUpSourceTable.
/**
* Create source table needed for testing bulk copy
* @throws SQLException
*/
@BeforeAll
static void setUpSourceTable() throws SQLException {
try (DBConnection con = new DBConnection(connectionString);
DBStatement stmt = con.createStatement();
DBPreparedStatement pstmt = new DBPreparedStatement(con)) {
sourceTable = new DBTable(true);
stmt.createTable(sourceTable);
pstmt.populateTable(sourceTable);
}
}
use of com.microsoft.sqlserver.testframework.DBStatement in project mssql-jdbc by Microsoft.
the class bvtTest method testTwoResultsetsDifferentStmt.
/**
* Verify two concurrent resultsets from same connection, separate statements
*
* @throws SQLException
*/
@Test
public void testTwoResultsetsDifferentStmt() throws SQLException {
String query = "SELECT * FROM " + table1.getEscapedTableName();
String query2 = "SELECT * FROM " + table2.getEscapedTableName();
try (DBConnection conn = new DBConnection(connectionString);
DBStatement stmt1 = conn.createStatement();
DBStatement stmt2 = conn.createStatement()) {
DBResultSet rs1 = stmt1.executeQuery(query);
DBResultSet rs2 = stmt2.executeQuery(query2);
// Interleave resultset calls
rs1.next();
rs1.verifyCurrentRow(table1);
rs2.next();
rs2.verifyCurrentRow(table2);
rs1.next();
rs1.verifyCurrentRow(table1);
rs1.verify(table1);
rs1.close();
rs2.next();
rs2.verify(table2);
rs2.close();
}
}
use of com.microsoft.sqlserver.testframework.DBStatement in project mssql-jdbc by Microsoft.
the class bvtTest method terminate.
/**
* drops tables
*
* @throws SQLException
*/
@AfterAll
public static void terminate() throws SQLException {
try (DBConnection conn = new DBConnection(connectionString);
DBStatement stmt = conn.createStatement()) {
stmt.execute("if object_id('" + table1.getEscapedTableName() + "','U') is not null" + " drop table " + table1.getEscapedTableName());
stmt.execute("if object_id('" + table2.getEscapedTableName() + "','U') is not null" + " drop table " + table2.getEscapedTableName());
}
}
Aggregations