当前位置: 首页>>代码示例>>C++>>正文


C++ DBResultRow类代码示例

本文整理汇总了C++中DBResultRow的典型用法代码示例。如果您正苦于以下问题:C++ DBResultRow类的具体用法?C++ DBResultRow怎么用?C++ DBResultRow使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DBResultRow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: _log

//returns the itemID of the active clone
//if you want to get the typeID of the clone, please use GetActiveCloneType
bool CharacterDB::GetActiveClone(uint32 characterID, uint32 &itemID) {
    DBQueryResult res;

    if(!sDatabase.RunQuery(res,
                           "SELECT"
                           "  itemID"
                           " FROM entity"
                           " WHERE ownerID = %u"
                           " and flag='400'"
                           " and customInfo='active'",
                           characterID))
    {
        _log(DATABASE__ERROR, "Failed to query active clone of char %u: %s.", characterID, res.error.c_str());
        return false;
    }

    DBResultRow row;
    res.GetRow(row);
    itemID=row.GetUInt(0);

    return true;
}
开发者ID:Quintinon,项目名称:evemu_incursion,代码行数:24,代码来源:CharacterDB.cpp

示例2: _log

uint32 RamProxyDB::GetRegionOfContainer(const uint32 containerID) {
    DBQueryResult res;

    if(!sDatabase.RunQuery(res,
                "SELECT regionID"
                " FROM ramAssemblyLineStations"
                " WHERE stationID = %u",
                containerID))
    {
        _log(DATABASE__ERROR, "Unable to query region for container %u: %s", containerID, res.error.c_str());
        return 0;
    }

    DBResultRow row;
    if(!res.GetRow(row)) {
        _log(DATABASE__ERROR, "No region found for container %u.", containerID);
        return 0;
    }

    return(row.GetUInt(0));

}
开发者ID:N3X15,项目名称:evemu_crucible,代码行数:22,代码来源:RamProxyDB.cpp

示例3: PyDict

PyDict *DBResultToIntIntDict(DBQueryResult &result) {
    PyDict *res = new PyDict();

    //add a line entry for each result row:
    DBResultRow row;
    while(result.GetRow(row)) {
        if(row.IsNull(0))
            continue;   //no working with NULL keys...
        int32 k = row.GetInt(0);
        if(k == 0)
            continue;   //likely a non-integer key
        int32 v;
        if(row.IsNull(1))
            v = 0;      //we can deal with assuming NULL == 0
        else
            v = row.GetInt(1);

        res->SetItem( new PyInt(k), new PyInt(v) );
    }

    return res;
}
开发者ID:eve-moo,项目名称:evemu_server,代码行数:22,代码来源:EVEDBUtils.cpp

示例4: GetQuoteForRentingAnOffice

uint32 CorporationDB::GetQuoteForRentingAnOffice(uint32 stationID) {
    DBQueryResult res;
    DBResultRow row;

    if (!sDatabase.RunQuery(res,
        " SELECT "
        " officeRentalCost "
        " FROM staStations "
        " WHERE staStations.stationID = %u ", stationID))
    {
        codelog(SERVICE__ERROR, "Error in query: %s", res.error.c_str());
        // Try to look more clever than we actually are...
        return 10000;
    }

    if (!res.GetRow(row)) {
        codelog(SERVICE__ERROR, "Unable to find station data, stationID: %u", stationID);
        // Try to look more clever than we actually are...
        return 10000;
    }

    return row.GetUInt(0);
}
开发者ID:AlTahir,项目名称:Apocrypha_combo,代码行数:23,代码来源:CorporationDB.cpp

示例5: GetRecoverables

bool ReprocessingDB::GetRecoverables(const uint32 typeID, std::vector<Recoverable> &into) {
	DBQueryResult res;
	DBResultRow row;

	if (!sDatabase.RunQuery(res,
		"SELECT materialTypeID, MIN(quantity) FROM invTypeMaterials WHERE typeID = %u"
		" GROUP BY materialTypeID",
		typeID))
	{
		_log(DATABASE__ERROR, "Unable to get recoverables for type ID %u: '%s'", typeID, res.error.c_str());
		return false;
	}

	Recoverable rec;

	while (res.GetRow(row)) {
		rec.typeID = row.GetInt(0);
		rec.amountPerBatch = row.GetInt(1);
		into.push_back(rec);
	}

	return true;
}
开发者ID:Camwarp,项目名称:evemu_server,代码行数:23,代码来源:ReprocessingDB.cpp

示例6: DBQueryResult

