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


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

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


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

示例1: GetAccountInfo

bool APIAccountDB::GetAccountInfo(uint32 accountID, std::vector<std::string> & accountInfoList)
{
    DBQueryResult res;

    // Get account table info using the accountID:
    if( !sDatabase.RunQuery(res,
        " SELECT "
        "   online, "
        "   banned, "
        "   logonCount, "
        "   lastLogin "
        " FROM account "
        " WHERE `accountID` = %u ", accountID ))
    {
        sLog.Error( "APIAccountDB::GetAccountInfo()", "Cannot find accountID %u", accountID );
        return false;
    }

    DBResultRow row;
    if( !res.GetRow(row) )
    {
        sLog.Error( "APIServiceDB::GetAccountInfo()", "res.GetRow(row) failed for unknown reason." );
        return false;
    }

    accountInfoList.push_back( std::string(row.GetText(0)) );
    accountInfoList.push_back( std::string(row.GetText(1)) );
    accountInfoList.push_back( std::string(row.GetText(2)) );
    accountInfoList.push_back( std::string(row.GetText(3)) );

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

示例2: GetChannelNames

void LSCDB::GetChannelNames(uint32 charID, std::vector<std::string> & names) {
	DBQueryResult res;

	if (!sDatabase.RunQuery(res, 
		" SELECT "
		"	entity.itemName AS characterName, "
		"	corporation.corporationName, "
		"	mapSolarSystems.solarSystemName, "
		"	mapConstellations.constellationName, "
		"	mapRegions.regionName "
		" FROM character_ "
		"	LEFT JOIN entity ON character_.characterID = entity.itemID "
		"	LEFT JOIN corporation ON character_.corporationID = corporation.corporationID "
		"	LEFT JOIN mapSolarSystems ON character_.solarSystemID = mapSolarSystems.solarSystemID "
		"	LEFT JOIN mapConstellations ON character_.constellationID = mapConstellations.constellationID "
		"	LEFT JOIN mapRegions ON character_.regionID = mapRegions.regionID "
		" WHERE character_.characterID = %u ", charID))
	{
		codelog(SERVICE__ERROR, "Error in query: %s", res.error.c_str());
		return;
	}

	DBResultRow row;

	if (!res.GetRow(row)) {
		_log(SERVICE__ERROR, "CharID %u isn't present in the database", charID);
		return;
	}

	names.push_back(row.GetText(0));	// charName
	names.push_back(row.GetText(1));	// corpName
	names.push_back(row.GetText(2));	// solsysName
	names.push_back(row.GetText(3));	// constName
	names.push_back(row.GetText(4));	// regionName
}
开发者ID:Almamu,项目名称:evemu_apocrypha,代码行数:35,代码来源:LSCDB.cpp

示例3: GetApiAccountInfoUsingAccountID

bool APIServiceDB::GetApiAccountInfoUsingAccountID(std::string accountID, uint32 * userID, std::string * apiFullKey,
    std::string * apiLimitedKey, uint32 * apiRole)
{
    DBQueryResult res;

    // Find userID, fullKey, limitedKey, and apiRole from 'accountApi' table using accountID obtained from 'account' table:
    if( !sDatabase.RunQuery(res,
        "SELECT"
        "    userID, fullKey, limitedKey, apiRole "
        " FROM accountApi "
        " WHERE accountID='%s'" , accountID.c_str() ))
    {
        sLog.Error( "APIServiceDB::GetApiAccountInfoUsingAccountID()", "Cannot find accountID '%s' in 'accountApi' table", accountID.c_str() );
        return false;
    }

    DBResultRow row;
    if( !res.GetRow(row) )
    {
        sLog.Error( "APIServiceDB::GetApiAccountInfoUsingAccountID()", "res.GetRow(row) failed for unknown reason." );
        return false;
    }

    *userID = row.GetUInt(0);            // Grab userID from retrieved row from the 'accountApi' table
    *apiFullKey = row.GetText(1);        // Grab Full API Key from retrieved row from the 'accountApi' table
    *apiLimitedKey = row.GetText(2);    // Grab Limited API Key from retrieved row from the 'accountApi' table
    *apiRole = row.GetUInt(3);            // Grab API Role from retrieved row from the 'accountApi' table
    return true;
}
开发者ID:Camwarp,项目名称:evemu_server,代码行数:29,代码来源:APIServiceDB.cpp

示例4: GetCharactersList

bool APIAccountDB::GetCharactersList(uint32 accountID, std::vector<std::string> & charIDList, std::vector<std::string> & charNameList,
    std::vector<std::string> & charCorpIDList, std::vector<std::string> & charCorpNameList)
{
    DBQueryResult res;

    // Get list of characters and their corporation info from the accountID:
    if( !sDatabase.RunQuery(res,
        " SELECT "
        "   character_.characterID, "
        "   character_.corporationID, "
        "   corporation.corporationName, "
        "   entity.itemName AS name "
        " FROM `character_` "
        "   LEFT JOIN corporation ON corporation.corporationID = character_.corporationID "
        "   LEFT JOIN entity ON entity.itemID = character_.characterID "
        " WHERE `accountID` = %u ", accountID ))
    {
        sLog.Error( "APIAccountDB::GetCharactersList()", "Cannot find accountID %u", accountID );
        return false;
    }

    DBResultRow row;
    std::map<std::string, std::string> charInfo;
    while( res.GetRow( row ) )
    {
        charIDList.push_back( std::string(row.GetText(0)) );
        charCorpIDList.push_back( std::string(row.GetText(1)) );
        charCorpNameList.push_back( std::string(row.GetText(2)) );
        charNameList.push_back( std::string(row.GetText(3)) );
    }

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

示例5: GetCharacterInfo

bool APICharacterDB::GetCharacterInfo(uint32 characterID, std::vector<std::string> & charInfoList)
{
    DBQueryResult res;

    // Get list of characters and their corporation info from the accountID:
    if( !sDatabase.RunQuery(res,
        " SELECT "
        "  character_.balance, "
        "  character_.skillPoints, "
        "  character_.corporationID, "
        "  character_.corpRole, "
        "  character_.rolesAtAll, "
        "  character_.rolesAtBase, "
        "  character_.rolesAtHQ, "
        "  character_.rolesAtOther, "
        "  character_.startDateTime, "
        "  character_.gender, "
        "  chrAncestries.ancestryName, "
        "  chrBloodlines.bloodlineName, "
        "  chrRaces.raceName, "
        "  entity.itemName, "
        "  corporation.corporationName "
        " FROM character_ "
        "  LEFT JOIN chrAncestries ON character_.ancestryID = chrAncestries.ancestryID "
        "  LEFT JOIN chrBloodlines ON chrAncestries.bloodlineID = chrBloodlines.bloodlineID "
        "  LEFT JOIN chrRaces ON chrBloodlines.raceID = chrRaces.raceID "
        "  LEFT JOIN entity ON entity.itemID = character_.characterID "
        "  LEFT JOIN corporation ON corporation.corporationID = character_.corporationID "
        " WHERE character_.characterID = %u ", characterID ))
    {
        sLog.Error( "APIAccountDB::GetCharacterSkillsTrained()", "Cannot find characterID %u", characterID );
        return false;
    }

    DBResultRow row;
    if( !res.GetRow(row) )
    {
        sLog.Error( "APIServiceDB::GetAccountIdFromUsername()", "res.GetRow(row) failed for unknown reason." );
        return false;
    }

    charInfoList.push_back( std::string(row.GetText(0)) );      // 0. Balance
    charInfoList.push_back( std::string(row.GetText(1)) );      // 1. Skill Points
    charInfoList.push_back( std::string(row.GetText(2)) );     // 2. corporationID
    charInfoList.push_back( std::string(row.GetText(3)) );     // 3. corp Role
    charInfoList.push_back( std::string(row.GetText(4)) );     // 4. roles At All
    charInfoList.push_back( std::string(row.GetText(5)) );     // 5. roles At Base
    charInfoList.push_back( std::string(row.GetText(6)) );     // 6. roles At HQ
    charInfoList.push_back( std::string(row.GetText(7)) );     // 7. roles At Other
    charInfoList.push_back( std::string(row.GetText(8)) );     // 8. birthday
    charInfoList.push_back( std::string(row.GetText(10)) );     // 9. ancestry Name
    charInfoList.push_back( std::string(row.GetText(11)) );     // 10. bloodline Name
    charInfoList.push_back( std::string(row.GetText(12)) );     // 11. race Name
    charInfoList.push_back( std::string(row.GetText(13)) );     // 12. char Name
    charInfoList.push_back( std::string(row.GetText(14)) );     // 13. corp Name
    charInfoList.push_back( std::string(row.GetText(9)) );     // 14. gender (0 = female, 1 = male)

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

示例6: GetAccountInformation

bool ServiceDB::GetAccountInformation( const char* username, const char* password, AccountInfo & account_info )
{
    std::string _username = username;
    std::string _escaped_username;

    DBcore::DoEscapeString(_escaped_username, _username);

    DBQueryResult res;
    if (!DBcore::RunQuery(res, "SELECT accountID, password, hash, role, online, banned, logonCount, lastLogin FROM srvAccount WHERE accountName = '%s'", _escaped_username.c_str()))
    {
        SysLog::Error( "ServiceDB", "Error in query: %s.", res.error.c_str() );
        return false;
    }

    DBResultRow row;
    if (!res.GetRow( row )) {
		// account not found, create new one if autoAccountRole is not zero (0)
		if(EVEServerConfig::account.autoAccountRole > 0) {
			uint32 accountID = CreateNewAccount( _username.c_str(), password, EVEServerConfig::account.autoAccountRole);
			if( accountID > 0 ) {
				// add new account successful, get account info again
				bool ret = GetAccountInformation(username, password, account_info);
				return ret;
			}
			else
				return false;
		}
		else
			return false;
	}

    /* when any of the text gets are NULL it will fail... I think.. */
    account_info.id         = row.GetUInt(0);

    if (!row.IsNull(1))
        account_info.password = row.GetText(1);

    if (!row.IsNull(2))
        account_info.hash   = row.GetText(2);

    account_info.name       = _escaped_username;
    account_info.role       = row.GetUInt64(3);
    account_info.online     = row.GetBool(4);
    account_info.banned     = row.GetBool(5);
    account_info.visits     = row.GetUInt(6);

    if (!row.IsNull(7))
        account_info.last_login = row.GetText(7);

    return true;
}
开发者ID:comet0,项目名称:evemu_server,代码行数:51,代码来源:ServiceDB.cpp

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

示例8: GetAccountIdFromUsername

bool APIServiceDB::GetAccountIdFromUsername(std::string username, std::string * accountID)
{
    DBQueryResult res;

    // Find accountID in 'account' table using accountName:
    if( !sDatabase.RunQuery(res,
        "SELECT"
        "    accountID "
        " FROM account "
        " WHERE accountName='%s'" , username.c_str() ))
    {
        sLog.Error( "APIServiceDB::GetAccountIdFromUsername()", "Cannot find accountID for username %s", username.c_str() );
        return false;
    }

    DBResultRow row;
    if( !res.GetRow(row) )
    {
        sLog.Error( "APIServiceDB::GetAccountIdFromUsername()", "res.GetRow(row) failed for unknown reason." );
        return false;
    }

    *accountID = row.GetText(0);        // Grab accountID from the retrieved row from the 'account' table
    return true;
}
开发者ID:Camwarp,项目名称:evemu_server,代码行数:25,代码来源:APIServiceDB.cpp

示例9: GetChannelInfo

std::string LSCDB::GetChannelInfo(uint32 channelID, std::string & name, std::string & motd)
{
	DBQueryResult res;

	if (!sDatabase.RunQuery(res,
		" SELECT "
		"	displayName, "
		"   motd "
		" FROM channels "
		" WHERE channelID = %u ", channelID))
	{
		codelog(SERVICE__ERROR, "Error in query: %s", res.error.c_str());
		char err[20];
		snprintf(err, 20, "Unknown %u", channelID);
		return(err);
	}

	DBResultRow row;

	if (!res.GetRow(row)) {
		_log(SERVICE__ERROR, "Couldn't find %u in table channels", channelID);
		char err[20];
		snprintf(err, 20, "Unknown %u", channelID);
		return(err);
	}

	name = row.GetText(0);
	motd = row.GetText(1);

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

示例10: GetChannelName

std::string LSCDB::GetChannelName(uint32 id, const char * table, const char * column, const char * key) {
	DBQueryResult res;

	if (!sDatabase.RunQuery(res, 
		" SELECT "
		"	%s "
		" FROM %s "
		" WHERE %s = %u ", column, table, key, id))
	{
		codelog(SERVICE__ERROR, "Error in query: %s", res.error.c_str());
		char err[20];
		snprintf(err, 20, "Unknown %u", id);
		return(err);
	}

	DBResultRow row;

	if (!res.GetRow(row)) {
		_log(SERVICE__ERROR, "Couldn't find %s %u in table %s", key, id, table);
		char err[20];
		snprintf(err, 20, "Unknown %u", id);
		return(err);
	}

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

示例11: CreateMemberAttributeUpdate

bool CorporationDB::CreateMemberAttributeUpdate(MemberAttributeUpdate & attrib, uint32 newCorpID, uint32 charID) {
    // What are we doing here exactly?
    // Corporation gets a new member
    // it's new to it

    DBQueryResult res;
    DBResultRow row;
    if (!sDatabase.RunQuery(res,
        " SELECT "
        "   title, corporationDateTime, corporationID, "
        "   corpRole, rolesAtAll, rolesAtBase, "
        "   rolesAtHQ, rolesAtOther "
        " FROM character_ "
        " WHERE character_.characterID = %u ", charID))
    {
        codelog(SERVICE__ERROR, "Error in query: %s", res.error.c_str());
        return false;
    }

    if (!res.GetRow(row)) {
        codelog(SERVICE__ERROR, "Cannot find character in database");
        return false;
    }

    // this could be stored in the db
#define PRN new PyNone()
#define PRI(i) new PyInt(i)
#define PRL(i) new PyLong(i)
#define PRS(s) new PyString(s)
#define PRNI(i) (row.IsNull(i) ? PRI(0) : PRI(row.GetUInt64(i)))
#define F(name, o, n) \
    attrib.name##Old = o; \
    attrib.name##New = n

    //element                   Old Value               New Value
    F(accountKey,               PRN,                    PRN);
    // i don't even know what this could refer to
    F(baseID,                   PRN,                    PRN);
    F(characterID,              PRN,                    PRI(charID));
    F(corporationID,            PRI(row.GetUInt(2)),    PRI(newCorpID));
    // these also have to be queried from the db
    F(divisionID,               PRN,                    PRN);
    F(roles,                    PRNI(3),                PRI(0));
    F(grantableRoles,           PRNI(4),                PRI(0));
    F(grantableRolesAtBase,     PRNI(5),                PRI(0));
    F(grantableRolesAtHQ,       PRNI(6),                PRI(0));
    F(grantableRolesAtOther,    PRNI(7),                PRI(0));
    F(squadronID,               PRN,                    PRN);
    F(startDateTime,            PRL(row.GetUInt64(1)),  PRL(Win32TimeNow()));
    // another one i have no idea
    F(titleMask,                PRN,                    PRI(0));
    F(baseID,                   PRS(row.GetText(0)),    PRS(""));
#undef F
#undef PRN
#undef PRI
#undef PRS
#undef PRNI

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

示例12: GetCurrentApplicationInfo

bool CorporationDB::GetCurrentApplicationInfo(uint32 charID, uint32 corpID, ApplicationInfo & aInfo) {
    DBQueryResult res;
    if (!sDatabase.RunQuery(res,
        " SELECT "
        " status, applicationText, applicationDateTime, roles, grantableRoles, lastCorpUpdaterID, deleted "
        " FROM chrApplications "
        " WHERE characterID = %u AND corporationID = %u ",
        charID, corpID))
    {
        codelog(SERVICE__ERROR, "Error in query: %s", res.error.c_str());
        aInfo.valid = false;
        return false;
    }

    DBResultRow row;
    if (!res.GetRow(row)) {
        _log(DATABASE__ERROR, "There's no previous application.");
        aInfo.valid = false;
        return false;
    }

    aInfo.charID = charID;
    aInfo.corpID = corpID;
    aInfo.status = row.GetUInt(0);
    aInfo.appText = row.GetText(1);
    aInfo.appTime = row.GetUInt64(2);
    aInfo.role = row.GetUInt64(3);
    aInfo.grantRole = row.GetUInt64(4);
    aInfo.lastCID = row.GetUInt(5);
    aInfo.deleted = row.GetUInt(6);
    aInfo.valid = true;
    return true;
}
开发者ID:AlTahir,项目名称:Apocrypha_combo,代码行数:33,代码来源:CorporationDB.cpp

示例13: load_name_validation_set

void CharacterDB::load_name_validation_set()
{
	DBQueryResult res;
	if(!sDatabase.RunQuery(res,
		"SELECT"
		" characterID, itemName AS characterName"
		" FROM character_"
		"	JOIN entity ON characterID = itemID"
		))
	{
		codelog(SERVICE__ERROR, "Error in query for %s", res.error.c_str());
		return;
	}

	DBResultRow row;
	while(res.GetRow(row) == true)
	{
		uint32 characterID = row.GetUInt(0);
		const char* name = row.GetText(1);

		//printf("initializing name validation: %s\n", name);
		uint32 hash = djb2_hash(name);

		mNameValidation.insert(hash);
		mIdNameContainer.insert(std::make_pair(characterID, name));
	}
}
开发者ID:adam3696,项目名称:evemu_apocrypha,代码行数:27,代码来源:CharacterDB.cpp

示例14: ItemSearch

bool CommandDB::ItemSearch(const char *query, std::map<uint32, std::string> &into) {

    std::string escaped;
    sDatabase.DoEscapeString(escaped, query);

    DBQueryResult result;
    DBResultRow row;

    into.clear();

    //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 typeID,typeName"
        " FROM invTypes"
        " WHERE"
        "  typeName rlike '%s'",
            escaped.c_str()
        ))
    {
        codelog(SERVICE__ERROR, "Error in query: %s", result.error.c_str());
        return (false);
    }

    while(result.GetRow(row)) {
        into[row.GetUInt(0)] = row.GetText(1);
    }
    return true;
}
开发者ID:Almamu,项目名称:evemu_server,代码行数:29,代码来源:CommandDB.cpp

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


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