コード例 #1
0
ファイル: DbField.cs プロジェクト: GeraldTrost/xxDevPlus
 public override Reach sql(EvalExpert evx)
 {
     if (alias == null)
     {
         return(base.sql(evx));
     }
     else
     {
         return(base.sql(evx));
     }
 }                                                                                                           // + " AS " + alias;
コード例 #2
0
ファイル: Trm.cs プロジェクト: GeraldTrost/xxDevPlus
        }                                  //AttGeTr: must be revised, is sql-Syntax and symbolic Syntax always equal in terms of DbFields or Terms?

        public virtual Reach sql(EvalExpert evx)
        {
            if (evx.Dtv.hasKey(optor))
            {
                return(val(evx));
            }
            if (Dtv.hasKey(optor))
            {
                return(val(this));
            }
            if (optor.Equals(""))
            {
                return(val(this));              //(Reach)lOpnd;
            }
            Reach ret      = "";
            Reach retClose = "";

            if (lOpnd.GetType() == typeof(Trm))
            {
                ret += ((Trm)lOpnd).sql(evx);
            }
            else
            if (lOpnd.GetType() == typeof(DbField))
            {
                ret += ((DbField)lOpnd).sql(evx);
            }
            else
            if (lOpnd.GetType() == typeof(DbSlc))
            {
                ret += "( " + evx.val(((DbSlc)lOpnd)) + " )";
            }
            else
            {
                ret += (Reach)lOpnd;
            }
            if (optor.Equals(utl.OPR("APD")))
            {
                ret += ", ";
            }

            /*
             * else if (optor.Equals(utl.OPR("CPF")))                  //composite field
             * {
             * //return "lTrim(rTrim(" + lOpnd + ")) + ' ' + lTrim(rTrim(" + rOpnd + "))";
             * ret = "(";
             * foreach (object op in this)
             * {
             * ret += ((DbField)op).sql(evx) + " + ' ' + ";
             * //return ret.upto(-10);
             * retClose = ")";
             * }
             * }
             */

            else if (optor.Equals(utl.OPR("CCT")))
            {
                ret = "CONCAT(" + ret + ", "; retClose = ")";
            }
            else if (optor.Equals(utl.OPR("CVS")))
            {
                ret = "CAST(" + ret + " as text"; retClose = ")";
            }

            if (rOpnd != null)
            {
                if (rOpnd.GetType() == typeof(Trm))
                {
                    ret += ((Trm)rOpnd).sql(evx);
                }
                else
                if (rOpnd.GetType() == typeof(DbField))
                {
                    ret += ((DbField)rOpnd).sql(evx);
                }
                else
                if (rOpnd.GetType() == typeof(DbSlc))
                {
                    ret += "( " + evx.val(((DbSlc)rOpnd)) + " )";
                }
                else
                {
                    ret += (Reach)rOpnd;
                }
            }

            ret += retClose;
            return(ret);
        }
コード例 #3
0
ファイル: Trm.cs プロジェクト: GeraldTrost/xxDevPlus
        public override string val(int i, EvalExpert evx)
        {
            Type typ = this[i].GetType();

            if (false && (dbg))
            {
                if (typ == typeof(DbField))
                {
                    return("[" + ((DbField)(this[i])).val(evx) + "]");
                }
                if (typ == typeof(Trm))
                {
                    return("[" + ((Trm)(this[i])).val(evx) + "]");
                }
                if (typ == typeof(Reach))
                {
                    return("[" + ((Reach)(this[i])).text + "]");
                }
                if (typ == typeof(string))
                {
                    return("[" + ((string)(this[i])) + "]");
                }
                if (typ == typeof(long))
                {
                    return("[" + ((Db)evx).ds("" + ((long)(this[i]))) + "]");
                }
                if (typ == typeof(double))
                {
                    return("[" + ((Db)evx).ds("" + ((double)(this[i]))).Replace(",", ".") + "]");
                }
                throw new Exception("Err: unknown Type in Trm.val()");
            }
            else
            {
                if (typ == typeof(DbField))
                {
                    return(((DbField)(this[i])).val(evx));
                }
                if (typ == typeof(Trm))
                {
                    return(((Trm)(this[i])).val(evx));
                }
                if (typ == typeof(Reach))
                {
                    return(((Reach)(this[i])).text);
                }
                if (typ == typeof(string))
                {
                    return((string)(this[i]));
                }
                if (typ == typeof(long))
                {
                    return(((Db)evx).ds("" + ((long)(this[i]))));
                }
                if (typ == typeof(double))
                {
                    return(((Db)evx).ds("" + ((double)(this[i]))).Replace(",", "."));
                }
                throw new Exception("Err: unknown Type in Trm.val()");
            }
        }
