use of org.apache.jena.query.ParameterizedSparqlString in project jena by apache.
the class AbstractJenaStatementTests method prepared_statement_setters_10.
/**
* Tests that the various set methods of {@link JenaPreparedStatement}
* function correctly
*
* @throws SQLException
*/
@Test
public void prepared_statement_setters_10() throws SQLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
stmt.setObject(1, new Date(0));
ParameterizedSparqlString pss = stmt.getParameterizedString();
Assert.assertTrue(pss.toString().contains(XSDDatatype.XSDdate.getURI()));
stmt.close();
conn.close();
}
use of org.apache.jena.query.ParameterizedSparqlString in project jena by apache.
the class AbstractJenaStatementTests method prepared_statement_setters_21.
/**
* Tests that the various set methods of {@link JenaPreparedStatement}
* function correctly
*
* @throws SQLException
*/
@Test
public void prepared_statement_setters_21() throws SQLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
stmt.setObject(1, (short) 123, Types.BIGINT);
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_44.
/**
* Tests that the various set methods of {@link JenaPreparedStatement}
* function correctly
*
* @throws SQLException
*/
@Test
public void prepared_statement_setters_44() throws SQLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
Date dt = new Date(Calendar.getInstance().getTimeInMillis());
stmt.setObject(1, dt, Types.DATE);
ParameterizedSparqlString pss = stmt.getParameterizedString();
Assert.assertTrue(pss.toString().contains(Integer.toString(Calendar.getInstance().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_04.
/**
* Tests that the various set methods of {@link JenaPreparedStatement}
* function correctly
*
* @throws SQLException
*/
@Test
public void prepared_statement_setters_04() throws SQLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
stmt.setObject(1, (byte) 123);
ParameterizedSparqlString pss = stmt.getParameterizedString();
Assert.assertTrue(pss.toString().contains("123"));
Assert.assertTrue(pss.toString().contains(XSDDatatype.XSDbyte.getURI()));
stmt.close();
conn.close();
}
use of org.apache.jena.query.ParameterizedSparqlString in project jena by apache.
the class AbstractJenaStatementTests method prepared_statement_setters_68.
/**
* Tests that the various set methods of {@link JenaPreparedStatement}
* function correctly
*
* @throws SQLException
*/
@Test
public void prepared_statement_setters_68() throws SQLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
stmt.setObject(1, "test", Types.JAVA_OBJECT);
ParameterizedSparqlString pss = stmt.getParameterizedString();
Assert.assertTrue(pss.toString().contains("test"));
stmt.close();
conn.close();
}
Aggregations