本文整理汇总了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));
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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));
}
示例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);
}
示例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);
}
示例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;
}
示例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));
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}