use of org.apache.jena.query.ParameterizedSparqlString in project jena by apache.
the class AbstractJenaStatementTests method prepared_statement_setters_05.
/**
* Tests that the various set methods of {@link JenaPreparedStatement}
* function correctly
*
* @throws SQLException
*/
@Test
public void prepared_statement_setters_05() throws SQLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
stmt.setObject(1, BigDecimal.valueOf(1234, 1));
ParameterizedSparqlString pss = stmt.getParameterizedString();
Assert.assertTrue(pss.toString().contains("123.4"));
stmt.close();
conn.close();
}
use of org.apache.jena.query.ParameterizedSparqlString in project jena by apache.
the class AbstractJenaStatementTests method prepared_statement_setters_11.
/**
* Tests that the various set methods of {@link JenaPreparedStatement}
* function correctly
*
* @throws SQLException
*/
@Test
public void prepared_statement_setters_11() throws SQLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
stmt.setObject(1, new Time(0));
ParameterizedSparqlString pss = stmt.getParameterizedString();
Assert.assertTrue(pss.toString().contains(XSDDatatype.XSDtime.getURI()));
stmt.close();
conn.close();
}
use of org.apache.jena.query.ParameterizedSparqlString in project jena by apache.
the class AbstractJenaStatementTests method prepared_statement_setters_35.
/**
* Tests that the various set methods of {@link JenaPreparedStatement}
* function correctly
*
* @throws SQLException
*/
@Test
public void prepared_statement_setters_35() throws SQLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
Date dt = new Date(Calendar.getInstance().getTimeInMillis());
stmt.setDate(1, dt);
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_46.
/**
* Tests that the various set methods of {@link JenaPreparedStatement}
* function correctly
*
* @throws SQLException
*/
@Test
public void prepared_statement_setters_46() throws SQLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
stmt.setObject(1, NodeFactory.createLiteral(BigDecimal.valueOf(1234, 1).toPlainString(), XSDDatatype.XSDdecimal), Types.DECIMAL);
ParameterizedSparqlString pss = stmt.getParameterizedString();
Assert.assertTrue(pss.toString().contains("123.4"));
stmt.close();
conn.close();
}
use of org.apache.jena.query.ParameterizedSparqlString in project jena by apache.
the class AbstractJenaStatementTests method prepared_statement_setters_08.
/**
* Tests that the various set methods of {@link JenaPreparedStatement}
* function correctly
*
* @throws SQLException
*/
@Test
public void prepared_statement_setters_08() throws SQLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
stmt.setObject(1, 12.3d);
ParameterizedSparqlString pss = stmt.getParameterizedString();
Assert.assertTrue(pss.toString().contains("12.3"));
stmt.close();
conn.close();
}
Aggregations