use of com.ctrip.platform.dal.dao.helper.DalCustomRowMapper in project dal by ctripcorp.
the class DalCustomRowMapperTest method testArray.
@Test
public void testArray() throws SQLException {
DalCustomRowMapper mapper = new DalCustomRowMapper("id", "quantity", "type");
String sql = "select id, quantity, type from " + database.getTableName();
DalRowMapperExtractor<Map<String, Object>> rse = new DalRowMapperExtractor<Map<String, Object>>(mapper);
List<Map<String, Object>> rest = database.getClient().query(sql, new StatementParameters(), new DalHints(), rse);
Assert.assertEquals(3, rest.size());
Assert.assertEquals("1", rest.get(0).get("id").toString());
}
use of com.ctrip.platform.dal.dao.helper.DalCustomRowMapper in project dal by ctripcorp.
the class DalCustomRowMapperTest method testList.
@Test
public void testList() throws SQLException {
List<String> columns = new ArrayList<String>();
columns.add("id");
DalCustomRowMapper mapper = new DalCustomRowMapper(columns);
String sql = "select id from " + database.getTableName();
DalRowMapperExtractor<Map<String, Object>> rse = new DalRowMapperExtractor<Map<String, Object>>(mapper);
List<Map<String, Object>> rest = database.getClient().query(sql, new StatementParameters(), new DalHints(), rse);
Assert.assertEquals(3, rest.size());
Assert.assertEquals("1", rest.get(0).get("id").toString());
}
Aggregations