use of org.eclipse.scout.rt.server.jdbc.fixture.FormDataWithArray in project scout.rt by eclipse.
the class SelectIntoArrayTest method testSelectIntoFormDataWithArray.
@Test
public void testSelectIntoFormDataWithArray() throws Exception {
SqlServiceMock sql = createSqlServiceMock(ROLES_DATA);
//
FormDataWithArray formData = new FormDataWithArray();
formData.getPersonNr().setValue(42L);
sql.selectInto("SELECT ROLE_NR FROM USER_ROLE WHERE USER_NR = :personNr INTO :{roles}", formData);
Long[] r = formData.getRoles().getValue();
assertNotNull(r);
assertEquals(3, r.length);
assertEquals("first role", 3L, r[0].longValue());
assertEquals("second role", 5L, r[1].longValue());
assertEquals("third role", 7L, r[2].longValue());
}
use of org.eclipse.scout.rt.server.jdbc.fixture.FormDataWithArray in project scout.rt by eclipse.
the class SelectInputBindTest method testBatchUpdateFromArrayInValueField.
/**
* Direct batch update from a array in {@link AbstractValueFieldData}.
*/
@Test
public void testBatchUpdateFromArrayInValueField() throws Exception {
SqlServiceMock sql = createSqlServiceMock();
FormDataWithArray formData = new FormDataWithArray();
formData.getPersonNr().setValue(9L);
formData.getValue().setValue("lorem");
formData.getRoles().setValue(new Long[] { 5L, 6L });
sql.update("UDPATE this_table SET v = :value where r = :{roles} and p = :personNr", formData);
assertExpectedProtocol2(sql);
}
Aggregations