use of org.apache.jena.jdbc.connections.JenaConnection in project jena by apache.
the class AbstractJenaStatementTests method statement_closed_results_03.
/**
* Tests error cases for trying to access results on closed statements
*
* @throws SQLException
*/
@Test(expected = SQLException.class)
public void statement_closed_results_03() throws SQLException {
JenaConnection conn = this.getConnection();
Statement stmt = conn.createStatement();
stmt.close();
try {
stmt.getMoreResults(Statement.CLOSE_ALL_RESULTS);
} finally {
conn.close();
}
}
use of org.apache.jena.jdbc.connections.JenaConnection in project jena by apache.
the class AbstractJenaStatementTests method statement_fetch_direction_02.
/**
* Tests for fetch direction settings
*
* @throws SQLException
*/
@Test(expected = SQLFeatureNotSupportedException.class)
public void statement_fetch_direction_02() throws SQLException {
JenaConnection conn = this.getConnection();
Statement stmt = conn.createStatement();
try {
// Only FETCH_FORWARD is supported
stmt.setFetchDirection(ResultSet.FETCH_REVERSE);
} finally {
stmt.close();
conn.close();
}
}
use of org.apache.jena.jdbc.connections.JenaConnection in project jena by apache.
the class AbstractJenaStatementTests method prepared_statement_bad_setters_13.
/**
* Tests error cases for setters on prepared statements
*
* @throws SQLException
*/
@Test(expected = SQLException.class)
public void prepared_statement_bad_setters_13() throws SQLException {
JenaConnection conn = this.getConnection();
PreparedStatement stmt = conn.prepareStatement("SELECT * WHERE { ? ?p ?o }");
try {
// Invalid cast
stmt.setObject(1, new Object(), Types.SMALLINT);
} finally {
stmt.close();
conn.close();
}
}
use of org.apache.jena.jdbc.connections.JenaConnection in project jena by apache.
the class AbstractJenaStatementTests method prepared_statement_setters_19.
/**
* Tests that the various set methods of {@link JenaPreparedStatement}
* function correctly
*
* @throws SQLException
*/
@Test
public void prepared_statement_setters_19() throws SQLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
stmt.setObject(1, 123l, Types.BIGINT);
ParameterizedSparqlString pss = stmt.getParameterizedString();
Assert.assertTrue(pss.toString().contains("123"));
stmt.close();
conn.close();
}
use of org.apache.jena.jdbc.connections.JenaConnection in project jena by apache.
the class AbstractJenaStatementTests method prepared_statement_setters_59.
/**
* Tests that the various set methods of {@link JenaPreparedStatement}
* function correctly
*
* @throws SQLException
*/
@Test
public void prepared_statement_setters_59() throws SQLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
@SuppressWarnings("deprecation") Time t = new Time(0, 0, 0);
stmt.setObject(1, t, Types.TIME);
ParameterizedSparqlString pss = stmt.getParameterizedString();
Assert.assertTrue(pss.toString().contains("00:00:00"));
stmt.close();
conn.close();
}
Aggregations