context.assertIsSatisfied();
}
@Test
public void testNamedParams() throws Exception {
Query q1 = create.select(val(1)).from(TABLE1).where(FIELD_ID1.equal(val(2)));
Query q2 = create.select(param("p1", 1)).from(TABLE1).where(FIELD_ID1.equal(param("p2", 2)));
Query q3 = create.select(param("p1", 1)).from(TABLE1).where(FIELD_ID1.equal(2));
Query q4 = create.select(val(1)).from(TABLE1).where(FIELD_ID1.equal(param("p2", 2)));
assertEquals("select 1 from `TABLE1` where `TABLE1`.`ID1` = 2", r_refI().render(q1));
assertEquals("select :1 from `TABLE1` where `TABLE1`.`ID1` = :2", r_refP().render(q1));
assertEquals("select ? from `TABLE1` where `TABLE1`.`ID1` = ?", r_ref().render(q1));
assertEquals("select 1 from `TABLE1` where `TABLE1`.`ID1` = 2", r_refI().render(q2));
assertEquals("select :p1 from `TABLE1` where `TABLE1`.`ID1` = :p2", r_refP().render(q2));
assertEquals("select ? from `TABLE1` where `TABLE1`.`ID1` = ?", r_ref().render(q2));
assertEquals("select 1 from `TABLE1` where `TABLE1`.`ID1` = 2", r_refI().render(q3));
assertEquals("select :p1 from `TABLE1` where `TABLE1`.`ID1` = :2", r_refP().render(q3));
assertEquals("select ? from `TABLE1` where `TABLE1`.`ID1` = ?", r_ref().render(q3));
assertEquals("select 1 from `TABLE1` where `TABLE1`.`ID1` = 2", r_refI().render(q4));
assertEquals("select :1 from `TABLE1` where `TABLE1`.`ID1` = :p2", r_refP().render(q4));
assertEquals("select ? from `TABLE1` where `TABLE1`.`ID1` = ?", r_ref().render(q4));
// Param / Val queries should be equal as toString() doesn't consider params
assertEquals(q1, q2);
assertEquals(q1, q3);
assertEquals(q1, q4);
// Params
Param<?> p11 = q1.getParam("1");
Param<?> p21 = q2.getParam("p1");
Param<?> p31 = q3.getParam("p1");
Param<?> p41 = q4.getParam("1");
Param<?> p12 = q1.getParam("2");
Param<?> p22 = q2.getParam("p2");
Param<?> p32 = q3.getParam("2");
Param<?> p42 = q4.getParam("p2");
assertEquals(p11, create.extractParam(q1, "1"));
assertEquals(p21, create.extractParam(q2, "p1"));
assertEquals(p31, create.extractParam(q3, "p1"));
assertEquals(p41, create.extractParam(q4, "1"));