use of org.apache.jena.jdbc.connections.JenaConnection in project jena by apache.
the class AbstractJenaStatementTests method prepared_statement_unsupported_setters_21.
/**
* Tests for unsupported setters on prepared statements
*
* @throws SQLException
*/
@Test(expected = SQLFeatureNotSupportedException.class)
public void prepared_statement_unsupported_setters_21() throws SQLException {
JenaConnection conn = this.getConnection();
PreparedStatement stmt = conn.prepareStatement("SELECT * WHERE { ? ?p ?o }");
try {
stmt.setNCharacterStream(1, null, 0l);
} 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_03.
/**
* Tests that the various set methods of {@link JenaPreparedStatement}
* function correctly
*
* @throws SQLException
*/
@Test
public void prepared_statement_setters_03() throws SQLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
stmt.setObject(1, 123l);
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_unsupported_setters_18.
/**
* Tests for unsupported setters on prepared statements
*
* @throws SQLException
*/
@Test(expected = SQLFeatureNotSupportedException.class)
public void prepared_statement_unsupported_setters_18() throws SQLException {
JenaConnection conn = this.getConnection();
PreparedStatement stmt = conn.prepareStatement("SELECT * WHERE { ? ?p ?o }");
try {
stmt.setDate(1, null, 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_unsupported_setters_32.
/**
* Tests for unsupported setters on prepared statements
*
* @throws SQLException
*/
@Test(expected = SQLFeatureNotSupportedException.class)
public void prepared_statement_unsupported_setters_32() throws SQLException {
JenaConnection conn = this.getConnection();
PreparedStatement stmt = conn.prepareStatement("SELECT * WHERE { ? ?p ?o }");
try {
stmt.setTimestamp(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_setters_42.
/**
* Tests that the various set methods of {@link JenaPreparedStatement}
* function correctly
*
* @throws SQLException
*/
@Test
public void prepared_statement_setters_42() throws SQLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
Calendar c = Calendar.getInstance();
stmt.setObject(1, NodeFactoryExtra.dateTimeToNode(c), Types.DATE);
ParameterizedSparqlString pss = stmt.getParameterizedString();
Assert.assertTrue(pss.toString().contains(Integer.toString(c.get(Calendar.YEAR))));
stmt.close();
conn.close();
}
Aggregations