use of org.eclipse.hono.service.base.jdbc.store.Statement.ExpandedStatement in project hono by eclipse.
the class QueryTest method testExtraParams.
/**
* Test providing additional named parameters, which are not referenced in the statement.
*/
@Test
public void testExtraParams() {
final ExpandedStatement expanded = Statement.statement("select * from table where foo=:foo and bar=:bar").expand(params -> {
// not used
params.put("foobarbaz", true);
params.put("foo", 1);
params.put("bar", "baz");
});
assertEquals("select * from table where foo=? and bar=?", expanded.getSql());
assertArrayEquals(new Object[] { 1, "baz" }, expanded.getParameters());
}
use of org.eclipse.hono.service.base.jdbc.store.Statement.ExpandedStatement in project hono by eclipse.
the class QueryTest method testNoParams.
/**
* Test a statement with no parameters.
*/
@Test
public void testNoParams() {
final ExpandedStatement expanded = Statement.statement("select 1").expand(Collections.emptyMap());
assertEquals("select 1", expanded.getSql());
assertArrayEquals(new Object[] {}, expanded.getParameters());
}
Aggregations