Exemplo n.º 1
0
 public static void AppendPage(Command cmd, string keyFieldName, string tableName, Page page, Where where, IDbAdapter adapter)
 {
     if (page == null)
         return;
     adapter.AppendPage(cmd, keyFieldName, tableName, page, where);
 }
Exemplo n.º 2
0
 public virtual void AppendPage(Command cmd, string keyFieldName, string tableName, Page page, Where where)
 {
     cmd.Append(" limit @0PageStartIndex, @0PageCount");
     cmd.AddParameter("@0PageStartIndex", page.StartPos);
     cmd.AddParameter("@0PageCount", page.Count);
 }
Exemplo n.º 3
0
        public virtual void AppendPage(Command cmd, string keyFieldName, string tableName, Page page, Where where)
        {
            if (page == null)
                return;

            string ori = cmd.QueryString;
            if (ori.Substring(0, 7).ToLower() != "select ")
                return;
            string oriselect = ori.Substring(7, ori.IndexOf(" from ", StringComparison.CurrentCultureIgnoreCase) - 7);

            int where_index = ori.LastIndexOf(" where ", StringComparison.CurrentCultureIgnoreCase);
            if (where_index != -1)
                ori = ori.Substring(where_index + 7);

            cmd.QueryString = string.Format(
                "select top {0} {1} from [{2}] where {6}([{3}] not in (select top {4} [{3}] from [{2}]{5}))",
                page.Count, oriselect, tableName, keyFieldName, page.StartPos,
                where_index == -1 ? string.Empty : " where " + ori,
                where_index == -1 ? string.Empty : ori + " and "
            );

            if (where != null)
                Builder.AppendOrders(cmd, where.Orders, this);
        }