void DGM_Ship_Bonus_Modifiers_Table::_Populate()
{
    //first get list of all effects from dgmShipBonusModifiers table
    DBQueryResult *res = new DBQueryResult();
    ModuleDB::GetAllDgmShipBonusModifiers(*res);

    //counter
    ShipBonusModifier * mShipBonusModifierPtr;
    mShipBonusModifierPtr = NULL;
    uint32 shipID;

	uint32 total_modifier_count = 0;
	uint32 error_count = 0;

	//go through and populate each ship bonus modifier
    DBResultRow row;
    while( res->GetRow(row) )
    {
        shipID = row.GetInt(0);
        mShipBonusModifierPtr = new ShipBonusModifier(shipID);
		if( mShipBonusModifierPtr->IsModifierLoaded() )
			m_ShipBonusModifiersMap.insert(std::pair<uint32, ShipBonusModifier *>(shipID,mShipBonusModifierPtr));
		else
			error_count++;

		total_modifier_count++;
    }

	if( error_count > 0 )
		sLog.Error("DGM_Ship_Bonus_Modifiers_Table::_Populate()","ERROR Populating the DGM_Ship_Bonus_Modifiers_Table memory object: %u of %u ship bonus modifiers failed to load!", error_count, total_modifier_count);

	sLog.Log("DGM_Ship_Bonus_Modifiers_Table", "..........%u total modifier objects loaded", total_modifier_count);

    //cleanup
    delete res;
    res = NULL;
}
开发者ID:Almamu,项目名称:evemu_server,代码行数:37,代码来源:ModuleEffects.cpp

示例7: CAST

// TODO: hangarGraphicID went missing. maybe no longer in the dump?
PyRep *StationDB::GetStationItemBits(uint32 sid) {
	DBQueryResult res;

	if(!sDatabase.RunQuery(res,
		" SELECT "
		" staStations.stationID, "
		" staStations.stationTypeID, staStations.corporationID AS ownerID, "
		" staStationTypes.hangarGraphicID, "
		// damn mysql returns the result of the sum as string and so it is sent to the client as string and so it freaks out...
		" CAST(SUM(staOperationServices.serviceID) as UNSIGNED INTEGER) AS serviceMask "
		" FROM staStations "
		" LEFT JOIN staStationTypes ON staStations.stationTypeID = staStationTypes.stationTypeID "
		" LEFT JOIN staOperationServices ON staStations.operationID = staOperationServices.operationID "
		" WHERE staStations.stationID = %u "
		" GROUP BY staStations.stationID ", sid
	))
	{
		_log(SERVICE__ERROR, "Error in GetStationItemBits query: %s", res.error.c_str());
		return NULL;
	}

	DBResultRow row;
	if(!res.GetRow(row)) {
		_log(SERVICE__ERROR, "Error in GetStationItemBits query: no station for id %d", sid);
		return NULL;
	}

	PyTuple * result = new PyTuple(5);
	result->SetItem(0, new PyInt(row.GetUInt(3)));
	result->SetItem(1, new PyInt(row.GetUInt(2)));
	result->SetItem(2, new PyInt(row.GetUInt(0)));
	result->SetItem(3, new PyInt(row.GetUInt(4)));
	result->SetItem(4, new PyInt(row.GetUInt(1)));

	return result;
}
开发者ID:Bes666,项目名称:Evemu,代码行数:37,代码来源:StationDB.cpp

示例8: _log

// Return the Home station of the char based on the active clone
bool CharacterDB::GetCharHomeStation(uint32 characterID, uint32 &stationID) {
	uint32 activeCloneID;
	if( !GetActiveClone(characterID, activeCloneID) )
	{
		_log( DATABASE__ERROR, "Could't get the active clone for char %u", characterID );
		return false;
	}

	DBQueryResult res;
	if( !sDatabase.RunQuery(res,
		"SELECT locationID "
		"FROM entity "
		"WHERE itemID = %u",
		activeCloneID ))
	{
		_log(DATABASE__ERROR, "Could't get the location of the clone for char %u", characterID );
		return false;
	}

	DBResultRow row;
    res.GetRow(row);
    stationID = row.GetUInt(0);
	return true;
}
开发者ID:Camwarp,项目名称:evemu_server,代码行数:25,代码来源:CharacterDB.cpp

示例9: GetNextAvailableBookmarkID