コード例 #4
0
        public string val(EvalExpert evx) //directives dtv are explicitly given
        {
            string ret = "";

            if (Len == 0)
            {
                throw new Exception("Err: Xpn: no operand given.");
            }
            if (Name.Length == 0)
            {
                for (int i = 1; i <= Len; i++)
                {
                    ret += val(i, evx);
                }
                return(debug(ret));
            }
            try { splitDirective(evx.Dtv[Name]); } catch (Exception ex) { throw new Exception("Err: Xpn: undef operator " + Name); }
            if ((Len == 1) && (dtv0.Length > 0))
            {
                return(debug(dtv0.Replace("¹", val(1, evx)).Replace("°", optrSymbol)));
            }
            if (dtv2.Length == 0)
            {
                if (left2right)
                {
                    ret = val(1, evx) + dtv1mS;
                    if (revert)
                    {
                        for (int i = Len; i > 1; i--)
                        {
                            ret = dtv1lR + val(i, evx) + dtv1mR + ret + dtv1rR;
                        }
                    }
                    else
                    {
                        for (int i = 2; i <= Len; i++)
                        {
                            ret = dtv1lR + ret + dtv1mR + val(i, evx) + dtv1rR;
                        }
                    }
                    return((revert) ? debug((dtv1lS + ret + dtv1rS).Replace("°", optrSymbol)) : debug((dtv1lS + ret + dtv1rS).Replace("°", optrSymbol)));
                }
                else
                {
                    ret = dtv1mS + val(Len, evx);
                    if (revert)
                    {
                        for (int i = 1; i < Len; i++)
                        {
                            ret = dtv1lR + ret + dtv1mR + val(i, evx) + dtv1rR;
                        }
                    }
                    else
                    {
                        for (int i = Len - 1; i > 0; i--)
                        {
                            ret = dtv1lR + val(i, evx) + dtv1mR + ret + dtv1rR;
                        }
                    }
                    return((revert) ? debug((dtv1lS + ret + dtv1rS).Replace("°", optrSymbol)) : debug((dtv1lS + ret + dtv1rS).Replace("°", optrSymbol)));
                }
            }
            else
            {
                if (revert)
                {
                    for (int i = 2; i <= Len; i++)
                    {
                        ret = dtv2.Replace("²", val(i, evx)) + ret;
                    }
                }
                else
                {
                    for (int i = Len; i > 1; i--)
                    {
                        ret = dtv2.Replace("²", val(i, evx)) + ret;
                    }
                }
                return((revert) ? debug((dtv1lS + dtv1lR + ret + dtv1mR + val(1, evx) + dtv1rR + dtv1rS).Replace("°", optrSymbol)) : debug((dtv1lS + dtv1lR + val(1, evx) + dtv1mR + ret + dtv1rR + dtv1rS).Replace("°", optrSymbol)));
            }
        }
コード例 #5
0
 public abstract string val(int inx, EvalExpert evx); //for debugging only (selfTest)        {return (this[inx]).ToString(); }
コード例 #6
0
 public override string val(int i, EvalExpert evx)
 {
     return((evx.GetType() == typeof(Db)) ? ((DbSlc)this[i]).sql((Db)evx) : ((DbSlc)this[i]).sql());
     //throw new Exception("Err: NYI: DbSlcBlock.val()");
 }
コード例 #7
0
 public override string val(int inx, EvalExpert evx)
 {
     throw new Exception("Not supported yet.");
 }