use of org.apache.jena.jdbc.connections.JenaConnection in project jena by apache.
the class AbstractJenaStatementTests method statement_settings_02.
/**
* Tests manipulating some settings on a statement
*
* @throws SQLException
*/
@Test
public void statement_settings_02() throws SQLException {
JenaConnection conn = this.getConnection();
Statement stmt = conn.createStatement();
Assert.assertEquals(0, stmt.getMaxFieldSize());
// Max field size is ignored
stmt.setMaxFieldSize(100);
Assert.assertEquals(0, stmt.getMaxFieldSize());
stmt.close();
conn.close();
}
use of org.apache.jena.jdbc.connections.JenaConnection in project jena by apache.
the class AbstractJenaStatementTests method statement_bad_execute_06.
/**
* Tests error cases for trying to execute invalid SPARQL
*
* @throws SQLException
*/
@Test(expected = SQLException.class)
public void statement_bad_execute_06() throws SQLException {
JenaConnection conn = this.getConnection();
Statement stmt = conn.createStatement();
try {
stmt.executeUpdate("SELECT * WHERE {");
} 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_04.
/**
* Tests error cases for setters on prepared statements
*
* @throws SQLException
*/
@Test(expected = SQLException.class)
public void prepared_statement_bad_setters_04() throws SQLException {
JenaConnection conn = this.getConnection();
PreparedStatement stmt = conn.prepareStatement("SELECT * WHERE { ? ?p ?o }");
try {
// No RDF equivalent of the given SQL Type
stmt.setObject(1, new Object(), Types.BLOB);
} finally {
stmt.close();
conn.close();
}
}
use of org.apache.jena.jdbc.connections.JenaConnection in project jena by apache.
the class AbstractJenaStatementTests method statement_bad_execute_03.
/**
* Tests error cases for trying to execute invalid SPARQL
*
* @throws SQLException
*/
@Test(expected = SQLException.class)
public void statement_bad_execute_03() throws SQLException {
JenaConnection conn = this.getConnection();
Statement stmt = conn.createStatement();
try {
stmt.execute("SELECT * WHERE {", new int[0]);
} 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_57.
/**
* Tests that the various set methods of {@link JenaPreparedStatement}
* function correctly
*
* @throws SQLException
*/
@Test
public void prepared_statement_setters_57() throws SQLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
Calendar c = Calendar.getInstance();
stmt.setObject(1, c, Types.TIME);
ParameterizedSparqlString pss = stmt.getParameterizedString();
Assert.assertTrue(pss.toString().contains(Integer.toString(c.get(Calendar.HOUR_OF_DAY))));
stmt.close();
conn.close();
}
Aggregations