uint32 BookmarkDB::GetNextAvailableBookmarkID()
{
	DBQueryResult res;

	if (!sDatabase.RunQuery(res, 
		" SELECT "
		"	bookmarkID "
		" FROM bookmarks "
		" WHERE bookmarkID >= %u ", 0))
	{
        sLog.Error( "BookmarkDB::GetNextAvailableBookmarkID()", "Error in query: %s", res.error.c_str() );
		return 0;
	}

	uint32 currentBookmarkID = 0;

	// Traverse through the rows in the query result until the first gap is found
	// and return the value that would be first (or only one) in the gap as the next
	// free bookmark ID:
	DBResultRow row;
	while( res.GetRow(row) )
	{
        const uint32 bookmarkID = row.GetUInt( 0 );

        if( currentBookmarkID < bookmarkID )
            return currentBookmarkID;

        ++currentBookmarkID;
	}

        // Check to make sure that the next available bookmarkID is not equal to the Maximum bookmarkID value
	if( currentBookmarkID <= BookmarkService::MAX_BOOKMARK_ID )
        return currentBookmarkID;
	else
        return 0;	// No free bookmarkIDs found (this should never happen as there are way too many IDs to exhaust)
}
开发者ID:Logomorph,项目名称:evemu_crucible,代码行数:36,代码来源:BookmarkDB.cpp

示例10: GetRow

bool DBQueryResult::GetRow( DBResultRow& into )
{
    if( NULL == mResult )
        return false;

    MYSQL_ROW row = mysql_fetch_row( mResult );
    if( NULL == row )
        return false;

    const unsigned long* lengths = mysql_fetch_lengths( mResult );
    if( NULL == lengths )
        return false;

    into.SetData( this, row, lengths );
    return true;
}
开发者ID:IonysTerra,项目名称:evemu_server,代码行数:16,代码来源:dbcore.cpp

示例11: _log

bool MarketDB::GetOrderInfo(uint32 orderID, uint32 *orderOwnerID, uint32 *typeID, uint32 *stationID, uint32 *quantity, double *price, bool *isBuy, bool *isCorp) {
    DBQueryResult res;

    if(!sDatabase.RunQuery(res,
        "SELECT"
        " volRemaining,"
        " price,"
        " typeID,"
        " stationID,"
        " charID,"
        " bid,"
        " isCorp"
        " FROM market_orders"
        " WHERE orderID=%u",
        orderID))
    {
        _log(MARKET__ERROR, "Error in query: %s.", res.error.c_str());
        return false;
    }

    DBResultRow row;
    if(!res.GetRow(row)) {
        _log(MARKET__ERROR, "Order %u not found.", orderID);
        return false;
    }

    if(quantity != NULL)
        *quantity = row.GetUInt(0);
    if(price != NULL)
        *price = row.GetDouble(1);
    if(typeID != NULL)
        *typeID = row.GetUInt(2);
    if(stationID != NULL)
        *stationID = row.GetUInt(3);
    if(orderOwnerID != NULL)
        *orderOwnerID = row.GetUInt(4);
    if(isBuy != NULL)
        *isBuy = row.GetInt(5) ? true : false;
    if(isCorp != NULL)
        *isCorp = row.GetInt(6) ? true : false;

    return true;
}
开发者ID:Camwarp,项目名称:evemu_server,代码行数:43,代码来源:MarketDB.cpp

示例12: codelog

/**
  * @todo Here should come a call to Corp??::CharacterJoinToCorp or what the heck... for now we only put it there
  */
bool CharacterDB::GetLocationCorporationByCareer(CharacterData &cdata) {
	DBQueryResult res;
	if (!sDatabase.RunQuery(res, 
	 "SELECT "
	 "  chrSchools.corporationID, "
	 "  chrSchools.schoolID, "
	 "  corporation.allianceID, "
	 "  corporation.stationID, "
	 "  staStations.solarSystemID, "
	 "  staStations.constellationID, "
	 "  staStations.regionID "
	 " FROM staStations"
	 "  LEFT JOIN corporation ON corporation.stationID=staStations.stationID"
	 "  LEFT JOIN chrSchools ON corporation.corporationID=chrSchools.corporationID"
	 "  LEFT JOIN chrCareers ON chrSchools.careerID=chrCareers.careerID"
	 " WHERE chrCareers.careerID = %u", cdata.careerID))
	{
		codelog(SERVICE__ERROR, "Error in query: %s", res.error.c_str());
		return (false);
	}
	
	DBResultRow row;
	if(!res.GetRow(row)) {
		codelog(SERVICE__ERROR, "Failed to find career %u", cdata.careerID);
		return false;
	}
	
	cdata.corporationID = row.GetUInt(0);
	cdata.schoolID = row.GetUInt(1);
	cdata.allianceID = row.GetUInt(2);

	cdata.stationID = row.GetUInt(3);
	cdata.solarSystemID = row.GetUInt(4);
	cdata.constellationID = row.GetUInt(5);
	cdata.regionID = row.GetUInt(6);

	return (true);
}
开发者ID:adam3696,项目名称:evemu_apocrypha,代码行数:41,代码来源:CharacterDB.cpp

