Beispiel #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);
        }
Beispiel #2
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);

            cmd.AddAndCondition(FilterParser.FilterParser.ParseFilterExpression(column != null ? column.CommonType : new DbTypeString(), colexpr, cond.Expression));
            return true;
        }