TH]; memset(selectSQL, 0, sizeof(selectSQL)); sprintf(selectSQL,"select * from HostCache where ChannelID = '%s' and ISPtype = %d", channelid, ISPtype); if(mysql_real_query(connecthandle, selectSQL, strlen(selectSQL)) != 0) //检索 return 0; //获取结果集 m_pResultSet = mysql_store_result(connecthandle); if(!m_pResultSet) //获取结果集出错 return 0; int iAllNumRows = (int)(mysql_num_rows(m_pResultSet)); ///<所有的
搜索结果数 //计算待返回的结果数 int iReturnNumRows = (iAllNumRows <= RETURN_QUERY_HOST_NUM)? iAllNumRows:RETURN_QUERY_HOST_NUM; if(iReturnNumRows <= RETURN_QUERY_HOST_NUM) { //获取逐条记录 for(int i = 0; i<iReturnNumRows; i++) { //获取逐个字段 m_Row = mysql_fetch_row(m_pResultSet); if(m_Row[0] != NULL) strcpy(hostcache[i].sessionid, m_Row[0]); if(m_Row != NULL) strcpy(hostcache[i].channelid, m_Row); if(m_Row != NULL) hostcache[i].ISPtype = atoi(m_Row); if(m_Row != NULL) hostcache[i].externalIP = atoi(m_Row); if(m_Row != NULL) hostcache[i].externalPort = atoi(m_Row); if(m_Row != NULL) hostcache[i].internalIP = atoi(m_Row); if(m_Row != NULL) &nb