Exemplo n.º 1
0
        /*
         * public virtual AnQueryReq j(string with, string @as, string on)
         * {
         *      return j("j", with, @as, on);
         * }
         *
         * public virtual AnQueryReq l(string with, string @as, string on)
         * {
         *      return j("l", with, @as, on);
         * }
         *
         * public virtual AnQueryReq r(string with, string @as, string on)
         * {
         *      return j("R", with, @as, on);
         * }
         *
         * public virtual AnQueryReq j(List <string[]> joins)
         * {
         *      if (joins != null)
         *      {
         *              foreach (string[] join in joins)
         *              {
         *                      j(join);
         *              }
         *      }
         *      return this;
         * }
         *
         * public virtual AnQueryReq j(string t, string with, string @as, string on)
         * {
         *      if (joins == null)
         *      {
         *              joins = new List<string[]>();
         *      }
         *      string[] joining = new string[Query.Ix.joinSize];
         *      joining[Query.Ix.joinTabl] = with;
         *      joining[Query.Ix.joinAlias] = @as;
         *      joining[Query.Ix.joinType] = t;
         *      joining[Query.Ix.joinOnCond] = on;
         *      return j(joining);
         * }
         *
         * private AnQueryReq j(string[] join)
         * {
         *      joins.Add(join);
         *      return this;
         * }
         *
         * public virtual AnQueryReq expr(string expr, string alias, params string[] tabl)
         * {
         *      if (exprs == null)
         *      {
         *              exprs = new List<string[]>();
         *      }
         *      string[] exp = new string[Query.Ix.exprSize];
         *      exp[Query.Ix.exprExpr] = expr;
         *      exp[Query.Ix.exprAlais] = alias;
         *      exp[Query.Ix.exprTabl] = tabl == null || tabl.Length == 0 ?
         *              null : tabl[0];
         *      exprs.Add(exp);
         *      return this;
         * }
         *
         * public virtual AnQueryReq Where(string oper, string lop, string rop)
         * {
         *      if (where == null)
         *      {
         *              where = new List<string[]>();
         *      }
         *      string[] predicate = new string[Query.Ix.predicateSize];
         *      predicate[Query.Ix.predicateOper] = oper;
         *      predicate[Query.Ix.predicateL] = lop;
         *      predicate[Query.Ix.predicateR] = rop;
         *      where.Add(predicate);
         *      return this;
         * }
         *
         * public virtual AnQueryReq orderby(string col, params bool[] asc)
         * {
         *      if (orders == null)
         *      {
         *              orders = new List<string[]>();
         *      }
         *      orders.Add(new string[] { col, asc == null || asc.Length == 0 ? "asc" : asc[0] ? "asc" : "desc" });
         *      return this;
         * }
         */

        /// <summary>
        /// <p>Create a qeury request body item, for joining etc.</p>
        /// <p>This is a client side helper, don't confused with
        /// <see cref="Query">Query</see>
        /// .</p>
        /// </summary>
        /// <param name="conn"/>
        /// <param name="parent"/>
        /// <param name="from"></param>
        /// <param name="as"></param>
        /// <returns>query request</returns>
        public static AnQueryReq formatReq(string conn, AnsonMsg parent, string from, params string[] @as)
        {
            AnQueryReq bdItem = new AnQueryReq
                                    (parent, conn, from, @as == null || @as.Length == 0 ? null : @as[0]);

            return(bdItem);
        }
Exemplo n.º 2
0
        /// <summary>
        /// <p>Create a qeury request body item, for joining etc.</p>
        /// <p>This is a client side helper, don't confused with
        /// <see cref="Query">Query</see>
        /// .</p>
        /// </summary>
        /// <param name="uri"/>
        /// <param name="parent"/>
        /// <param name="from"></param>
        /// <param name="asTabl"></param>
        /// <returns>query request</returns>
        public static AnQueryReq formatReq(string uri, AnsonMsg parent, string from, params string[] asTabl)
        {
            AnQueryReq bdItem = new AnQueryReq(uri, parent, from,
                                               asTabl == null || asTabl.Length == 0 ? null : asTabl[0]);

            return(bdItem);
        }