use of com.microsoft.sqlserver.testframework.DBStatement in project mssql-jdbc by Microsoft.
the class lobsTest method createTable.
private static DBTable createTable(DBTable table, String[] types, boolean populateTable) throws Exception {
DBStatement stmt = new DBConnection(connectionString).createStatement();
table = new DBTable(false);
for (String type1 : types) {
SqlType type = Utils.find(type1);
table.addColumn(type);
}
stmt.createTable(table);
if (populateTable) {
stmt.populateTable(table);
}
stmt.close();
return table;
}
use of com.microsoft.sqlserver.testframework.DBStatement in project mssql-jdbc by Microsoft.
the class BulkCopyTestUtil method performBulkCopy.
/**
* @param bulkWrapper
* @param srcData
* @param dstTable
*/
static void performBulkCopy(BulkCopyTestWrapper bulkWrapper, ISQLServerBulkRecord srcData, DBTable dstTable) {
try (DBConnection con = new DBConnection(bulkWrapper.getConnectionString());
DBStatement stmt = con.createStatement();
SQLServerBulkCopy bc = new SQLServerBulkCopy(bulkWrapper.getConnectionString())) {
bc.setDestinationTableName(dstTable.getEscapedTableName());
bc.writeToServer(srcData);
validateValues(con, srcData, dstTable);
} catch (Exception e) {
fail(e.getMessage());
}
}
use of com.microsoft.sqlserver.testframework.DBStatement in project mssql-jdbc by Microsoft.
the class bvtTestSetup method init.
@BeforeAll
public static void init() throws SQLException {
try (DBConnection conn = new DBConnection(connectionString);
DBStatement stmt = conn.createStatement()) {
// create tables
table1 = new DBTable(true);
stmt.createTable(table1);
stmt.populateTable(table1);
table2 = new DBTable(true);
stmt.createTable(table2);
stmt.populateTable(table2);
}
}
use of com.microsoft.sqlserver.testframework.DBStatement in project mssql-jdbc by Microsoft.
the class MergeTest method runTest.
/**
* Merge test
*
* @throws Exception
*/
@Test
@DisplayName("Merge Test")
public void runTest() throws Exception {
try (DBConnection conn = new DBConnection(connectionString)) {
if (conn.getServerVersion() >= 10) {
try (DBStatement stmt = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE)) {
stmt.executeUpdate(setupTables);
stmt.executeUpdate(mergeCmd2);
int updateCount = stmt.getUpdateCount();
assertEquals(updateCount, 3, "Received the wrong update count!");
}
}
}
}
Aggregations