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


C++ StoreQueryResult::size方法代码示例

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


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

示例1: ipFind

// Find users with <ip>
vector<size_t> ipFind( database *database, string IP_ ) {
    socketTCP		socket("0.0.0.0");
    string			domain, ip, ipTmp;
	vector<size_t>	members;
	size_t			pos;
    // Resolve domain/ip
    ip      = socket.hostnameLookup( IP_ );	
    domain  = socket.ipLookup( IP_ );	

	if(!ip.size()) {

		// Remove after *
		size_t	pos = IP_.find("*");
		if(pos != string::npos) {
			
			IP_ = IP_.substr(0, pos);
		}

		ip = IP_;
	}

	// Get a list of similar ips
	StoreQueryResult			IPs = database->ipFind( ip );
	StoreQueryResult::iterator	ipIT;
	Row							IPRow;

	if( !IPs.size() )
		IPs = database->ipFind( domain );

	if(IPs.size() ) {

		// Add each matching member to the vector
		for( ipIT = IPs.begin(); ipIT != IPs.end(); ipIT++ ) {
			IPRow = *ipIT;
			members.push_back( (size_t) IPRow["memberID"] );
		}
		return members;
	}

	// Now get all IPs, resolve them all and try and match

	IPs = database->ipsRead(0);
	for( ipIT = IPs.begin(); ipIT != IPs.end(); ipIT++ ) {
		IPRow = *ipIT;
		
		ipTmp = (string) IPRow["ip"];
		if( (pos = ipTmp.find("*")) != string::npos) {
			ipTmp = ipTmp.substr(0, pos-1);
			if( ip.find( ipTmp) != string::npos )
				members.push_back( (size_t) IPRow["memberID"] );
		}

		ipTmp     = socket.hostnameLookup( ipTmp );

		if( ip == ipTmp )
			members.push_back( (size_t) IPRow["memberID"] );
	}

	return members;
}
开发者ID:segrax,项目名称:KiLLARMY,代码行数:61,代码来源:stdafx.cpp

示例2: checkEntryDBFolder

int _ftpEntry::checkEntryDBFolder( ) {
	Query						serverQuery = _sqlConnection->query();
	StoreQueryResult			serverResults;

	serverQuery <<  "select * from ServerFolders where serverID = " << quote << _serverID;
	serverQuery << " AND parentID = "	<< quote << _parentID;
	serverQuery << " AND name = "		<< quote << name;

	// Do the query
	serverResults	= serverQuery.store();
	
	// Folder not found?
	if( serverResults.size() == 0 )
		return 0;

	// Root dir?, Number of entrys changed?. time/date diff?, force rescan?
	if((timeModified == ""		&& name == "/")			||
	serverResults[0]["entrys"]			!= entrys		||
	serverResults[0]["modTimeDate"]		!= timeModified ||
	(int) serverResults[0]["rescanForce"]		== 1		) 
	
		return serverResults[0]["folderID"];	// Return the folderID

	return -1;
}	// checkEntryDBFolder
开发者ID:segrax,项目名称:KiLLARMY,代码行数:25,代码来源:ftpEntry.cpp

示例3:

int
CScheduler::getProcessNum()
{
	Query select = conn->query();
	select << "SELECT ProcessQuota FROM crawler WHERE name="
	  <<quote<<crawler;
	StoreQueryResult res = select.store();
	if (!res || res.size() == 0)
		return -1;
	return res[0]["ProcessQuota"];
}
开发者ID:Patrickxzm,项目名称:P_Arthur,代码行数:11,代码来源:scheduler.cpp

示例4: checkDBFolders

