本文整理汇总了C++中codelog函数的典型用法代码示例。如果您正苦于以下问题:C++ codelog函数的具体用法?C++ codelog怎么用?C++ codelog使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了codelog函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: codelog
PyObject *CharacterDB::GetCharPublicInfo3(uint32 characterID) {
DBQueryResult res;
if(!sDatabase.RunQuery(res,
"SELECT "
" character_.bounty,"
" character_.title,"
" character_.startDateTime,"
" character_.description,"
" character_.corporationID"
" FROM character_"
" WHERE characterID=%u", characterID))
{
codelog(SERVICE__ERROR, "Error in query: %s", res.error.c_str());
return NULL;
}
return DBResultToRowset(res);
}
示例2: chrOwnerNote
uint32 CharacterDB::AddOwnerNote(uint32 charID, const std::string & label, const std::string & content) {
DBerror err;
uint32 id;
std::string lblS;
sDatabase.DoEscapeString(lblS, label);
std::string contS;
sDatabase.DoEscapeString(contS, content);
if (!sDatabase.RunQueryLID(err, id,
"INSERT INTO chrOwnerNote (ownerID, label, note) VALUES (%u, '%s', '%s');",
charID, lblS.c_str(), contS.c_str()))
{
codelog(SERVICE__ERROR, "Error on query: %s", err.c_str());
return 0;
}
return id;
}
示例3: count
// Should probably make this function more generic once we know how the Args to CharMgrBound::Handle_ListStations work
PyRep *CharacterDB::GetCharStations(uint32 charID) {
DBQueryResult res;
//Query returns StationID, ItemCount
if(!sDatabase.RunQuery(res,
" SELECT stationID, count(stationID) as itemCount "
" FROM ( "
" SELECT stationID, locationID "
" FROM entity, stastations "
" WHERE entity.locationID = stastations.stationID "
" and ownerID = %u "
" ) as a "
" GROUP BY stationID ", charID))
{
codelog(SERVICE__ERROR, "Error in query: %s", res.error.c_str());
return NULL;
}
return DBResultToRowset(res);
}
示例4: codelog
PyRep *MarketDB::GetContractBids( uint32 contractID )
{
DBQueryResult res;
bool success = false;
if(contractID == NULL)
{
success = sDatabase.RunQuery(res,"SELECT bidID, contractID, issuerID, quantity, issuerCorpID, issuerStationID, issuerSolarSystemID, issuerRegionID FROM contract_bids", contractID);
}else{
success = sDatabase.RunQuery(res,"SELECT bidID, contractID, issuerID, quantity, issuerCorpID, issuerStationID, issuerSolarSystemID, issuerRegionID FROM contract_bids WHERE contractID=%u", contractID);
}
if(!success)
{
codelog(MARKET__ERROR, "Error in query: %s", res.error.c_str() );
return NULL;
}
return DBResultToRowset( res );
}
示例5: MIN
PyRep *MarketDB::GetRegionBest(uint32 regionID) {
DBQueryResult res;
if(!sDatabase.RunQuery(res,
"SELECT"
" typeID, MIN(price) AS price, volRemaining, stationID "
" FROM market_orders "
" WHERE regionID=%u AND bid=%d"
//" WHERE regionID=%u"
" GROUP BY typeID", regionID, TransactionTypeSell))
{
codelog(MARKET__ERROR, "Error in query: %s", res.error.c_str());
return NULL;
}
//NOTE: this SHOULD return a crazy dbutil.RowDict object which is
//made up of packed blue.DBRow objects, but we do not understand
//the marshalling of those well enough right now, and this object
//provides the same interface. It is significantly bigger on the wire though.
return(DBResultToIndexRowset(res, "typeID"));
}
示例6: ListToINString
PyRep *ConfigDB::GetMultiInvTypesEx(const std::vector<int32> &entityIDs) {
std::string ids;
ListToINString(entityIDs, ids, "-1");
DBQueryResult res;
if(!sDatabase.RunQuery(res,
"SELECT"
" typeID,groupID,typeName,description,graphicID,radius,"
" mass,volume,capacity,portionSize,raceID,basePrice,"
" published,marketGroupID,chanceOfDuplicating "
" FROM invTypes "
" WHERE typeID in (%s)", ids.c_str()))
{
codelog(SERVICE__ERROR, "Error in query: %s", res.error.c_str());
return NULL;
}
return(DBResultToRowList(res));
}
示例7: AND
PyRep *MarketDB::GetTransactions(uint32 characterID, uint32 typeID, uint32 quantity, double minPrice, double maxPrice, uint64 fromDate, int buySell)
{
DBQueryResult res;
if(!sDatabase.RunQuery(res,
"SELECT"
" transactionID,transactionDateTime,typeID,quantity,price,transactionType,"
" 0 AS corpTransaction,clientID,stationID"
" FROM market_transactions "
" WHERE clientID=%u AND (typeID=%u OR 0=%u) AND"
" quantity>=%u AND price>=%f AND (price<=%f OR 0=%f) AND"
" transactionDateTime>=%" PRIu64 " AND (transactionType=%d OR -1=%d)",
characterID, typeID, typeID, quantity, minPrice, maxPrice, maxPrice, fromDate, buySell, buySell))
{
codelog( MARKET__ERROR, "Error in query: %s", res.error.c_str() );
return NULL;
}
return DBResultToRowset(res);
}
示例8: codelog
PyObject *CharacterDB::GetCharacterAppearance(uint32 charID) {
DBQueryResult res;
if(!sDatabase.RunQuery(res,
"SELECT "
" accessoryID,beardID,costumeID,decoID,eyebrowsID,eyesID,hairID,"
" lipstickID,makeupID,skinID,backgroundID,lightID,"
" headRotation1,headRotation2,headRotation3,eyeRotation1,"
" eyeRotation2,eyeRotation3,camPos1,camPos2,camPos3,"
" morph1e,morph1n,morph1s,morph1w,morph2e,morph2n,"
" morph2s,morph2w,morph3e,morph3n,morph3s,morph3w,"
" morph4e,morph4n,morph4s,morph4w"
" FROM character_ "
" WHERE characterID=%u", charID))
{
codelog(SERVICE__ERROR, "Error in query: %s", res.error.c_str());
return NULL;
}
return DBResultToRowset(res);
}
示例9: codelog
// Function: Query 'channels' table for a list of all channelIDs and traverse that list from the beginning to find
// the first gap in consecutive channelIDs and return the value for the first number in that gap.
uint32 LSCDB::GetNextAvailableChannelID()
{
DBQueryResult res;
// Query the 'channels' table to get a list of all channel IDs.
// NOTE: For large servers, this is inefficient and as everything in this file should be using
// the cached object system rather than touching the database, this query could cause large server slow-down
// if there is a very large number of existing channels in the database.
if( !sDatabase.RunQuery( res,
" SELECT "
" channelID "
" FROM channels "
" WHERE channelID >= %u ", LSCService::BASE_CHANNEL_ID ))
{
codelog(SERVICE__ERROR, "Error in query: %s", res.error.c_str());
return 0;
}
uint32 currentChannelID = LSCService::BASE_CHANNEL_ID;
// 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 channel ID:
DBResultRow row;
while( res.GetRow(row) )
{
const uint32 channelID = row.GetUInt( 0 );
if( currentChannelID < channelID )
return currentChannelID;
++currentChannelID;
}
// Check to make sure that the next available channelID is not equal to the Maximum channel ID value
if( currentChannelID <= LSCService::MAX_CHANNEL_ID )
return currentChannelID;
else
return 0; // No free channel IDs found (this should never happen as there are way too many IDs to exhaust)
}
示例10: codelog
PyResult ShipDB::GetInsuranceContractsByOwnerID(uint32 ownerID)
{
DBQueryResult res;
if(!sDatabase.RunQuery(res,
"SELECT "
" i.shipID, "
" i.startDate, "
" i.endDate, "
" i.fraction "
"FROM "
" insurance i LEFT JOIN entity e ON i.shipID=e.itemID "
"WHERE "
" e.ownerID=%d",
ownerID
))
{
codelog(SERVICE__ERROR, "Error in query: %s", res.error.c_str());
return new PyNone;
}
return(DBResultToCRowset(res));
}
示例11: _log
void NPC::_AwardBounty(SystemEntity *who) {
//double bounty = m_self->entityKillBounty();
double bounty = m_self->GetAttribute(AttrEntityKillBounty).get_float();
if(bounty <= 0) {
return; //no bounty to award...
}
//TODO: handle case where drone strikes fatal blow... bounty goes to master.
//TODO: handle distribution to gangs.
if(who->IsClient() == false) {
_log(NPC__TRACE, "Refusing to award bounty on %u to non-client %u", GetID(), who->GetID());
return; //bounty doesn't make sense for anything other than clients.
}
Client *killer = who->CastToClient();
killer->AddBalance(bounty);
std::string reason = "Bounty"; //TODO: improve this.
if(!m_services.serviceDB().GiveCash(
killer->GetID(),
RefType_playerDonation, //TODO: find the proper type
m_self->itemID(), //probably actually a special concord item ID or something.
killer->GetID(),
"", //unknown const char *argID1,
killer->GetAccountID(),
accountCash,
bounty,
killer->GetBalance(),
reason.c_str()
)) {
codelog(CLIENT__ERROR, "%s: Failed to record bountry of %f from death of %u (type %u)", killer->GetName(), bounty, GetID(), m_self->typeID());
//well.. this isnt a huge deal, so we will get over it.
}
}
示例12: chrcontractinfo
bool CharacterDB::AddCharacterContractInfo( uint32 characterID )
{
DBerror res;
if(!sDatabase.RunQuery(res,
"INSERT INTO chrcontractinfo ("
"characterID,"
" numOutstandingContractsNonCorp,"
" numOutstandingContractsForCorp,"
" numOutstandingContracts,"
" numContractsLeft,"
" numRequiresAttention,"
" numRequiresAttentionCorp,"
" numAssignedTo,"
" numAssignedToCorp,"
" numBiddingOn,"
" numInProgress,"
" numBiddingOnCorp,"
" numInProgressCorp"
") VALUES("
"%d,"
"0,"
"0,"
"0,"
"0,"
"0,"
"0,"
"0,"
"0,"
"0,"
"0,"
"0,"
"0)", characterID ))
{
codelog( SERVICE__ERROR, "Error in query for %s", res.c_str() );
return false;
}
return true;
}
示例13: 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));
}
示例14: _PropigateItems
//helper routine for GetMarketGroups
static void _PropigateItems(std::map< int, std::set<uint32> > &types, std::map<int, int> &parentChild, std::map<int, std::set<int> > &childParent, int group) {
std::map<int, std::set<int> >::iterator children_res;
children_res = childParent.find(group);
if(children_res != childParent.end()) {
//recurse to all children first.
std::set<int>::iterator ccur, cend;
ccur = children_res->second.begin();
cend = children_res->second.end();
for(; ccur != cend; ccur++) {
_PropigateItems(types, parentChild, childParent, *ccur);
}
}
if(group == -1) {
return; //we are root, we have no parent
}
//find our parent.
std::map<int, int>::iterator parent_res;
parent_res = parentChild.find(group);
if(parent_res == parentChild.end()) {
codelog(MARKET__ERROR, "Failed to find parent group in parentChild for %d", group);
return; //should never happen...
}
int parentID = parent_res->second;
if(parentID == -1) {
return; //do not propigate up to NULL, we dont need it, and it would contain ALL items..
}
//now propigate all our items (which now includes all children items) up to our parent.
//find our items
std::map< int, std::set<uint32> >::iterator self_res;
self_res = types.find(group);
if(self_res == types.end())
return; //we have nothing for this group??
//add all of our items into parent.
types[parentID].insert(self_res->second.begin(), self_res->second.end());
}
示例15: codelog
PyResult MailMgrService::Handle_SyncMail(PyCallArgs &call)
{
int firstId = 0, secondId = 0;
if (call.tuple->size() == 2 && !call.tuple->GetItem(0)->IsNone() && !call.tuple->GetItem(1)->IsNone())
{
Call_TwoIntegerArgs args;
if (!args.Decode(&call.tuple))
{
codelog(CLIENT__ERROR, "Failed to decode SyncMail args");
return NULL;
}
// referring to a mail id range
int firstId = args.arg1, secondId = args.arg2;
}
PyDict* dummy = new PyDict;
dummy->SetItemString("oldMail", new PyNone());
dummy->SetItemString("newMail", m_db->GetNewMail(call.client->GetCharacterID()));
dummy->SetItemString("mailStatus", m_db->GetMailStatus(call.client->GetCharacterID()));
return new PyObject("util.KeyVal", dummy);
}