Esempio n. 1
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;
}
Esempio n. 2
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;
}
Esempio n. 3
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;
}
Esempio n. 4
0
/*
 * Dump database content and info of an object to xml
 */
void	CDatabase::dumpToXml(const RY_PDS::CObjectIndex& index, NLMISC::IStream& xml, sint expandDepth)
{
	if (xml.isReading() || !initialised())
		return;

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

	if (table != NULL)
		table->dumpToXml(index.row(), xml, expandDepth);
}
Esempio n. 5
0
/*
 * Tells if an object is allocated
 * \param object is the object index to test
 */
bool	CDatabase::isAllocated(const RY_PDS::CObjectIndex &index) const
{
	const CTable*	table = getTable(index.table());

	return table != NULL && table->isAllocated(index.row());
}
Esempio n. 6
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	CDbManager::mapRow(TDatabaseId id, const RY_PDS::CObjectIndex &index, uint64 key)
{
	CHECK_DB_MGR_INIT(mapRow, false);

	CDatabase*	db = getDatabase(id);
	if (db == NULL)
	{
		nlwarning("Unable to mapRow() '%016"NL_I64"X' to row '%d':'%d' in db '%d' , not created yet", key, index.table(), index.row(), id);
		return false;
	}

	return db->mapRow(index, key);
}