use of com.microsoft.sqlserver.testframework.DBPreparedStatement 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.DBPreparedStatement in project mssql-jdbc by Microsoft.
the class bvtTest method testCreatepreparedStatement.
/**
* Create a preparedStatement, call close
*
* @throws SQLException
*/
@Test
public void testCreatepreparedStatement() throws SQLException {
String colName = table1.getColumnName(7);
String value = table1.getRowData(7, 0).toString();
String query = "SELECT * from " + table1.getEscapedTableName() + " where [" + colName + "] = ? ";
try (DBConnection conn = new DBConnection(connectionString);
DBPreparedStatement pstmt = conn.prepareStatement(query)) {
pstmt.setObject(1, new BigDecimal(value));
DBResultSet rs = pstmt.executeQuery();
rs.verify(table1);
rs.close();
}
}
Aggregations