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