示例13: _log

bool ServiceDB::GetStaticItemInfo(uint32 itemID, uint32 *systemID, uint32 *constellationID, uint32 *regionID, GPoint *position) {
    if(       systemID == NULL
        && constellationID == NULL
        && regionID == NULL
        && position == NULL
    )
        return true;

    DBQueryResult res;
    if(!DBcore::RunQuery(res,
        "SELECT"
        " solarSystemID,"
        " constellationID,"
        " regionID,"
        " x, y, z"
        " FROM mapDenormalize"
        " WHERE itemID = %u",
        itemID))
    {
        _log(DATABASE__ERROR, "Failed to query info for static item %u: %s.", itemID, res.error.c_str());
        return false;
    }

    DBResultRow row;
    if(!res.GetRow(row)) {
        _log(DATABASE__ERROR, "Failed to query info for static item %u: Item not found.", itemID);
        return false;
    }

    if(systemID != NULL)
        *systemID = row.GetUInt(0);
    if(constellationID != NULL)
        *constellationID = row.GetUInt(1);
    if(regionID != NULL)
        *regionID = row.GetUInt(2);
    if(position != NULL)
        *position = GPoint(
            row.GetDouble(3),
            row.GetDouble(4),
            row.GetDouble(5)
        );

    return true;
}
开发者ID:comet0,项目名称:evemu_server,代码行数:44,代码来源:ServiceDB.cpp

示例14: codelog

AgentLevel *MissionDB::LoadAgentLevel(uint8 level) {
	AgentLevel *result = new AgentLevel;
	
	DBQueryResult res;

	if(!sDatabase.RunQuery(res,
		"SELECT missionID,missionName,missionLevel,"
		"	agtMissions.missionTypeID,missionTypeName,"
		"	importantMission"
		" FROM agtMissions"
		"	NATURAL JOIN agtMissionTypes"
		" WHERE missionLevel=%d",
		level
	))
	{
		codelog(SERVICE__ERROR, "Error in query: %s", res.error.c_str());
		delete result;
		return NULL;
	}

	std::vector<uint32> IDs;
	DBResultRow row;

	IDs.clear();
	while(res.GetRow(row)) {
		AgentMissionSpec *spec = new AgentMissionSpec;
		spec->missionID = row.GetUInt(0);
		spec->missionName = row.GetText(1);
		spec->missionLevel = row.GetUInt(2);
		spec->missionTypeID = row.GetUInt(3);
		spec->missionTypeName = row.GetText(1);
		spec->importantMission = (row.GetUInt(2)==0)?false:true;
		result->missions.push_back(spec);
	}
	
}
开发者ID:stschake,项目名称:evemu-incursion,代码行数:36,代码来源:MissionDB.cpp

示例15: ItemSearch

bool CommandDB::ItemSearch(uint32 typeID, uint32 &actualTypeID,
    std::string &actualTypeName, uint32 &actualGroupID, uint32 &actualCategoryID, double &actualRadius)
{
    DBQueryResult result;
    DBResultRow row;

    if (!sDatabase.RunQuery(result,
        "SELECT  "
        " invTypes.typeID,"
        " invTypes.typeName,"
        " invTypes.groupID,"
        " invTypes.radius,"
        " invGroups.categoryID"
        " FROM invTypes"
        "  LEFT JOIN invGroups"
        "   ON invGroups.groupID = invTypes.groupID"
        " WHERE typeID = %u",
        typeID
        ))
    {
        sLog.Error( "CommandDB::ItemSearch()", "Error in query: %s", result.error.c_str() );
        return (false);
    }

    if( !result.GetRow(row) )
    {
        sLog.Error( "CommandDB::ItemSearch()", "Query returned NO results: %s", result.error.c_str() );
        return (false);
    }

    // Extract values from the first row:
    actualTypeID = row.GetUInt( 0 );
    actualTypeName = row.GetText( 1 );
    actualGroupID = row.GetUInt( 2 );
    actualCategoryID = row.GetUInt( 4 );
    actualRadius = row.GetDouble( 3 );

    return true;
}
开发者ID:Almamu,项目名称:evemu_server,代码行数:39,代码来源:CommandDB.cpp


注:本文中的DBResultRow类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。