Search in sources :

Example 1 with DBResultSetTypes

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

the class bvtTest method testStmtSserverCursorForwardOnly.

/**
 * Create a statement TYPE_SS_SEVER_CURSOR_FORWARD_ONLY, CONCUR_READ_ONLY, executeQuery verify cursor by using next and verify data
 *
 * @throws SQLException
 */
@Test
public void testStmtSserverCursorForwardOnly() throws SQLException {
    DBResultSetTypes rsType = DBResultSetTypes.TYPE_FORWARD_ONLY_CONCUR_READ_ONLY;
    String query = "SELECT * FROM " + table1.getEscapedTableName();
    try (DBConnection conn = new DBConnection(connectionString);
        DBStatement stmt = conn.createStatement(rsType.resultsetCursor, rsType.resultSetConcurrency);
        DBResultSet rs = stmt.executeQuery(query)) {
        // Verify resultset behavior
        rs.next();
        rs.verify(table1);
    }
}
Also used : DBConnection(com.microsoft.sqlserver.testframework.DBConnection) DBStatement(com.microsoft.sqlserver.testframework.DBStatement) DBResultSet(com.microsoft.sqlserver.testframework.DBResultSet) DBResultSetTypes(com.microsoft.sqlserver.testframework.DBResultSetTypes) Test(org.junit.jupiter.api.Test)

Aggregations

DBConnection (com.microsoft.sqlserver.testframework.DBConnection)1 DBResultSet (com.microsoft.sqlserver.testframework.DBResultSet)1 DBResultSetTypes (com.microsoft.sqlserver.testframework.DBResultSetTypes)1 DBStatement (com.microsoft.sqlserver.testframework.DBStatement)1 Test (org.junit.jupiter.api.Test)1