use of org.apache.jena.jdbc.connections.JenaConnection in project jena by apache.
the class AbstractJenaStatementTests method prepared_statement_unsupported_setters_30.
/**
* Tests for unsupported setters on prepared statements
*
* @throws SQLException
*/
@Test(expected = SQLFeatureNotSupportedException.class)
public void prepared_statement_unsupported_setters_30() throws SQLException {
JenaConnection conn = this.getConnection();
PreparedStatement stmt = conn.prepareStatement("SELECT * WHERE { ? ?p ?o }");
try {
stmt.setSQLXML(1, null);
} finally {
stmt.close();
conn.close();
}
}
use of org.apache.jena.jdbc.connections.JenaConnection in project jena by apache.
the class AbstractJenaStatementTests method prepared_statement_execution_03.
/**
* Tests around prepared statement execution
*
* @throws SQLException
*/
@Test
public void prepared_statement_execution_03() throws SQLException {
JenaConnection conn = this.getConnection();
PreparedStatement stmt = conn.prepareStatement("DELETE WHERE { ?s ?p ?o }");
Assert.assertEquals(0, stmt.executeUpdate());
stmt.close();
conn.close();
}
use of org.apache.jena.jdbc.connections.JenaConnection in project jena by apache.
the class AbstractJenaStatementTests method prepared_statement_setters_74.
/**
* Tests that the various set methods of {@link JenaPreparedStatement}
* function correctly
*
* @throws SQLException
*/
@Test
public void prepared_statement_setters_74() throws SQLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
stmt.setObject(1, (short) 123, Types.JAVA_OBJECT);
ParameterizedSparqlString pss = stmt.getParameterizedString();
Assert.assertTrue(pss.toString().contains("123"));
Assert.assertTrue(pss.toString().contains(XSDDatatype.XSDshort.getURI()));
stmt.close();
conn.close();
}
use of org.apache.jena.jdbc.connections.JenaConnection in project jena by apache.
the class AbstractJenaStatementTests method prepared_statement_unsupported_setters_27.
/**
* Tests for unsupported setters on prepared statements
*
* @throws SQLException
*/
@Test(expected = SQLFeatureNotSupportedException.class)
public void prepared_statement_unsupported_setters_27() throws SQLException {
JenaConnection conn = this.getConnection();
PreparedStatement stmt = conn.prepareStatement("SELECT * WHERE { ? ?p ?o }");
try {
// 4 argument form is unsupported, others are supported
stmt.setObject(1, null, 0, 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_52.
/**
* Tests that the various set methods of {@link JenaPreparedStatement}
* function correctly
*
* @throws SQLException
*/
@Test
public void prepared_statement_setters_52() throws SQLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
stmt.setObject(1, (byte) 123, Types.INTEGER);
ParameterizedSparqlString pss = stmt.getParameterizedString();
Assert.assertTrue(pss.toString().contains("123"));
stmt.close();
conn.close();
}
Aggregations