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


C++ DBResultRow::GetInt方法代码示例

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


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

示例1: _Populate

void DGM_Types_to_Wrecks_Table::_Populate()
{
    uint32 wreckID, typeID;

    //first get list of all effects from dgmEffects table
    DBQueryResult *res = new DBQueryResult();
    SystemDB::GetWrecksToTypes(*res);

    //counter
	uint32 total_effect_count = 0;
	uint32 error_count = 0;

	//go through and populate each effect
    DBResultRow row;
    while( res->GetRow(row) )
    {
        typeID = row.GetInt(0);
        wreckID = row.GetInt(1);
		m_WrecksToTypesMap.insert(std::pair<uint32, uint32>(typeID,wreckID));
    }

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

示例2: GetRecoverables

bool ReprocessingDB::GetRecoverables(const uint32 typeID, std::vector<Recoverable> &into) {
    DBQueryResult res;
    DBResultRow row;

    if(!sDatabase.RunQuery(res,
                "SELECT requiredTypeID, MIN(quantity) FROM typeActivityMaterials"
                " LEFT JOIN invBlueprintTypes ON typeID = blueprintTypeID"
                " WHERE damagePerJob = 1 AND ("
                "   (activityID = 6 AND typeID = %u)"
                "   OR"
                "    (activityID = 1 AND productTypeID = %u))"
                " GROUP BY requiredTypeID",
                typeID, typeID, 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:Ahava,项目名称:evemu_server,代码行数:28,代码来源:ReprocessingDB.cpp

示例3: LoadSystemEntities

bool SystemDB::LoadSystemEntities(uint32 systemID, std::vector<DBSystemEntity> &into) {
    DBQueryResult res;

    if(!sDatabase.RunQuery(res,
        "SELECT "
        " itemID,typeID,groupID,orbitID,"
        " x,y,z,radius,security,itemName"
        " FROM mapDenormalize"
        " WHERE solarSystemID=%u", systemID
    ))
    {
        codelog(SERVICE__ERROR, "Error in query: %s", res.error.c_str());
        return false;
    }

    DBResultRow row;
    DBSystemEntity entry;
    while(res.GetRow(row)) {
        entry.itemID = row.GetInt(0);
        entry.typeID = row.GetInt(1);
        entry.groupID = row.GetInt(2);
        entry.orbitID = (row.IsNull(3) ? 0 : row.GetInt(3));
        entry.position.x = row.GetDouble(4);
        entry.position.y = row.GetDouble(5);
        entry.position.z = row.GetDouble(6);
        entry.radius = (row.IsNull(7) ? 1 : row.GetDouble(7));
        entry.security = (row.IsNull(8) ? 0.0 : row.GetDouble(8));
        entry.itemName = row.GetText(9);
        into.push_back(entry);
    }

    return true;
}
开发者ID:Almamu,项目名称:evemu_crucible,代码行数:33,代码来源:SystemDB.cpp

示例4: codelog

PyRep *CorporationDB::Fetch(uint32 corpID, uint32 from, uint32 count) {
    DBQueryResult res;
    DBResultRow rr;

    if (!sDatabase.RunQuery(res,
        " SELECT stationID, typeID, itemID, officeFolderID "
        " FROM crpOffices "
        " WHERE corporationID = %u "
        " LIMIT %u, %u ", corpID, from, count
        ))
    {
        codelog(SERVICE__ERROR, "Error in query: %s", res.error.c_str());
        return NULL;
    }

    res.GetRow(rr);

    // Have to send back a list that contains a tuple that contains an int and a list...
    // params probably needs the following stuff: stationID, typeID, officeID, officeFolderID
    Reply_FetchOffice reply;
    reply.params = new PyList;

    reply.params->AddItemInt( rr.GetInt(0) );
    reply.params->AddItemInt( rr.GetInt(1) );
    reply.officeID = rr.GetInt(2);
    reply.params->AddItemInt( reply.officeID );
    reply.params->AddItemInt( rr.GetInt(3) );

    return reply.Encode();
}
开发者ID:AlTahir,项目名称:Apocrypha_combo,代码行数:30,代码来源:CorporationDB.cpp

示例5: LoadSystemDynamicEntities

bool SystemDB::LoadSystemDynamicEntities(uint32 systemID, std::vector<DBSystemDynamicEntity> &into) {
    DBQueryResult res;

    if(!sDatabase.RunQuery(res,
        "SELECT"
        "    entity.itemID,"
        "   entity.itemName,"
        "    entity.typeID,"
        "   entity.ownerID,"
        "   entity.locationID,"
        "   entity.flag,"
        "    invTypes.groupID,"
        "    invGroups.categoryID,"
        "   0,"//"   character_.corporationID,"
        "   0,"//"   corporation.allianceID,"
        "   x,"
        "   y,"
        "   z"
        " FROM entity, invTypes, invGroups"//, character_, corporation"
        " WHERE"
        "        entity.typeID=invTypes.typeID"
        "    AND invTypes.groupID=invGroups.groupID"
        "    AND invGroups.categoryID NOT IN (%d,%d)"
        //"   AND character_.characterID = entity.ownerID"
        //"   AND corporation.corporationID = character_.corporationID"
        "    AND locationID=%u",
        //excluded categories:
            //celestials:
            EVEDB::invCategories::_System, EVEDB::invCategories::Station,
            //NPCs:
            //EVEDB::invCategories::Entity,
        systemID
    ))
    {
        codelog(SERVICE__ERROR, "Error in query: %s", res.error.c_str());
        return false;
    }

    DBResultRow row;
    DBSystemDynamicEntity entry;
    while(res.GetRow(row)) {
        entry.itemID = row.GetInt(0);
        entry.itemName = row.GetText(1);
        entry.typeID = row.GetInt(2);
        entry.ownerID = row.GetInt(3);
        entry.locationID = row.GetInt(4);
        entry.flag = row.GetInt(5);
        entry.groupID = row.GetInt(6);
        entry.categoryID = row.GetInt(7);
        entry.corporationID = row.GetInt(8);
        entry.allianceID = row.GetInt(9);
        entry.x = row.GetDouble(10);
        entry.y = row.GetDouble(11);
        entry.z = row.GetDouble(12);
        into.push_back(entry);
    }

    return true;
}
开发者ID:Almamu,项目名称:evemu_crucible,代码行数:59,代码来源:SystemDB.cpp

示例6: GetAccountID

int CommandDB::GetAccountID(std::string name) {

    DBQueryResult res;

    if(!sDatabase.RunQuery(res,
        " SELECT "
        " AccountID "
        " FROM character_ "
        " WHERE characterID = ( SELECT itemID FROM entity WHERE itemName = '%s' )", name.c_str()))
    {
        sLog.Error("CommandDB", "Failed to retrieve accountID for %s", name.c_str());
        return 0;
    }

    DBResultRow row;

    if( !res.GetRow(row) )
    {
        sLog.Error("CommandDB", "Query Returned no results");
        return 0;
    }

    return row.GetInt( 0 );

}
开发者ID:Almamu,项目名称:evemu_server,代码行数:25,代码来源:CommandDB.cpp

示例7: CreateLabel

bool MailDB::CreateLabel(int characterID, Call_CreateLabel& args, uint32& newID) const
{
    // we need to get the next free bit index; can't avoid a SELECT
    DBQueryResult res;
    sDatabase.RunQuery(res, "SELECT bit FROM mailLabel WHERE ownerID = %u ORDER BY bit DESC LIMIT 1", characterID);

    // 6 is a guessed default; there are some hardcoded labels that we don't have the details on yet
    int bit = 6;

    if (res.GetRowCount() > 0)
    {
        DBResultRow row;
        res.GetRow(row);
        // we want the next one, not the current one, so +1
        bit = row.GetInt(0) + 1;
    }

    DBerror error;
    if (!sDatabase.RunQuery(error, "INSERT INTO mailLabel (bit, name, color, ownerID) VALUES (%u, '%s', %u, %u)", bit, args.name.c_str(), args.color, characterID))
    {
        codelog(SERVICE__ERROR, "Failed to insert new mail label into database");
        // since this is an out parameter, make sure we assign this even in case of an error
        newID = 0;
        return false;
    }

    // the client wants the power of 2, not the bitset index
    newID = (uint32)pow((float)2, bit);
    return true;
}
开发者ID:Ahava,项目名称:evemu_server,代码行数:30,代码来源:MailDB.cpp

示例8: GetRequiredItems

bool RamProxyDB::GetRequiredItems(const uint32 typeID, const EVERamActivity activity, std::vector<RequiredItem> &into) {
    DBQueryResult res;

    if(!DBcore::RunQuery(res,
        "SELECT"
        " material.requiredTypeID,"
        " material.quantity,"
        " material.damagePerJob,"
        " IF(materialGroup.categoryID = 16, 1, 0) AS isSkill"
        " FROM typeActivityMaterials AS material"
        " LEFT JOIN invTypes AS materialType ON material.requiredTypeID = materialType.typeID"
        " LEFT JOIN invGroups AS materialGroup ON materialType.groupID = materialGroup.groupID"
        " WHERE material.typeID = %u"
        " AND material.activityID = %d"
        //this is needed as db is quite crappy ...
        " AND material.quantity > 0",
        typeID, (const int)activity))
    {
        _log(DATABASE__ERROR, "Failed to query data to build BillOfMaterials: %s.", res.error.c_str());
        return false;
    }

    DBResultRow row;
    while(res.GetRow(row))
        into.push_back(RequiredItem(row.GetUInt(0), row.GetUInt(1), row.GetFloat(2), row.GetInt(3) ? true : false));

    return true;
}
开发者ID:eve-moo,项目名称:evemu_server,代码行数:28,代码来源:RamProxyDB.cpp

示例9: _Populate

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;

	int total_effect_count = 0;
	int 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);

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

示例10: GetChannelIDFromComparisonKey

uint32 LSCDB::GetChannelIDFromComparisonKey(std::string compkey)
{
	DBQueryResult res;

	if(!sDatabase.RunQuery(res,
		"SELECT "
		"	channelID "
		" FROM channels"
		" WHERE comparisonKey RLIKE '%s'", 
        compkey.c_str()
	))
	{
		_log(SERVICE__ERROR, "Error in GetChannelIDFromComparisonKey query: %s", res.error.c_str());
		return 0;
	}

	DBResultRow row;

	if (!res.GetRow(row)) {
		_log(SERVICE__ERROR, "Couldn't find %s in table channels", compkey.c_str());
        return 0;
	}

    return (row.GetInt(0));
}
开发者ID:Almamu,项目名称:evemu_apocrypha,代码行数:25,代码来源:LSCDB.cpp

示例11: DBResultToIntIntlistDict

/**
 * this function isn't used.
 */
void DBResultToIntIntlistDict( DBQueryResult &result, std::map<int32, PyRep *> &into ) {
    /* this builds a map from the int in result[0], to a list of each result[1]
     * which is has the same result[0]. This function assumes the result is
     * ORDER BY result[0]
     */
    uint32 last_key = 0xFFFFFFFF;

    PyList *l = NULL;

    DBResultRow row;
    while( result.GetRow( row ) )
    {
        uint32 k = row.GetUInt(0);
        if( k != last_key )
        {
            //watch for overwrite, no guarantee we are dealing with a key.
            std::map<int32, PyRep *>::iterator res = into.find(k);
            if( res != into.end() )
                //log an error or warning?
                PyDecRef( res->second );

            into[k] = l = new PyList();
            last_key = k;
        }

        l->AddItemInt( row.GetInt( 1 ) );
    }
}
开发者ID:Ahava,项目名称:evemu_server,代码行数:31,代码来源:EVEDBUtils.cpp

示例12:

PyRep *LSCDB::GetMailDetails(uint32 messageID, uint32 readerID) {
	DBQueryResult result;
	DBResultRow row;

	//we need to query out the primary message here... not sure how to properly
	//grab the "main message" though... the text/plain clause is pretty hackish.
	if (!sDatabase.RunQuery(result,
		" SELECT eveMail.messageID, eveMail.senderID, eveMail.subject, " // need messageID as char*
		" eveMailDetails.attachment, eveMailDetails.mimeTypeID, "
		" eveMailMimeType.mimeType, eveMailMimeType.`binary`, "
		" eveMail.created, eveMail.channelID "
		" FROM eveMail "
		" LEFT JOIN eveMailDetails"
		"	ON eveMailDetails.messageID = eveMail.messageID "
		" LEFT JOIN eveMailMimeType"
		"	ON eveMailMimeType.mimeTypeID = eveMailDetails.mimeTypeID "
		" WHERE eveMail.messageID=%u"
		"	AND channelID=%u",
			messageID, readerID
		))
	{
		codelog(SERVICE__ERROR, "Error in query: %s", result.error.c_str());
		return (NULL);
	}

	if (!result.GetRow(row)) {
		codelog(SERVICE__MESSAGE, "No message with messageID %u", messageID);
		return (NULL);
	}

	Rsp_GetEVEMailDetails details;
	details.messageID = row.GetUInt(0);
	details.senderID = row.GetUInt(1);
	details.subject = row.GetText(2);
	details.body = row.GetText(3);
	details.created = row.GetUInt64(7);
	details.channelID = row.GetUInt(8);
	details.deleted = 0; // If a message's details are sent, then it isn't deleted. If it's deleted, details cannot be sent
	details.mimeTypeID = row.GetInt(4);
	details.mimeType = row.GetText(5);
	details.binary = row.GetInt(6);

	return(details.Encode());
}
开发者ID:Almamu,项目名称:evemu_apocrypha,代码行数:44,代码来源:LSCDB.cpp

示例13: GetOrderInfo

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;
}
开发者ID:Camwarp,项目名称:evemu_server,代码行数:43,代码来源:MarketDB.cpp

示例14: GetLabels

PyRep* MailDB::GetLabels(int characterID) const
{
    DBQueryResult res;
    if (!sDatabase.RunQuery(res, "SELECT bit, name, color, ownerId FROM mailLabel WHERE ownerID = %u", characterID))
        return NULL;

    PyDict* ret = new PyDict();

    DBResultRow row;
    while (res.GetRow(row))
    {
        MailLabel label;
        label.id = (int)pow((float)2, row.GetInt(0));
        label.name = row.GetText(1);
        label.color = row.GetInt(2);

        ret->SetItem(new PyInt(label.id), label.Encode());
    }

    return ret;
}
开发者ID:Ahava,项目名称:evemu_server,代码行数:21,代码来源:MailDB.cpp

示例15: 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;
}
开发者ID:Ahava,项目名称:evemu_server,代码行数:22,代码来源:EVEDBUtils.cpp


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