use of org.apache.jena.query.ParameterizedSparqlString 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.query.ParameterizedSparqlString 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();
}
use of org.apache.jena.query.ParameterizedSparqlString in project jena by apache.
the class AbstractJenaStatementTests method prepared_statement_setters_70.
/**
* Tests that the various set methods of {@link JenaPreparedStatement}
* function correctly
*
* @throws SQLException
*/
@Test
public void prepared_statement_setters_70() throws SQLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
stmt.setObject(1, 123l, Types.JAVA_OBJECT);
ParameterizedSparqlString pss = stmt.getParameterizedString();
Assert.assertTrue(pss.toString().contains("123"));
stmt.close();
conn.close();
}
use of org.apache.jena.query.ParameterizedSparqlString in project jena by apache.
the class AbstractJenaStatementTests method prepared_statement_setters_66.
/**
* Tests that the various set methods of {@link JenaPreparedStatement}
* function correctly
*
* @throws SQLException
*/
@Test
public void prepared_statement_setters_66() throws SQLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
stmt.setObject(1, NodeFactory.createURI("http://example"), Types.JAVA_OBJECT);
ParameterizedSparqlString pss = stmt.getParameterizedString();
Assert.assertTrue(pss.toString().contains("<http://example>"));
stmt.close();
conn.close();
}
use of org.apache.jena.query.ParameterizedSparqlString in project jena by apache.
the class AbstractJenaStatementTests method prepared_statement_setters_36.
/**
* Tests that the various set methods of {@link JenaPreparedStatement}
* function correctly
*
* @throws SQLException
*/
@Test
public void prepared_statement_setters_36() throws SQLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
stmt.setObject(1, NodeFactoryExtra.intToNode(123l), Types.BIGINT);
ParameterizedSparqlString pss = stmt.getParameterizedString();
Assert.assertTrue(pss.toString().contains("123"));
stmt.close();
conn.close();
}
Aggregations