void _ftpEntry::checkDBFolders() {
	bool							isDone						= false;
	Query							serverQuery					= _sqlConnection->query();
	StoreQueryResult				serverResults;
	StoreQueryResult::iterator		storeQueryIT;
	vector<_ftpEntry*>::iterator	entryIT;

	// Nothing to do here...
	if( directorys.empty() )
		return;

	// Get a list of all the directorys that we parent
	serverQuery << "select * from ServerFolders where serverID = " << quote << _serverID;
	serverQuery << " AND parentID = "	<< quote << _folderID;

	// Do the query
	serverResults	= serverQuery.store();

	// None?
	if( !serverResults.size() )
		return;

	// We now have to check each DB result, against the results in directorys vector
	for(storeQueryIT = serverResults.begin(); storeQueryIT != serverResults.end(); storeQueryIT++ , isDone = false) {

		for( entryIT = directorys.begin(); entryIT != directorys.end(); entryIT++) {

			// Does this directory still exist?
			if((*entryIT)->getName() == (string) (*storeQueryIT)["name"]) {
				isDone = true;	// Yes it exists
				break;
			}	// parentID check
		}	// entryIT

		// Deleted?
		if(!isDone) {
			// Yes, remove the entry from the DB

            removeFolderChildren( (size_t) (*storeQueryIT)["folderID"] );
			serverQuery.str("");
			serverQuery << "delete from ServerFolders where folderID = "	<< quote << (*storeQueryIT)["folderID"];

			// bye bye :)
			serverQuery.execute();

		}	// !isDone

	}	// storeQueryIT

}	// checkDBFolders
开发者ID:segrax,项目名称:KiLLARMY,代码行数:50,代码来源:ftpEntry.cpp

示例5: checkEntryDBFile

int _ftpEntry::checkEntryDBFile( ) {
	Query serverQuery = _sqlConnection->query();

	serverQuery << "select * from ServerFiles where folderID = "	<< quote << _folderID;
	serverQuery << " AND name = "									<< quote << name; 

	// Fire Scotty!
	StoreQueryResult			serverResults	= serverQuery.store();
	
	// Folder not found?
	if( serverResults.size() == 0 )
		return 0;

	return serverResults[0]["folderID"];
}	// checkEntryDBFile
开发者ID:segrax,项目名称:KiLLARMY,代码行数:15,代码来源:ftpEntry.cpp

示例6: actionIP

void IRCBot::actionIP ( ircChannel pChannel, irc_reply_data *hostd, string pParameters ) {
	stringstream str;

	vector<size_t>			 members = ipFind( _db, pParameters );
	vector<size_t>::iterator memberIT;
	Row			   member;
	string		   memberName;

	// 
	//
	for( memberIT = members.begin(); memberIT != members.end(); memberIT++ ) {

		StoreQueryResult Members = _db->membersRead( *memberIT );
		
		if(Members.size()) {
			member = Members[0];
			memberName = (string) member["nameUser"];

			str << "[" << memberName << "] Matches " << pParameters;
			_irc->talkMain( str.str(), pChannel);     str.str("");
		}
	}
}
开发者ID:segrax,项目名称:KiLLARMY,代码行数:23,代码来源:IRCBot.cpp

示例7: print_result

static void
print_result(StoreQueryResult& res, int index)
{
	// Show how many rows are in result, if any
	StoreQueryResult::size_type num_results = res.size();
	if (res && (num_results > 0)) {
		cout << "Result set " << index << " has " << num_results <<
				" row" << (num_results == 1 ? "" : "s") << ':' << endl;
	}
	else {
		cout << "Result set " << index << " is empty." << endl;
		return;
	}

	// Figure out the widths of the result set's columns
	IntVectorType widths;
	size_t size = res.num_fields();
	for (size_t i = 0; i < size; i++) {
		widths.push_back(max(
				res.field(i).max_length(),
				res.field_name(i).size()));
	}

	// Print result set header
	print_row_separator(widths);
	print_header(widths, res);
	print_row_separator(widths);

	// Display the result set contents
	for (StoreQueryResult::size_type i = 0; i < num_results; ++i) {
		print_row(widths, res[i]);
	}

	// Print result set footer
	print_row_separator(widths);
}
开发者ID:9EOR9,项目名称:mysqlpp,代码行数:36,代码来源:multiquery.cpp

示例8: actionSearch

