Esempio n. 1
0
        protected override string GetPageTSql(Model.List.IDBSQLHelper list)
        {
            string sql = string.Empty;
            string sqlWhere;
            int    start = 0, SelCount = 0;
            //正序排法
            string sqlOrder = string.Empty;
            //反序排法
            string sqlOrderRev = string.Empty;

            sqlWhere = list.GetWhere();

            string tableName;

            if (string.IsNullOrEmpty(list.schema))
            {
                tableName = string.Format("`{0}`", list.table);
            }
            else
            {
                tableName = string.Format("`{0}`.`{1}`", list.schema, list.table);
            }



            if (list.CurrentPage <= 1)
            {
                if (list.PageSize == int.MaxValue)
                {
                    sql = string.Format("select {0} from {1} {2} {3}",
                                        list.GetFieldsString(), tableName, sqlWhere, list.GetOrderBy(false));
                }
                else
                {
                    sql = string.Format("select {0} from {1} {2} {3} limit {4}",
                                        list.GetFieldsString(), tableName, sqlWhere, list.GetOrderBy(false), list.PageSize);
                }

                return(sql);
            }

            start = (list.CurrentPage - 1) * list.PageSize;

            if (SelCount < 0)
            {
                return(string.Format("select {0} from {1} limit 0,0 ", list.GetFieldsString(), tableName));
            }

            return(string.Format("select {0} from {1} {2} {3} limit {4},{5}"
                                 , list.GetFieldsString(), tableName, list.GetWhere(), list.GetOrderBy(false), start, list.PageSize));
        }
Esempio n. 2
0
 string IBaseDataClass2.GetPageTSql(Model.List.IDBSQLHelper list)
 {
     return(GetPageTSql(list));
 }
Esempio n. 3
0
 protected override string GetPageTSql(Model.List.IDBSQLHelper list)
 {
     return((string)getMethond("GetPageTSql").Invoke(_db, new object[] { list }));
 }