Search in sources :

Example 11 with DBTable

use of com.microsoft.sqlserver.testframework.DBTable in project mssql-jdbc by Microsoft.

the class BulkCopyColumnMappingTest method testNoExplicitCM.

@Test
@DisplayName("BulkCopy:test no explicit column mapping")
void testNoExplicitCM() {
    // create dest table
    DBTable destTable = sourceTable.cloneSchema();
    stmt.createTable(destTable);
    // set up bulkCopy without explicit column mapping
    BulkCopyTestWrapper bulkWrapper = new BulkCopyTestWrapper(connectionString);
    bulkWrapper.setUsingConnection((0 == ThreadLocalRandom.current().nextInt(2)) ? true : false);
    BulkCopyTestUtil.performBulkCopy(bulkWrapper, sourceTable, destTable);
}
Also used : DBTable(com.microsoft.sqlserver.testframework.DBTable) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Example 12 with DBTable

use of com.microsoft.sqlserver.testframework.DBTable 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;
}
Also used : DBConnection(com.microsoft.sqlserver.testframework.DBConnection) DBTable(com.microsoft.sqlserver.testframework.DBTable) DBStatement(com.microsoft.sqlserver.testframework.DBStatement) SqlType(com.microsoft.sqlserver.testframework.sqlType.SqlType)

Example 13 with DBTable

use of com.microsoft.sqlserver.testframework.DBTable 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);
    }
}
Also used : DBConnection(com.microsoft.sqlserver.testframework.DBConnection) DBTable(com.microsoft.sqlserver.testframework.DBTable) DBStatement(com.microsoft.sqlserver.testframework.DBStatement) BeforeAll(org.junit.jupiter.api.BeforeAll)

Aggregations

DBTable (com.microsoft.sqlserver.testframework.DBTable)13 Test (org.junit.jupiter.api.Test)7 DBConnection (com.microsoft.sqlserver.testframework.DBConnection)6 DBStatement (com.microsoft.sqlserver.testframework.DBStatement)6 DisplayName (org.junit.jupiter.api.DisplayName)6 SqlType (com.microsoft.sqlserver.testframework.sqlType.SqlType)3 SQLException (java.sql.SQLException)2 BeforeAll (org.junit.jupiter.api.BeforeAll)2 SQLServerBulkCopy (com.microsoft.sqlserver.jdbc.SQLServerBulkCopy)1 AbstractTest (com.microsoft.sqlserver.testframework.AbstractTest)1 DBPreparedStatement (com.microsoft.sqlserver.testframework.DBPreparedStatement)1 BufferedReader (java.io.BufferedReader)1 FileInputStream (java.io.FileInputStream)1 InputStreamReader (java.io.InputStreamReader)1