Exemple #1
0
        private bool checkHasData(string tabelName, string dataName, string dataValue)
        {
            string sql    = "select count(0) from " + tabelName + " where " + dataName + "='" + dataValue + "'";
            int    result = Convert.ToInt32(cmd.GetOne(sql));

            if (result.Equals(1))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #2
0
        public static DataPage GetPageInfo()
        {
            DataBaseServer.MySqlCmd cmd = new DataBaseServer.MySqlCmd();

            #region 获取查询开始uid
            int    pageSize  = 500;
            string maxuidsql = "select max(uid) from releaseinfo";
            object oc        = cmd.GetOne(maxuidsql);
            long   maxId     = 0;
            if (!(oc is System.DBNull))
            {
                if (oc is long)
                {
                    maxId = (long)oc;
                }
                else
                {
                    maxId = (int)oc;
                }
            }

            string minuidsql = "select min(uid) from releaseinfo";
            oc = cmd.GetOne(minuidsql);
            long minId = 0;
            if (!(oc is System.DBNull))
            {
                if (oc is long)
                {
                    minId = (long)oc;
                }
                else
                {
                    minId = (int)oc;
                }
            }

            #endregion
            DataPage dp = new DataPage();
            dp.maxUid    = maxId;
            dp.minUid    = minId;
            dp.pageSize  = pageSize;
            dp.pageIdx   = 1;
            dp.pageCount = (maxId - minId) / pageSize;
            dp.isInited  = true;

            return(dp);
        }
Exemple #3
0
        //判断url是否已经被抓取过,被抓取过的,就不再抓取
        public static bool UrlExist(string url)
        {
            bool result = false;

            DataBaseServer.MySqlCmd cmd = new DataBaseServer.MySqlCmd();
            String sql   = "select count(0) from urls where url='" + url + "'";
            int    count = int.Parse(cmd.GetOne(sql).ToString());

            result = count > 0 ? true : false;
            return(result);
        }
Exemple #4
0
        public static DataPage GetPageInfo()
        {
            DataBaseServer.MySqlCmd cmd = new DataBaseServer.MySqlCmd();

            #region 获取查询开始uid
            int pageSize = 500;
            string maxuidsql = "select max(uid) from releaseinfo";
            object oc = cmd.GetOne(maxuidsql);
            long maxId = 0;
            if (!(oc is System.DBNull))
            {
                if (oc is long)
                {
                    maxId = (long)oc;
                }
                else
                {
                    maxId = (int)oc;
                }
            }

            string minuidsql = "select min(uid) from releaseinfo";
            oc = cmd.GetOne(minuidsql);
            long minId = 0;
            if (!(oc is System.DBNull))
            {
                if (oc is long)
                {
                    minId = (long)oc;
                }
                else
                {
                    minId = (int)oc;
                }
            }

            #endregion
            DataPage dp = new DataPage();
            dp.maxUid = maxId;
            dp.minUid = minId;
            dp.pageSize = pageSize;
            dp.pageIdx = 1;
            dp.pageCount = (maxId - minId) / pageSize;
            dp.isInited = true;

            return dp;
        }