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


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

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


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

示例1: 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

示例2: LoadStatic

bool ReprocessingDB::LoadStatic(const uint32 stationID, double &efficiency, double &tax) {
    DBQueryResult res;

    if(!sDatabase.RunQuery(res,
                "SELECT reprocessingEfficiency, reprocessingStationsTake"
                " FROM staStations"
                " WHERE stationID=%u",
                stationID))
    {
        _log(DATABASE__ERROR, "Failed to get reprocessing info for station %u: '%s'.", stationID, res.error.c_str());
        return false;
    }

    DBResultRow row;

    if(!res.GetRow(row)) {
        _log(DATABASE__ERROR, "No data found for stationID %u.", stationID);
        return false;
    }

    efficiency = row.GetDouble(0);
    tax = row.GetDouble(1);

    return true;
}
开发者ID:Camwarp,项目名称:evemu_server,代码行数:25,代码来源:ReprocessingDB.cpp

示例3: GetAssemblyLineProperties

bool RamProxyDB::GetAssemblyLineProperties(const uint32 assemblyLineID, double &baseMaterialMultiplier, double &baseTimeMultiplier, double &costInstall, double &costPerHour) {
    DBQueryResult res;

    if(!DBcore::RunQuery(res,
        "SELECT"
        " assemblyLineType.baseMaterialMultiplier,"
        " assemblyLineType.baseTimeMultiplier,"
        " assemblyLine.costInstall,"
        " assemblyLine.costPerHour"
        " FROM ramAssemblyLines AS assemblyLine"
        " LEFT JOIN ramAssemblyLineTypes AS assemblyLineType ON assemblyLine.assemblyLineTypeID = assemblyLineType.assemblyLineTypeID"
        " WHERE assemblyLine.assemblyLineID = %u",
        assemblyLineID))
    {
        _log(DATABASE__ERROR, "Failed to query properties for assembly line %u: %s.", assemblyLineID, res.error.c_str());
        return false;
    }

    DBResultRow row;
    if(!res.GetRow(row)) {
        _log(DATABASE__ERROR, "No properties found for assembly line %u.", assemblyLineID);
        return false;
    }

    baseMaterialMultiplier = row.GetDouble(0);
    baseTimeMultiplier = row.GetDouble(1);
    costInstall = row.GetDouble(2);
    costPerHour = row.GetDouble(3);

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

示例4: 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

示例5: GetBookmarkInformation

bool BookmarkDB::GetBookmarkInformation(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)
{
    DBQueryResult res;
       DBResultRow row;

    // Query database 'srvBookmarks' table for the supplied bookmarkID and retrieve entire row:
    if (!DBcore::RunQuery(res,
        " SELECT "
        "    bookmarkID, "
        "   ownerID, "
        "   itemID, "
        "   typeID, "
        "   flag, "
        "   memo, "
        "   created, "
        "   x, "
        "   y, "
        "   z, "
        "   locationID, "
        "  note,"
        "  creatorID,"
        "  folderID"
        " FROM srvBookmarks "
        " WHERE bookmarkID = %u ", bookmarkID))
    {
        SysLog::Error( "BookmarkDB::GetBookmarkInformation()", "Error in query: %s", res.error.c_str() );
        return false;
    }

    // Query went through, but check to see if there were zero rows, ie bookmarkID was invalid:
    if ( !(res.GetRow(row)) )
        return false;

    // Bookmark 'bookmarkID' was found, Send back bookmark information:
    ownerID = row.GetUInt(1);
    itemID = row.GetUInt(2);
    typeID = row.GetUInt(3);
    flag = row.GetUInt(4);
    memo = row.GetText(5);
    created = row.GetUInt64(6);
    x = row.GetDouble(7);
    y = row.GetDouble(8);
    z = row.GetDouble(9);
    locationID = row.GetUInt(10);
    note = row.GetUInt(11);
    creatorID = row.GetUInt(12);
    folderID = row.GetUInt(13);

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

示例6: loadStaStationTypes

bool EVEStatic::loadStaStationTypes()
{
    DBQueryResult result;
    DBResultRow row;
    std::string columns = "stationTypeID, dockEntryX, dockEntryY, dockEntryZ,"
            " dockOrientationX, dockOrientationY, dockOrientationZ,"
            " operationID, officeSlots, reprocessingEfficiency, conquerable,"
            " dockingBayGraphicID, hangarGraphicID";
    std::string qry = "SELECT " + columns + " FROM staStationTypes LEFT JOIN extStaStationTypes Using(stationTypeID)";
    if (!DBcore::RunQuery(result, qry.c_str()))
    {
        SysLog::Error("Static DB", "Error in query: %s", result.error.c_str());
        return false;
    }
    while (result.GetRow(row))
    {
        uint32 stationTypeID = row.GetInt(0);
        double dockEntryX = row.GetDouble(1);
        double dockEntryY = row.GetDouble(2);
        double dockEntryZ = row.GetDouble(3);
        double dockOrientationX = row.GetDouble(4);
        double dockOrientationY = row.GetDouble(5);
        double dockOrientationZ = row.GetDouble(6);
        uint32 operationID = row.getIntNC(7);
        uint32 officeSlots = row.getIntNC(8);
        double reprocessingEfficiency = row.getDoubleNC(9);
        bool conquerable = row.GetBool(10);
        // From extStaStationTypes
        uint32 dockingBayGraphicID = row.getIntNC(11);
        uint32 hangarGraphicID = row.getIntNC(12);
        new StaStationType(
                           stationTypeID,
                           dockEntryX,
                           dockEntryY,
                           dockEntryZ,
                           dockOrientationX,
                           dockOrientationY,
                           dockOrientationZ,
                           operationID,
                           officeSlots,
                           reprocessingEfficiency,
                           conquerable,
                           dockingBayGraphicID,
                           hangarGraphicID
                           );
    }

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

示例7: GetCorpBalance

double ServiceDB::GetCorpBalance(uint32 corpID, uint32 walletKey)
{

	DBQueryResult res;
	DBResultRow row;
	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( res,
		"SELECT "
		" %s"
		" FROM corporation"
		" WHERE corporationID = %u", name.c_str(), corpID ) )
	{
		sLog.Error( "Service DB", "Error in query: %s", res.error.c_str() );
		return 0.0;
	}

	if( !res.GetRow( row ) )
	{
		sLog.Error( "Service DB", "Corporation %u missing from database", corpID );
		return 0.0;
	}

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

示例8: GetAssemblyLineVerifyProperties

bool RamProxyDB::GetAssemblyLineVerifyProperties(const uint32 assemblyLineID, uint32 &ownerID, double &minCharSecurity, double &maxCharSecurity, EVERamRestrictionMask &restrictionMask, EVERamActivity &activity) {
    DBQueryResult res;

    if(!DBcore::RunQuery(res,
        "SELECT"
        " ownerID,"
        " minimumCharSecurity,"
        " maximumCharSecurity,"
        " restrictionMask,"
        " activityID"
        " FROM ramAssemblyLines"
        " WHERE assemblyLineID = %u",
        assemblyLineID))
    {
        _log(DATABASE__ERROR, "Failed to query verify properties for assembly line %u: %s.", assemblyLineID, res.error.c_str());
        return false;
    }

    DBResultRow row;
    if(!res.GetRow(row)) {
        _log(DATABASE__ERROR, "No verify properties found for assembly line %u.", assemblyLineID);
        return false;
    }

    ownerID = row.GetUInt(0);
    minCharSecurity = row.GetDouble(1);
    maxCharSecurity = row.GetDouble(2);
    restrictionMask = (EVERamRestrictionMask)row.GetUInt(3);
    activity = (EVERamActivity)row.GetUInt(4);

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

示例9: ResetAttribute

bool AttributeMap::ResetAttribute(uint32 attrID, bool notify)
{
    //this isn't particularly efficient, but until I write a better solution, this will do
    DBQueryResult res;

    if(!sDatabase.RunQuery(res, "SELECT * FROM dgmTypeAttributes WHERE typeID='%u'", mItem.typeID())) {
        sLog.Error("AttributeMap", "Error in db load query: %s", res.error.c_str());
        return false;
    }

    DBResultRow row;
    EvilNumber attrVal;
    uint32 attributeID;

    int amount = res.GetRowCount();
    for (int i = 0; i < amount; i++)
    {
        res.GetRow(row);
        attributeID = row.GetUInt(1);
        if( attributeID == attrID )
        {
            if(!row.IsNull(2))
                attrVal = row.GetUInt64(2);
            else
                attrVal = row.GetDouble(3);

            SetAttribute(attributeID, attrVal, notify);
        }
    }

    return true;

}
开发者ID:Camwarp,项目名称:evemu_server,代码行数:33,代码来源:EVEAttributeMgr.cpp

示例10: _GetMultipliers

bool RamProxyDB::_GetMultipliers(const uint32 assemblyLineID, uint32 groupID, double &materialMultiplier, double &timeMultiplier) {
    DBQueryResult res;

    // check table ramAssemblyLineTypeDetailPerGroup first
    if(!DBcore::RunQuery(res,
                "SELECT materialMultiplier, timeMultiplier"
                " FROM ramAssemblyLineTypeDetailPerGroup"
                " JOIN ramAssemblyLines USING (assemblyLineTypeID)"
                " WHERE assemblyLineID = %u"
                " AND groupID = %u",
                assemblyLineID, groupID))
    {
        _log(DATABASE__ERROR, "Failed to check producability of group %u by line %u: %s", groupID, assemblyLineID, res.error.c_str());
        return false;
    }

    DBResultRow row;
    if(res.GetRow(row)) {
        materialMultiplier = row.GetDouble(0);
        timeMultiplier = row.GetDouble(1);
        return true;
    }

    // then ramAssemblyLineTypeDetailPerCategory
    if(!DBcore::RunQuery(res,
                "SELECT materialMultiplier, timeMultiplier"
                " FROM ramAssemblyLineTypeDetailPerCategory"
                " JOIN ramAssemblyLines USING (assemblyLineTypeID)"
                " JOIN invGroups USING (categoryID)"
                " WHERE assemblyLineID = %u"
                " AND groupID = %u",
                assemblyLineID, groupID))
    {
        _log(DATABASE__ERROR, "Failed to check producability of group %u by line %u: %s", groupID, assemblyLineID, res.error.c_str());
        return false;
    }

    if(res.GetRow(row)) {
        materialMultiplier = row.GetDouble(0);
        timeMultiplier = row.GetDouble(1);
        return true;
    } else {
        return false;
    }
}
开发者ID:eve-moo,项目名称:evemu_server,代码行数:45,代码来源:RamProxyDB.cpp

示例11: GetStaticItemInfo

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

示例12: GetCorpBalance

double ServiceDB::GetCorpBalance(uint32 corpID) {
    DBQueryResult res;
    DBResultRow row;
    if (!sDatabase.RunQuery(res, "SELECT balance FROM corporation WHERE corporationID = %u ", corpID))
    {
        sLog.Error("Service DB", "Error in query: %s", res.error.c_str());
        return 0.0;
    }
    if (!res.GetRow(row))
    {
        sLog.Error("Service DB", "Corporation %u missing from database.", corpID);
        return 0.0;
    }
    return row.GetDouble(0);
}
开发者ID:Almamu,项目名称:evemu_crucible,代码行数:15,代码来源:AccountDB.cpp

示例13: GetRoidDist

bool CommandDB::GetRoidDist(const char * sec, std::map<double, uint32> &roids) {
    DBQueryResult res;
    DBResultRow row;

    if (!sDatabase.RunQuery(res,
        " SELECT roidID, percent FROM roidDistribution WHERE systemSec = '%s' ", sec))
    {
        codelog(SERVICE__ERROR, "Error in query: %s", res.error.c_str());
        return false;
    }

    double tot = 0.0;
    while (res.GetRow(row)) {
        tot += row.GetDouble(1);
        roids[tot] = row.GetUInt(0);
    }

    return !roids.empty();
}
开发者ID:Almamu,项目名称:evemu_server,代码行数:19,代码来源:CommandDB.cpp

示例14: 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

示例15: UpdateCorporation

bool CorporationDB::UpdateCorporation(uint32 corpID, const Call_UpdateCorporation & upd, PyDict * notif) {
    DBQueryResult res;

    if (!sDatabase.RunQuery(res,
        " SELECT description, url, taxRate "
        " FROM corporation "
        " WHERE corporationID = %u ", corpID))
    {
        codelog(SERVICE__ERROR, "Error in query: %s", res.error.c_str());
        return false;
    }

    DBResultRow row;
    if (!res.GetRow(row)) {
        _log(DATABASE__ERROR, "Corporation %u doesn't exists.", corpID);
        return false;
    }

    std::vector<std::string> dbQ;
    ProcessStringChange("description", row.GetText(0), upd.description, notif, dbQ);
    ProcessStringChange("url", row.GetText(1), upd.address, notif, dbQ);
    ProcessRealChange("taxRate", row.GetDouble(2), upd.tax, notif, dbQ);

    std::string query = " UPDATE corporation SET ";

    int N = dbQ.size();
    for (int i = 0; i < N; i++) {
        query += dbQ[i];
        if (i < N - 1) query += ", ";
    }

    query += " WHERE corporationID = %u";

    // only update if there is anything to update
    if ((N > 0) && (!sDatabase.RunQuery(res.error, query.c_str(), corpID))) {
        codelog(SERVICE__ERROR, "Error in query: %s", res.error.c_str());
        return false;
    }

    return true;

}
开发者ID:AlTahir,项目名称:Apocrypha_combo,代码行数:42,代码来源:CorporationDB.cpp


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