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


C++ DBQueryResult类代码示例

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


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

示例1: GetRegionOfContainer

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

示例2: GetActiveClone

//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:Almamu,项目名称:evemu_apocrypha,代码行数:24,代码来源:CharacterDB.cpp

示例3: ChangeCloneType

//replace all the typeID of the character's clones
bool CorporationDB::ChangeCloneType(uint32 characterID, uint32 typeID) {
    DBQueryResult res;

    if(sDatabase.RunQuery(res,
        "SELECT "
        " typeID, typeName "
        "FROM "
        " invTypes "
        "WHERE typeID = %u",
        typeID))
    {
		_log(DATABASE__ERROR, "Failed to change clone type of char %u: %s.", characterID, res.error.c_str());
		return false;
	}

    DBResultRow row;
    if( !(res.GetRow(row)) )
    {
        sLog.Error( "CorporationDB::ChangeCloneType()", "Could not find Clone typeID = %u in invTypes table.", typeID );
        return false;
    }
    std::string typeNameString = row.GetText(1);

	if(sDatabase.RunQuery(res,
		"UPDATE "
		"entity "
		"SET typeID=%u, itemName='%s' "
		"where ownerID=%u "
		"and flag='400'",
		typeID,
        typeNameString.c_str(),
		characterID))
	{
		_log(DATABASE__ERROR, "Failed to change clone type of char %u: %s.", characterID, res.error.c_str());
		return false;
	}
    sLog.Debug( "CorporationDB", "Clone upgrade successful" );
	return true;
}
开发者ID:Master2202,项目名称:evemu_incursion,代码行数:40,代码来源:CorporationDB.cpp

示例4: IsChannelIDAvailable

// Function: Return true or false result for the check of whether or not the specified
// channelID is available to be taken for a new channel's channelID.
bool LSCDB::IsChannelIDAvailable(uint32 channelID)
{
    DBQueryResult res;

    if (!sDatabase.RunQuery(res,
        " SELECT "
        "    channelID "
        " FROM channels "
        " WHERE channelID = %u", channelID ))
    {
        codelog(SERVICE__ERROR, "Error in query: %s", res.error.c_str());
        return false;
    }

    DBResultRow row;

    // Return true (this channelID not in use) if there are no rows returned by the query:
    if (!(res.GetRow(row)))
        return true;
    else
        return false;
}
开发者ID:IonysTerra,项目名称:evemu_server,代码行数:24,代码来源:LSCDB.cpp

示例5: 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_crucible,代码行数:39,代码来源:CommandDB.cpp

示例6: USING

PyObject *CharacterDB::GetCharPublicInfo(uint32 characterID) {
	DBQueryResult res;

	if(!sDatabase.RunQuery(res,
		"SELECT "
		" entity.typeID,"
		" character_.corporationID,"
        " chrBloodlines.raceID,"
		" bloodlineTypes.bloodlineID,"
		" character_.ancestryID,"
		" character_.careerID,"
		" character_.schoolID,"
		" character_.careerSpecialityID,"
		" entity.itemName AS characterName,"
		" 0 as age,"	//hack
		" character_.createDateTime,"
		" character_.gender,"
		" character_.characterID,"
		" character_.description,"
		" character_.corporationDateTime"
        " FROM character_ "
		"	LEFT JOIN entity ON characterID = itemID"
		"	LEFT JOIN bloodlineTypes USING (typeID)"
		"	LEFT JOIN chrBloodlines USING (bloodlineID)"
		" WHERE characterID=%u", characterID))
	{
		codelog(SERVICE__ERROR, "Error in query: %s", res.error.c_str());
		return NULL;
	}
	
	DBResultRow row;
	if(!res.GetRow(row)) {
		_log(SERVICE__ERROR, "Error in GetCharPublicInfo query: no data for char %d", characterID);
		return NULL;
	}
	return(DBRowToKeyVal(row));
	
}
开发者ID:adam3696,项目名称:evemu_apocrypha,代码行数:38,代码来源:CharacterDB.cpp

示例7: GetLocationCorporationByCareer

