コード例 #1
0
void test_dataitem_type(DataItem::ValueType type, const T &def, const T &val)
{
	DataItem value;
	BOOST_CHECK(value.get<T>() == def);
	BOOST_CHECK(static_cast<T *>(value) == nullptr);
	value = val;
	BOOST_CHECK(value.getType() == type);
	BOOST_CHECK(value.get<T>() == val);
	BOOST_CHECK(static_cast<T *>(value) != nullptr);

	Buffer buffer;
	BOOST_CHECK(value.write(buffer));

	buffer.seekToBegin();

	DataItem valueCheck;
	BOOST_CHECK(valueCheck.read(buffer));

	BOOST_CHECK(valueCheck.getType() == type);
	BOOST_CHECK(value == valueCheck);
	BOOST_CHECK(valueCheck.get<T>() == val);
	BOOST_CHECK(static_cast<T *>(valueCheck) != nullptr);

	value.clear();
	BOOST_CHECK(value.isNull());
	BOOST_CHECK(value.getType() == DataItem::vt_null);
	BOOST_CHECK(value == DataItem::EMPTY);
}
コード例 #2
0
void IDbResult::bind(DataTableRow &row)
{
	uint32 count = columns();
	for(uint32 i = 0; i < count; i++)
	{
		DataItem *value = row[i];
		OS_EXCEPT_IF(value == nullptr, "Invalid row value !");
		value->clear();

		get(i, *value);
	}
}