void Statement::BindParams( const Bindings& bindings )
	{
		if (m_kQueryParts.size())
		{
			FV_ASSERT( bindings.size() == m_kQueryParts.size()-1 );
			m_kParams = bindings;
		}
	}
Пример #2
0
bool RegDB::getUnexpiredContactsUserContaining(const string& matchIdentity, int timeNow, Bindings& bindings) const
{
	mongo::BSONObj query = BSON("expirationTime" << BSON_GREATER_THAN(timeNow));

	mongo::ScopedDbConnection conn(_info.getConnectionString());
	auto_ptr<mongo::DBClientCursor> pCursor = conn->query(_info.getNS(), query);
	if (pCursor.get() && pCursor->more())
	{
		while (pCursor->more())
		{
			RegBinding binding(pCursor->next());
			if (binding.getContact().find(matchIdentity) != string::npos)
				bindings.push_back(binding);
		}
		conn.done();
		return bindings.size() > 0;
	}

	conn.done();
	return false;
}