本文整理汇总了C++中DBerror类的典型用法代码示例。如果您正苦于以下问题:C++ DBerror类的具体用法?C++ DBerror怎么用?C++ DBerror使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DBerror类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GiveCash
//////////////////////////////////
// temporarily moved into ServiceDB because other services needed access to
// it, eventually something better will need to be done (as the account system
// grows up)
bool ServiceDB::GiveCash( uint32 characterID, JournalRefType refTypeID, uint32 ownerFromID, uint32 ownerToID, const char *argID1,
uint32 accountID, EVEAccountKeys accountKey, double amount, double balance, const char *reason )
{
//the only unknown it is argID1 , what is it ?
DBQueryResult res;
DBerror err;
std::string eReason;
sDatabase.DoEscapeString(eReason, reason);
std::string eArg1;
sDatabase.DoEscapeString(eArg1, argID1);
if(!sDatabase.RunQuery(err,
"INSERT INTO market_journal(characterID,refID,transDate,refTypeID,ownerID1,ownerID2,argID1,accountID,accountKey,amount,balance,reason) "
"VALUES (%u,NULL," PRIu64 ",%u,%u,%u,\"%s\",%u,%u,%.2f,%.2f,\"%s\")",
characterID, Win32TimeNow(), refTypeID, ownerFromID, ownerToID, eArg1.c_str(), accountID, accountKey, amount, balance, eReason.c_str()))
{
sLog.Error("Service DB", "Error in query : %s", err.c_str());
return false;
}
return true;
}
示例2: codelog
bool CorporationDB::InsertApplication(const ApplicationInfo & aInfo) {
if (!aInfo.valid) {
codelog(SERVICE__ERROR, "aInfo contains invalid data");
return false;
}
DBerror err;
std::string safeMessage;
sDatabase.DoEscapeString(safeMessage, aInfo.appText);
if (!sDatabase.RunQuery(err,
" INSERT INTO chrApplications ("
" corporationID, characterID, applicationText, roles, grantableRoles, status, "
" applicationDateTime, deleted, lastCorpUpdaterID "
" ) VALUES ( "
" %u, %u, '%s', " I64u ", " I64u ", %u, " I64u ", %u, %u "
" ) ", aInfo.corpID, aInfo.charID, safeMessage.c_str(), aInfo.role,
aInfo.grantRole, aInfo.status, aInfo.appTime, aInfo.deleted, aInfo.lastCID))
{
codelog(SERVICE__ERROR, "Error in query: %s", err.c_str());
return false;
}
return true;
}
示例3: CompleteJob
bool RamProxyDB::CompleteJob(const uint32 jobID, const EVERamCompletedStatus completedStatus) {
DBerror err;
if(!DBcore::RunQuery(err,
"UPDATE srvRamJobs"
" SET completedStatusID = %u"
" WHERE jobID = %u",
(uint32)completedStatus, jobID))
{
_log(DATABASE__ERROR, "Failed to complete job %u (completed status = %u): %s.", jobID, (uint32)completedStatus, err.c_str());
return false;
}
return true;
}
示例4: SetCharacterOnlineStatus
//johnsus - characterOnline mod
void ServiceDB::SetCharacterOnlineStatus(uint32 char_id, bool onoff_status) {
DBerror err;
_log(CLIENT__TRACE, "ChrStatus: Setting character %u %s.", char_id, onoff_status ? "Online" : "Offline");
if(!DBcore::RunQuery(err,
"UPDATE srvCharacter"
" SET online = %d"
" WHERE characterID = %u",
onoff_status, char_id))
{
codelog(SERVICE__ERROR, "Error in query: %s", err.c_str());
}
if( onoff_status )
{
_log(CLIENT__TRACE, "SrvStatus: Incrementing ConnectSinceStartup.");
if(!DBcore::RunQuery(err, "UPDATE srvStatus SET config_value = config_value + 1 WHERE config_name = 'connectSinceStartup'"))
{
codelog(SERVICE__ERROR, "Error in query: %s", err.c_str());
}
}
}
示例5: DeleteBookmarkFromDatabase
bool BookmarkDB::DeleteBookmarkFromDatabase(uint32 ownerID, uint32 bookmarkID)
{
DBerror err;
if (!DBcore::RunQuery(err,
" DELETE FROM srvBookmarks "
" WHERE ownerID = %u AND bookmarkID = %u", ownerID, bookmarkID
))
{
SysLog::Error( "BookmarkDB::DeleteBookmarkFromDatabase()", "Error in query: %s", err.c_str() );
return false;
}
return true;
}
示例6: AddBalanceToCorp
bool ServiceDB::AddBalanceToCorp(uint32 corpID, double amount, uint32 walletKey) {
DBerror err;
std::string name;
if( ( walletKey < 1000 ) || ( walletKey > 1006 ) )
{
walletKey = 1000;
}
// Care about wallet keys!
if( walletKey == 1000 ) sprintf( name, "balance" );
else sprintf( name, "divisionBalance%u", walletKey - 999 );
if( !sDatabase.RunQuery( err,
"UPDATE corporation"
" SET %s = %s + (%lf)"
" WHERE corporationID = %u", name.c_str(), name.c_str(), amount, corpID ) )
{
sLog.Error( "Service DB", "Error in query: %s", err.c_str() );
return false;
}
return true;
}
示例7: DeleteMessage
bool LSCDB::DeleteMessage(uint32 messageID, uint32 readerID) {
DBerror err;
bool ret = true;
if (!sDatabase.RunQuery(err,
" DELETE FROM eveMail "
" WHERE messageID=%u AND channelID=%u", messageID, readerID
))
{
codelog(SERVICE__ERROR, "Error in query: %s", err.c_str());
ret = false;
}
if (!sDatabase.RunQuery(err,
" DELETE FROM eveMailDetails "
" WHERE messageID=%u", messageID
))
{
codelog(SERVICE__ERROR, "Error in query: %s", err.c_str());
ret = false;
}
return ret;
}
示例8: CreateNewAccount
uint32 ServiceDB::CreateNewAccount( const char* login, const char* pass, uint64 role )
{
uint32 accountID;
DBerror err;
if( !DBcore::RunQueryLID( err, accountID,
"INSERT INTO srvAccount ( accountName, hash, role )"
" VALUES ( '%s', '%s', %" PRIu64 " )",
login, pass, role ) )
{
SysLog::Error( "ServiceDB", "Failed to create a new account '%s': %s.", login, err.c_str() );
return 0;
}
return accountID;
}
示例9: SaveFloatAttribute
bool AttributeMap::SaveFloatAttribute(uint32 attributeID, double value)
{
// SAVE FLOAT ATTRIBUTE
DBerror err;
if(!sDatabase.RunQuery(err,
"REPLACE INTO entity_attributes"
" (itemID, attributeID, valueInt, valueFloat)"
" VALUES"
" (%u, %u, NULL, %f)",
mItem.itemID(), attributeID, value)
) {
codelog(SERVICE__ERROR, "Failed to store attribute %d for item %u: %s", attributeID, mItem.itemID(), err.c_str());
return false;
}
return true;
}
示例10: StoreMail
//temporarily relocated into ServiceDB until some things get cleaned up...
uint32 LSCDB::StoreMail(uint32 senderID, uint32 recipID, const char * subject, const char * message, uint64 sentTime) {
DBQueryResult res;
DBerror err;
DBResultRow row;
std::string escaped;
// Escape message header
DBcore::DoEscapeString(escaped, subject);
// Store message header
uint32 messageID;
if (!DBcore::RunQueryLID(err, messageID,
" INSERT INTO "
" srvEveMail "
" (channelID, senderID, subject, created) "
" VALUES (%u, %u, '%s', %" PRIu64 ") ",
recipID, senderID, escaped.c_str(), sentTime ))
{
codelog(SERVICE__ERROR, "Error in query, message header couldn't be saved: %s", err.c_str());
return (0);
}
_log(SERVICE__MESSAGE, "New messageID: %u", messageID);
// Escape message content
DBcore::DoEscapeString(escaped, message);
// Store message content
if (!DBcore::RunQuery(err,
" INSERT INTO srvEveMailDetails "
" (messageID, mimeTypeID, attachment) VALUES (%u, 1, '%s') ",
messageID, escaped.c_str()
))
{
codelog(SERVICE__ERROR, "Error in query, message content couldn't be saved: %s", err.c_str());
// Delete message header
if (!DBcore::RunQuery(err, "DELETE FROM `srvEveMail` WHERE `messageID` = %u;", messageID))
{
codelog(SERVICE__ERROR, "Failed to remove invalid header data for messgae id %u: %s", messageID, err.c_str());
}
return (0);
}
return (messageID);
}
示例11: UpdateFolderInDatabase
bool BookmarkDB::UpdateFolderInDatabase(uint32 &folderID, std::string folderName, uint32 ownerID, uint32 creatorID)
{
DBerror err;
if (!DBcore::RunQuery(err,
" UPDATE srvBookmarkFolders"
" SET folderName = '%s'"
" WHERE folderID = %u AND ownerID = %u",
folderName.c_str(), folderID, ownerID
))
{
SysLog::Error( "BookmarkDB::UpdateFolderInDatabase()", "Error in query, Folder couldn't be saved: %s", err.c_str() );
return 0;
}
else
return 1;
}
示例12: SaveNewFolderToDatabase
bool BookmarkDB::SaveNewFolderToDatabase(uint32 &folderID, std::string folderName, uint32 ownerID, uint32 creatorID)
{
DBerror err;
if (!DBcore::RunQuery(err,
" INSERT INTO srvBookmarkFolders"
" (folderID, folderName, ownerID, creatorID )"
" VALUES (%u, '%s', %u, %u) ",
folderID, folderName.c_str(), ownerID, creatorID
))
{
SysLog::Error( "BookmarkDB::SaveNewFolderToDatabase()", "Error in query, Folder couldn't be saved: %s", err.c_str() );
return 0;
}
else
return 1;
}
示例13: WriteNewChannelSubscriptionToDatabase
// Take the channelID of a chat channel that a character specified by characterID just subscribed to
// and create a new entry in the 'channelChars' table for this subscription.
int LSCDB::WriteNewChannelSubscriptionToDatabase(uint32 characterID, uint32 channelID, uint32 corpID, uint32 allianceID, uint32 role, uint32 extra)
{
DBQueryResult res;
DBerror err;
DBResultRow row;
if (!sDatabase.RunQuery(err,
" INSERT INTO channelChars "
" (channelID, corpID, charID, allianceID, role, extra) VALUES (%u, %u, %u, %u, %u, %u) ",
channelID, corpID, characterID, allianceID, role, extra
))
{
_log(SERVICE__ERROR, "Error in query, Channel Subscription content couldn't be saved: %s", err.c_str());
return 0;
}
else
return 1;
}
示例14: SaveNewBookmarkToDatabase
bool BookmarkDB::SaveNewBookmarkToDatabase(uint32 &bookmarkID, uint32 ownerID, uint32 itemID,
uint32 typeID, uint32 flag, std::string memo, uint64 created,
double x, double y, double z, uint32 locationID, std::string note,
uint32 creatorID, uint32 folderID)
{
DBerror err;
if (!DBcore::RunQuery(err,
" INSERT INTO srvBookmarks "
" (bookmarkID, ownerID, itemID, typeID, flag, memo, created, x, y, z, locationID, note, creatorID, folderID)"
" VALUES (%u, %u, %u, %u, %u, '%s', %" PRIu64 ", %f, %f, %f, %u, '%s', %u, %u) ",
bookmarkID, ownerID, itemID, typeID, flag, memo.c_str(), created, x, y, z, locationID, note.c_str(), creatorID, folderID
))
{
SysLog::Error( "BookmarkDB::SaveNewBookmarkToDatabase()", "Error in query, Bookmark content couldn't be saved: %s", err.c_str() );
return 0;
}
else
return 1;
}
示例15: UpdateBookmarkInDatabase
bool BookmarkDB::UpdateBookmarkInDatabase(uint32 bookmarkID, uint32 ownerID, std::string memo, std::string note)
{
DBerror err;
if (!DBcore::RunQuery(err,
" UPDATE srvBookmarks "
" SET "
" memo = '%s', note = '%s'"
" WHERE bookmarkID = %u AND ownerID = %u",
memo.c_str(),
note.c_str(),
bookmarkID,
ownerID
))
{
SysLog::Error( "BookmarkDB::UpdateBookmarkInDatabase()", "Error in query: %s", err.c_str() );
return false;
}
return true;
}