Exemple #1
0
        protected static bool GetCondition(DmlfCommandBase cmd, ChangeSetItem item, ChangeSetCondition cond, DatabaseInfo db)
        {
            var source = new DmlfSource
            {
                Alias       = "basetbl",
                LinkedInfo  = item.LinkedInfo,
                TableOrView = item.TargetTable,
            };
            var colref = cmd.SingleFrom.GetColumnRef(source, item.TargetTable, StructuredIdentifier.Parse(cond.Column), db, DmlfJoinType.Inner);

            if (colref == null)
            {
                return(false);
            }

            //var table = db.FindTable(item.TargetTable);
            //if (table == null) return false;
            //var column = table.FindColumn(cond.Column);
            //if (column == null) return false;

            var colexpr = new DmlfColumnRefExpression
            {
                Column = colref
            };
            var column = colref.FindSourceColumn(db);

            var condItem = FilterParserTool.ParseFilterExpression(column != null ? column.CommonType : new DbTypeString(), colexpr, cond.UsedExpression);

            if (condItem == null)
            {
                throw new Exception("DBSH-00000 Error creating condition");
            }
            cmd.AddAndCondition(condItem);
            return(true);
        }
Exemple #2
0
 protected static bool GetConditions(DmlfCommandBase cmd, ChangeSetItem item, List <ChangeSetCondition> conditions, DatabaseInfo db)
 {
     foreach (var cond in conditions)
     {
         if (!GetCondition(cmd, item, cond, db))
         {
             return(false);
         }
     }
     return(true);
 }