void IRCBot::actionSearch( ircChannel pChannel, irc_reply_data *hostd, string pParameters ) {
	StoreQueryResult				 serverResults;
	StoreQueryResult::iterator		 resultIT;
	bool							 modeFiles = false;
	stringstream					 irc;
	string							 serverShort;
	if(readServerName(pParameters.substr(0, pParameters.find(" "))) != 0)
		serverShort = parameterGet(pParameters);

	string							 searchTerm = parameterGet(pParameters);
	string							 resultName, next;

	Row								 server, search, folder;

	size_t searchServerID;
	size_t serverID	= readServerName( serverShort );
	size_t folderID = 0, count = 0, parentID = 0;

	searchServerID = serverID;
	if(!searchTerm.size()) {
		speak("search", "syntax wrong, usage", pChannel);
		speak("search", "folder: !search <term>", pChannel);
		speak("search", "files:  !search <term> file", pChannel);
		speak("search", "serverSpecific: !search <server shortname> <term>", pChannel);

		return;
	}

	while(pParameters.size()) {
		next = parameterGet(pParameters);

		if(next[0] == 'f' && pParameters.size() == 0) {
			modeFiles = true;
		} else {
			searchTerm.append(" ");
			searchTerm.append(next);
		}
	}

	if(modeFiles) {
		serverResults = _db->searchFiles( searchTerm );
	} else 
		serverResults = _db->searchFolders( searchTerm, readServerName(serverShort.c_str()) );
	
	if(!serverResults.size()) {
		irc << "No results for query '" << searchTerm << "'";
		speak("search", irc, pChannel);
		return;
	}

	// Have results to parse
	for( resultIT = serverResults.begin(); resultIT != serverResults.end(); resultIT++ ) {
		irc.str("");
		search = *resultIT;

		if(count > 10)
			break;

		if(modeFiles) {
			folderID	= (size_t) search["folderID"];
			folder		= _db->folderRead( folderID );

			serverID = (size_t) folder["serverID"];
			if(searchServerID && serverID != searchServerID)
				continue;

			server = _db->serverRead( serverID );
			serverShort = (string) server["nameShort"];
			resultName  = (string) search["name"];

			irc << "[" << serverShort << "]: " << resultName << " in ";

			parentID = (size_t) folder["parentID"];


		} else {
			serverID = (size_t) search["serverID"];
			server =  _db->serverRead( serverID );
			serverShort = (string) server["nameShort"];
			resultName = (string) search["name"];
			parentID = (size_t) search["parentID"];

			folder = search;
			irc << "[" << serverShort << "]: " << resultName << " in ";
		}

		if(parentID) {
			search = _db->folderRead( parentID );
				if(!search.empty())
					if((string) search["name"] != "/")
						irc << ((string) search["name"]);

		}
		if(modeFiles)
			irc << "/" << ((string) folder["name"]);

		speak("search", irc, pChannel);
		count++;
	}

//.........这里部分代码省略.........
开发者ID:segrax,项目名称:KiLLARMY,代码行数:101,代码来源:IRCBot.cpp

示例9: actionUser

void IRCBot::actionUser( ircChannel pChannel, irc_reply_data *hostd, string pParameters ) {
	stringstream	str;

	string			 name = pParameters;
	size_t			 memberID = 0;
	size_t			 memberAddedID = 0;

	client			*userClient = 0;
	moduleAuth		*modAuth	= 0;
	Row				 memberRow, memberAddedRow;
	
	memberID = atoi( pParameters.c_str() );

	if(!memberID)
		memberID = readMemberID( name );

	if(!memberID) {
		str << "[" << name << "] User not found";
		_irc->talkMain( str.str(), pChannel);
		return;
	}

	StoreQueryResult Members = _db->membersRead(memberID);
	if(!Members.size() )
		return;

	memberRow = Members[0];
	name = (string) memberRow["nameUser"];
	memberAddedID = (size_t) memberRow["addedMemberID"];
	
	StoreQueryResult memberAdded = _db->membersRead(memberAddedID);
	if(memberAdded.size() != 0)
		memberAddedRow = memberAdded[0];

	userClient = _smokingman->thepipeGet()->userClient( memberID );

	if( userClient ) {

		modAuth = userClient->moduleGet<moduleAuth>(modAUTH);

		// Online Time
		str << "[" << name << "] Time Online: " <<	timeCalc( time(0) - userClient->connectedTimeGet() );
		_irc->talkMain( str.str(), pChannel);     str.str("");

		if(modAuth) {
			// Issoria Ver, Os
			str << "[" << name << "] ";
			if( userClient->isSpidz() )
				str << "spidz v";
			else
				str << "IsSorIa v";

			str << modAuth->version() << " svn: " << modAuth->SVNRevGet() << " on ";
			str << OSNameGet( modAuth->OSGet() );
			_irc->talkMain( str.str(), pChannel);     str.str("");
		} else {
			str << "[" << name << "] moduleAuth not yet loaded.";
			_irc->talkMain( str.str(), pChannel);     str.str("");
		}

	} else {

		
		str << "[" << name << "] Not Online";
		_irc->talkMain( str.str(), pChannel);     str.str("");

		str << "[" << name << "] Last Seen: " << timeCalc( time(0) - ((time_t)memberRow["lastOnline"]));
		str << " Ago";
		_irc->talkMain( str.str(), pChannel);     str.str("");
	}

	str << "[" << name << "] Added by " << ((string) memberAddedRow["nameUser"]) << " on " << ((string) memberRow["dateJoined"]);
	_irc->talkMain( str.str(), pChannel);     str.str("");

	if( ((bool) memberRow["active"] ) == false ) {
		str << "[" << name << "] Currently is Disabled";
		_irc->talkMain( str.str(), pChannel);     str.str("");
	}

}
开发者ID:segrax,项目名称:KiLLARMY,代码行数:80,代码来源:IRCBot.cpp

示例10: HasNewFile

bool AdUserFeatureCacheI::HasNewFile(){
    stringstream sql;
    sql << " SELECT local_file, md5 FROM user_feature_version "
        << " WHERE id = (SELECT max(id) FROM user_feature_version) "
        << " AND valid = 1 ";

    StoreQueryResult res;
    try{
        const char* DB_HOST = "10.3.23.69";
        const char* DB_NAME = "ad_strategy";
        const char* DB_USER = "ad";
        const char* DB_PASSWORD = "rrad";

	Connection conn(DB_NAME, DB_HOST, DB_USER, DB_PASSWORD);
	Query query(&conn, true, sql.str().c_str());
	res = query.store();
    } catch (Ice::Exception& e){
        MCE_WARN("AdUserFeatureCacheI::HasNewVersion user_feature_version ice error! " << e.what());
        return false;
    } catch (std::exception& e){
        MCE_WARN("AdUserFeatureCacheI::HasNewVersion user_feature_version std error! " << e.what());
        return false;
    }

    if (!res){
        MCE_WARN("Query Result Error!");
        return false;
    }
    else if (res.empty()){
        MCE_INFO("nothing in db!");
        return false;
    }
    else if (res.size() > 1){
	MCE_WARN("There dirty data in user_feature_version.");
	return false;
    }

    string fileName = lexical_cast<string>(res.at(0)["local_file"]);
    string md5Value = lexical_cast<string>(res.at(0)["md5"]);
    //Loading Data of the newFileName now, not finished.
    if (isLoading_){
	MCE_INFO("The File: " << newFileName_ << " is loading.");
	return false;
    }

    /*1). Never Load Data Before. initOK_ == false
     *2). Already there is data in cache, and new file is ready.
     *    newFileName != data's fileName in cache,
     *    and the newFile content md5 != data's content md5 in cache.
     */  
    if ((!initOK_) 
        || ( (fileName != userFeatureDataPtr_->GetFileName())
             && (md5Value != userFeatureDataPtr_->GetMd5Value())
           )
       ){
        IceUtil::RWRecMutex::WLock lock(VERSION_MUTEX);
        {
            newFileName_ = fileName;
            newMd5Value_ = md5Value;;
        }
	return true;
    }
    return false;
}
开发者ID:gunner14,项目名称:old_rr_code,代码行数:64,代码来源:AdUserFeatureCacheI.cpp


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