Search in sources :

Example 1 with TableFieldBeanData

use of org.eclipse.scout.rt.server.jdbc.fixture.TableFieldBeanData in project scout.rt by eclipse.

the class SelectInputBindTest method testBatchUpdateFromTableFieldBeanData.

/**
 * {@link TableFieldBeanData} is from type {@link ITableBeanHolder} (introduced with Luna). Direct batch update.
 */
@Test
public void testBatchUpdateFromTableFieldBeanData() throws Exception {
    SqlServiceMock sql = createSqlServiceMock();
    TableFieldBeanData tableData = createTableFieldBeanData(false);
    sql.update("UDPATE my_table SET a=:{active}, s=:{state} where n=:{name} ", tableData);
    assertExpectedProtocol(sql);
}
Also used : SqlServiceMock(org.eclipse.scout.rt.server.jdbc.fixture.SqlServiceMock) TableFieldBeanData(org.eclipse.scout.rt.server.jdbc.fixture.TableFieldBeanData) Test(org.junit.Test)

Example 2 with TableFieldBeanData

use of org.eclipse.scout.rt.server.jdbc.fixture.TableFieldBeanData in project scout.rt by eclipse.

the class SelectInputBindTest method testBatchUpdateFromTableBeanHolderFilter.

/**
 * {@link TableFieldBeanData} in combination with {@link TableBeanHolderFilter} (introduced with Luna). Direct batch
 * update.
 */
@Test
public void testBatchUpdateFromTableBeanHolderFilter() throws Exception {
    SqlServiceMock sql = createSqlServiceMock();
    TableFieldBeanData tableData = createTableFieldBeanData(true);
    TableBeanHolderFilter filter = new TableBeanHolderFilter(tableData, ITableBeanRowHolder.STATUS_UPDATED);
    sql.update("UDPATE my_table SET a=:{active}, s=:{state} where n=:{name} ", filter);
    assertExpectedProtocol(sql);
}
Also used : TableBeanHolderFilter(org.eclipse.scout.rt.platform.holders.TableBeanHolderFilter) SqlServiceMock(org.eclipse.scout.rt.server.jdbc.fixture.SqlServiceMock) TableFieldBeanData(org.eclipse.scout.rt.server.jdbc.fixture.TableFieldBeanData) Test(org.junit.Test)

Example 3 with TableFieldBeanData

use of org.eclipse.scout.rt.server.jdbc.fixture.TableFieldBeanData in project scout.rt by eclipse.

the class SelectInputBindTest method createTableFieldBeanData.

private TableFieldBeanData createTableFieldBeanData(boolean withAdditionalRows) {
    TableFieldBeanData tableBeanData = new TableFieldBeanData();
    if (withAdditionalRows) {
        createRow(tableBeanData, ITableBeanRowHolder.STATUS_INSERTED, false, 6, "xxx");
    }
    createRow(tableBeanData, ITableBeanRowHolder.STATUS_UPDATED, true, 3, "lorem");
    if (withAdditionalRows) {
        createRow(tableBeanData, ITableBeanRowHolder.STATUS_DELETED, false, 8, "yyy");
    }
    createRow(tableBeanData, ITableBeanRowHolder.STATUS_UPDATED, false, 6, "ipsum");
    if (withAdditionalRows) {
        createRow(tableBeanData, ITableBeanRowHolder.STATUS_INSERTED, true, 2, "zzz");
    }
    return tableBeanData;
}
Also used : TableFieldBeanData(org.eclipse.scout.rt.server.jdbc.fixture.TableFieldBeanData)

Example 4 with TableFieldBeanData

use of org.eclipse.scout.rt.server.jdbc.fixture.TableFieldBeanData in project scout.rt by eclipse.

the class SelectIntoArrayTest method testSelectIntoTableFieldBeanDataInBean.

/**
 * {@link TableFieldBeanData} is from type {@link ITableBeanHolder} (introduced with Luna). TableData is in a bean
 * (ContainerBean).
 */
@Test
public void testSelectIntoTableFieldBeanDataInBean() throws Exception {
    SqlServiceMock sql = createSqlServiceMock(DATA);
    // 
    ContainerBean bean = new ContainerBean();
    bean.setTableFieldBeanData(new TableFieldBeanData());
    sql.selectInto("SELECT A,B,C FROM T WHERE D=0 INTO :{tableFieldBeanData.active},:{tableFieldBeanData.state},:{tableFieldBeanData.name}", bean);
    assertContainsData(bean.getTableFieldBeanData());
}
Also used : ContainerBean(org.eclipse.scout.rt.server.jdbc.fixture.ContainerBean) SqlServiceMock(org.eclipse.scout.rt.server.jdbc.fixture.SqlServiceMock) TableFieldBeanData(org.eclipse.scout.rt.server.jdbc.fixture.TableFieldBeanData) Test(org.junit.Test)

Example 5 with TableFieldBeanData

use of org.eclipse.scout.rt.server.jdbc.fixture.TableFieldBeanData in project scout.rt by eclipse.

the class SelectIntoArrayTest method testSelectIntoTableFieldBeanData.

/**
 * {@link TableFieldBeanData} is from type {@link ITableBeanHolder} (introduced with Luna). Direct select.
 */
@Test
public void testSelectIntoTableFieldBeanData() throws Exception {
    SqlServiceMock sql = createSqlServiceMock(DATA);
    // 
    TableFieldBeanData tableData = new TableFieldBeanData();
    sql.selectInto("SELECT A,B,C FROM T WHERE D=0 INTO :active,:state,:name", tableData);
    assertContainsData(tableData);
}
Also used : SqlServiceMock(org.eclipse.scout.rt.server.jdbc.fixture.SqlServiceMock) TableFieldBeanData(org.eclipse.scout.rt.server.jdbc.fixture.TableFieldBeanData) Test(org.junit.Test)

Aggregations

TableFieldBeanData (org.eclipse.scout.rt.server.jdbc.fixture.TableFieldBeanData)13 SqlServiceMock (org.eclipse.scout.rt.server.jdbc.fixture.SqlServiceMock)12 Test (org.junit.Test)12 TableBeanHolderFilter (org.eclipse.scout.rt.platform.holders.TableBeanHolderFilter)4 NVPair (org.eclipse.scout.rt.platform.holders.NVPair)3 ContainerBean (org.eclipse.scout.rt.server.jdbc.fixture.ContainerBean)3