use of org.apache.jena.jdbc.tdb.connections.DebugTdbConnection in project jena by apache.
the class TestTdbDiskResultSets method results_ask_true.
/**
* Test ASK results with a true result
*
* @throws SQLException
*/
@Test
public void results_ask_true() throws SQLException {
Dataset ds = createDataset(tempDir.getRoot().getAbsolutePath());
try (DebugTdbConnection connection = new DebugTdbConnection(ds)) {
Statement stmt = connection.createStatement(TYPE_FORWARD_ONLY, CONCUR_READ_ONLY);
ResultSet rset = stmt.executeQuery("ASK { }");
assertNotNull(rset);
assertFalse(rset.isClosed());
assertTrue(rset.isBeforeFirst());
// Try to move to the result row
assertTrue(rset.next());
// Check the boolean return value
assertTrue(rset.getBoolean(COLUMN_LABEL_ASK));
// Check no further rows
assertFalse(rset.next());
assertTrue(rset.isAfterLast());
// Close and clean up
rset.close();
assertTrue(rset.isClosed());
}
}
use of org.apache.jena.jdbc.tdb.connections.DebugTdbConnection in project jena by apache.
the class AbstractTdbResultSetTests method setup.
/**
* Sets up the tests by creating a fake connection for test use
*
* @throws SQLException
*/
@BeforeClass
public static void setup() throws SQLException {
connection = new DebugTdbConnection();
connection.setHoldability(ResultSet.HOLD_CURSORS_OVER_COMMIT);
connection.setJdbcCompatibilityLevel(JdbcCompatibility.HIGH);
}
use of org.apache.jena.jdbc.tdb.connections.DebugTdbConnection in project jena by apache.
the class TestTdbDiskResultSets method results_ask_false.
/**
* Test ASK results with a false result
*
* @throws SQLException
*/
@Test
public void results_ask_false() throws SQLException {
Dataset ds = createDataset(tempDir.getRoot().getAbsolutePath());
try (DebugTdbConnection connection = new DebugTdbConnection(ds)) {
Statement stmt = connection.createStatement(TYPE_FORWARD_ONLY, CONCUR_READ_ONLY);
ResultSet rset = stmt.executeQuery("ASK { FILTER(false) }");
assertNotNull(rset);
assertFalse(rset.isClosed());
assertTrue(rset.isBeforeFirst());
// Try to move to the result row
assertTrue(rset.next());
// Check the boolean return value
assertFalse(rset.getBoolean(COLUMN_LABEL_ASK));
// Check no further rows
assertFalse(rset.next());
assertTrue(rset.isAfterLast());
// Close and clean up
rset.close();
assertTrue(rset.isClosed());
}
}
Aggregations