当前位置: 网学 > 编程文档 > MySQL > 正文

提高MySQL 查询效率的三个技巧

来源:Http://myeducs.cn 联系QQ:点击这里给我发消息 作者: 用户投稿 来源: 网络 发布时间: 13/08/02
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
  • 上一篇资讯: MySQL中group_concat函数
  • 网学推荐

    免费论文

    原创论文

    设为首页 | 加入收藏 | 论文首页 | 论文专题 | 设计下载 | 网学软件 | 论文模板 | 论文资源 | 程序设计 | 关于网学 | 站内搜索 | 网学留言 | 友情链接 | 资料中心
    版权所有 QQ:3710167 邮箱:3710167@qq.com 网学网 [Myeducs.cn] 您电脑的分辨率是 像素
    Copyright 2008-2015 myeducs.Cn www.myeducs.Cn All Rights Reserved 湘ICP备09003080号