本文整理汇总了C++中DatabaseResult::getNextRow方法的典型用法代码示例。如果您正苦于以下问题:C++ DatabaseResult::getNextRow方法的具体用法?C++ DatabaseResult::getNextRow怎么用?C++ DatabaseResult::getNextRow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DatabaseResult
的用法示例。
在下文中一共展示了DatabaseResult::getNextRow方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _loadMessageProcessMap
void MessageRouter::_loadMessageProcessMap(void)
{
MessageRoute route;
// We need to populate our message map.
// setup our databinding parameters.
DataBinding* binding = mDatabase->createDataBinding(2);
binding->addField(DFT_uint32, offsetof(MessageRoute, mMessageId), 4);
binding->addField(DFT_uint32, offsetof(MessageRoute, mProcessId), 4);
// Execute our statement
DatabaseResult* result = mDatabase->executeSynchSql("SELECT messageId, processId FROM %s.config_message_routes;",mDatabase->galaxy());
uint32 count = static_cast<uint32>(result->getRowCount());
// Retrieve our routes and add them to the map.
for(uint32 i = 0; i < count; i++)
{
result->getNextRow(binding, &route);
mMessageRouteMap.insert(std::make_pair(route.mMessageId, route.mProcessId));
}
// Delete our DB objects.
mDatabase->destroyDataBinding(binding);
mDatabase->destroyResult(result);
}
示例2: handleSessionConnect
NetworkClient* ServerManager::handleSessionConnect(Session* session, Service* service)
{
NetworkClient* newClient = 0;
ServerAddress serverAddress;
// Execute our statement
int8 sql[500];
sprintf(sql,"SELECT id, address, port, status, active FROM %s.config_process_list WHERE address='%s' AND port=%u;",mDatabase->galaxy(), session->getAddressString(), session->getPortHost());
DatabaseResult* result = mDatabase->executeSynchSql(sql);
// If we found them
if(result->getRowCount() == 1)
{
// Retrieve our routes and add them to the map.
result->getNextRow(mServerBinding,&serverAddress);
// put this fresh data in our list.
newClient = new ConnectionClient();
ConnectionClient* connClient = reinterpret_cast<ConnectionClient*>(newClient);
ConnectionClient* oldClient = mServerAddressMap[serverAddress.mId].mConnectionClient;
if(oldClient)
{
delete(oldClient);
--mTotalConnectedServers;
}
connClient->setServerId(serverAddress.mId);
memcpy(&mServerAddressMap[serverAddress.mId], &serverAddress, sizeof(ServerAddress));
mServerAddressMap[serverAddress.mId].mConnectionClient = connClient;
DLOG(info) << "*** Backend server connected id: " << mServerAddressMap[serverAddress.mId].mId;
// If this is one of the servers we're waiting for, then update our count
if(mServerAddressMap[serverAddress.mId].mActive)
{
++mTotalConnectedServers;
if(mTotalConnectedServers == mTotalActiveServers)
{
mDatabase->executeProcedureAsync(0, 0, "CALL %s.sp_GalaxyStatusUpdate(%u, %u);",mDatabase->galaxy(), 2, mClusterId); // Set status to online
}
}
}
else
{
LOG(warning) << "*** Backend server connect error - Server not found in DB" << sql;
}
// Delete our DB objects.
mDatabase->destroyResult(result);
return(newClient);
}
示例3: _processSelectCharacter
//======================================================================================================================
void ClientManager::_processSelectCharacter(ConnectionClient* client, Message* message)
{
uint64 characterId = message->getUint64();
DatabaseResult* result = mDatabase->executeSynchSql("SELECT planet_id FROM %s.characters WHERE id=%"PRIu64";",mDatabase->galaxy(), characterId);
uint32 serverId;
DataBinding* binding = mDatabase->createDataBinding(1);
binding->addField(DFT_uint32, 0, 4);
result->getNextRow(binding, &serverId);
client->setServerId(serverId + 8); // server ids for zones are planetId + 8;
mDatabase->destroyDataBinding(binding);
mDatabase->destroyResult(result);
// send an opClusterClientConnect message to zone server.
gMessageFactory->StartMessage();
gMessageFactory->addUint32(opClusterClientConnect);
gMessageFactory->addUint64(characterId);
Message* zoneMessage = gMessageFactory->EndMessage();
// This one goes to the ZoneServer the client is currently on.
zoneMessage->setAccountId(client->getAccountId());
zoneMessage->setDestinationId(static_cast<uint8>(serverId + 8));
zoneMessage->setRouted(true);
mMessageRouter->RouteMessage(zoneMessage, client);
// send an opClusterClientConnect message to chat server.
gMessageFactory->StartMessage();
gMessageFactory->addUint32(opClusterClientConnect);
gMessageFactory->addUint64(characterId);
gMessageFactory->addUint32(serverId);
Message* chatMessage = gMessageFactory->EndMessage();
// This one goes to the ChatServer
chatMessage->setAccountId(client->getAccountId());
chatMessage->setDestinationId(CR_Chat);
chatMessage->setRouted(true);
mMessageRouter->RouteMessage(chatMessage, client);
// Now send the SelectCharacter message off to the zone server.
gMessageFactory->StartMessage();
gMessageFactory->addData(message->getData(), message->getSize());
Message* selectMessage = gMessageFactory->EndMessage();
selectMessage->setAccountId(client->getAccountId());
selectMessage->setDestinationId(static_cast<uint8>(serverId + 8));
selectMessage->setRouted(true);
mMessageRouter->RouteMessage(selectMessage, client);
}
示例4: LoadCurrentGlobalTick
void WorldManager::LoadCurrentGlobalTick()
{
uint64 Tick;
DatabaseResult* temp = mDatabase->executeSynchSql("SELECT Global_Tick_Count FROM %s.galaxy WHERE galaxy_id = '2'",mDatabase->galaxy());
DataBinding* tickbinding = mDatabase->createDataBinding(1);
tickbinding->addField(DFT_uint64,0,8,0);
temp->getNextRow(tickbinding,&Tick);
mDatabase->destroyDataBinding(tickbinding);
mDatabase->destroyResult(temp);
LOG(info) << "Current global tick count [" << Tick << "]";
mTick = Tick;
mSubsystemScheduler->addTask(fastdelegate::MakeDelegate(this,&WorldManager::_handleTick),7,1000,NULL);
}
示例5: _loadProcessAddressMap
void ServerManager::_loadProcessAddressMap(void)
{
//bool serversOnline = false;
ServerAddress serverAddress;
// retrieve our list of process addresses.
DatabaseResult* result = mDatabase->executeSynchSql("SELECT id, address, port, status, active FROM %s.config_process_list WHERE active=1 ORDER BY id;",mDatabase->galaxy());
mTotalActiveServers = static_cast<uint32>(result->getRowCount());
for(uint32 i = 0; i < mTotalActiveServers; i++)
{
// Retrieve our server data
result->getNextRow(mServerBinding,&serverAddress);
memcpy(&mServerAddressMap[serverAddress.mId], &serverAddress, sizeof(ServerAddress));
mServerAddressMap[serverAddress.mId].mConnectionClient = NULL;
}
// Delete our DB objects.
mDatabase->destroyResult(result);
}