示例#1
0
/**
 * Release a row in a table
 * \param index is the table/row to release
 * Return true if succeded
 */
bool	CDatabase::release(const RY_PDS::CObjectIndex &index)
{
	if (!initialised())
	{
		PDS_WARNING("release(): database not initialised");
		return false;
	}

	if (!index.isValid())
	{
		PDS_WARNING("release(): index '%s' is not valid", index.toString().c_str());
		return false;
	}

	CTable	*table = getNonConstTable(index.table());

	if (table == NULL || !table->initialised())
	{
		PDS_WARNING("release(): table '%d' is not initialised", index.table());
		return false;
	}

	bool	success = table->release(index.row());

	if (success)
		PDS_FULL_DEBUG("released '%s' successfully", index.toString().c_str());

	return success;
}
示例#2
0
/*
 * Map a row in a table
 * \param index is the table/row to allocate
 * \param key is the 64 bits row key
 * Return true if succeded
 */
bool	CDatabase::mapRow(const RY_PDS::CObjectIndex &index, uint64 key)
{
	if (!initialised())
	{
		PDS_WARNING("mapRow(): database not initialised");
		return false;
	}

	if (!index.isValid())
	{
		PDS_WARNING("mapRow(): index '%s' is not valid", index.toString().c_str());
		return false;
	}

	CTable	*table = getNonConstTable(index.table());

	if (table == NULL || !table->initialised())
	{
		PDS_WARNING("deallocate(): table '%d' is not initialised", index.table());
		return false;
	}

	bool	success = table->mapRow(index, key);

	if (success)
		PDS_FULL_DEBUG("mapped '%016"NL_I64"X' to '%s' successfully", key, index.toString().c_str());

	return success;
}
示例#3
0
/*
 * Fetch data
 */
bool	CDatabase::fetch(const RY_PDS::CObjectIndex& index, RY_PDS::CPData &data, bool fetchIndex)
{
	H_AUTO(PDS_Database_fetch);

	if (!initialised())
	{
		PDS_WARNING("set(): database not initialised");
		return false;
	}

	CTable*		table = getNonConstTable(index.table());

	if (table == NULL)
	{
		PDS_WARNING("fetch(): unable to get table '%d'", index.table());
		return false;
	}

	bool	success = table->fetch(index.row(), data, fetchIndex);

	if (success)
		PDS_FULL_DEBUG("fetch '%s' successfully", index.toString().c_str());

	return success;
}