sp; hostcache[i].internalPort = atoi(m_Row); } } else { //随机的挑选指定条记录返回 int iRemainder = iAllNumRows%iReturnNumRows; ///<余数 int iQuotient = iAllNumRows/iReturnNumRows; ///<商 int iStartIndex = rand()%(iRemainder + 1); ///<开始下标 //获取逐条记录 for(int iSelectedIndex = 0; iSelectedIndex < iReturnNumRows; iSelectedIndex++) { mysql_data_seek(m_pResultSet, iStartIndex + iQuotient * iSelectedIndex); m_Row = mysql_fetch_row(m_pResultSet); if(m_Row[0] != NULL) strcpy(hostcache[iSelectedIndex].sessionid, m_Row[0]); if(m_Row != NULL) strcpy(hostcache[iSelectedIndex].channelid, m_Row); if(m_Row != NULL) hostcache[iSelectedIndex].ISPtype = atoi(m_Row); if(m_Row != NULL) hostcache[iSelectedIndex].externalIP = atoi(m_Row); if(m_Row != NULL) hostcache[iSelectedIndex].externalPort = atoi(m_Row); if(m_Row != NULL) hostcache[iSelectedIndex].internalIP = atoi(m_Row); if(m_Row != NULL) hostcache[iSelectedIndex].internalPort = atoi(m_Row); } } //释放结果集内容 mysql_free_result(m_pResultSet);&n