/**
  * @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

示例8: 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

示例9: 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

示例10: codelog

PyRep *MarketDB::GetOrderRow(uint32 orderID) {
    DBQueryResult res;

    if(!sDatabase.RunQuery(res,
        "SELECT"
        "    price, volRemaining, typeID, `range`, orderID,"
        "   volEntered, minVolume, bid, issued as issueDate, duration,"
        "   stationID, regionID, solarSystemID, jumps"
        " FROM market_orders"
        " WHERE orderID=%u", orderID))
    {
        codelog(MARKET__ERROR, "Error in query: %s", res.error.c_str());
        return NULL;
    }

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

    return(DBRowToPackedRow(row));
}
开发者ID:Camwarp,项目名称:evemu_server,代码行数:23,代码来源:MarketDB.cpp

示例11: IsChannelSubscribedByThisChar

// Function: Return true or false result for the check of whether or not the channel
// specified by channelID is already subscribed to by the character specified by charID.
bool LSCDB::IsChannelSubscribedByThisChar(uint32 charID, uint32 channelID)
{
	DBQueryResult res;

	if (!sDatabase.RunQuery(res, 
		" SELECT "
		"	channelID, "
		"   charID "
		" FROM channelChars "
		" WHERE channelID = %u AND charID = %u", channelID, charID ))
	{
		codelog(SERVICE__ERROR, "Error in query: %s", res.error.c_str());
		return false;
	}

	DBResultRow row;

    // Return false (no subscription exists) if there are no rows returned by the query:
	if (!(res.GetRow(row)))
		return false;
	else
		return true;
}
开发者ID:Almamu,项目名称:evemu_apocrypha,代码行数:25,代码来源:LSCDB.cpp

示例12: IsChannelNameAvailable

// Function: Return true or false result for the check of whether or not the specified
// channel 'displayName' is already being used by a channel.
bool LSCDB::IsChannelNameAvailable(std::string name)
{
	DBQueryResult res;

	// MySQL query channels table for any channel whose displayName matches "name":
	if (!sDatabase.RunQuery(res, 
		" SELECT "
		"	displayName "
		" FROM channels "
		" WHERE displayName = upper('%s')", name.c_str()))
	{
		codelog(SERVICE__ERROR, "Error in query: %s", res.error.c_str());
		return false;
	}

	DBResultRow row;

    // Return true (this 'displayName' not in use) if there are no rows returned by the query:
	if (!res.GetRow(row))
		return true;
	else
		return false;
}
开发者ID:Almamu,项目名称:evemu_apocrypha,代码行数:25,代码来源:LSCDB.cpp

示例13: DBQueryResult

void DGM_Effects_Table::_Populate()
{
    //first get list of all effects from dgmEffects table
    DBQueryResult *res = new DBQueryResult();
    ModuleDB::GetAllDgmEffects(*res);

    //counter
    MEffect * mEffectPtr;
    mEffectPtr = NULL;
    uint32 effectID;

	uint32 total_effect_count = 0;
	uint32 error_count = 0;

	//go through and populate each effect
    DBResultRow row;
    while( res->GetRow(row) )
    {
        effectID = row.GetInt(0);
        mEffectPtr = new MEffect(effectID);
		if( mEffectPtr->IsEffectLoaded() )
			m_EffectsMap.insert(std::pair<uint32, MEffect *>(effectID,mEffectPtr));
		else
			error_count++;

		total_effect_count++;
    }

	if( error_count > 0 )
		sLog.Error("DGM_Effects_Table::_Populate()","ERROR Populating the DGM_Effects_Table memory object: %u of %u effects failed to load!", error_count, total_effect_count);

	sLog.Log("DGM_Effects_Table", "..........%u total effects objects loaded", total_effect_count);

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

示例14: KEY

    Bool TroopDBOp::checkOrCreateTroopTable( DBDriver& driver )
    {
        static Colume troopColumn[] = 
        {      		
            {"troop_master_id",			"BIGINT",			"0"},				//根据以上主人类型,记录的Id( 或regionID或clanID )
            {"troop_template_id",		"INT",		        "0"},				//军队模板id	
            {"troop_master_type",	    "INT",		        "0"},				//"军队主人的类型,   
            {"troop_life_type",			"INT",		        "0"},				//军队存活类型,
            {"troop_lvl",               "INT",              "0"},               //军队等级
            {"troop_exp",			    "INT",			    "0"},				//军队当前经验度,最大为1000
            {"troop_num",		        "INT",			    "0"},				//军队当前兵数		
            {"troop_loyal",		        "INT",			    "0"},				//军队当前忠诚度,最大为1000
            {"troop_weapon",			"INT",			    "0"},				//军队当前武装度,最大为1000           
            {"troop_wound",			    "INT",			    "0"},				//军队当前伤兵率,最大为1000            
        };

        DBQueryResultEx resEx = driver.query("CREATE TABLE IF NOT EXISTS "TROOP_TABLE_NAME" (troop_id BIGINT NOT NULL AUTO_INCREMENT,PRIMARY KEY(troop_id))");
        DBQueryResult* pRes = *resEx;
        if (!pRes ||(pRes && pRes->getResultType() == DBQuery_Result_INVALID))
        {
            return false;
        }

        Bool res1 = driver.addColume(TROOP_TABLE_NAME,troopColumn,sizeof(troopColumn)/sizeof(Colume));
        if (!res1)
        {
            return false;
        }
        //加索引
        if ( !( *( driver.query("ALTER TABLE "TROOP_TABLE_NAME" ADD INDEX  troopmaster (troop_master_id, troop_master_type)") ) ) )
        {
            return false;
        }

        return true;
    }
开发者ID:dnjsflagh1,项目名称:code,代码行数:36,代码来源:TroopDB.cpp

示例15: 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


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