Exemplo n.º 1
0
        // Update //
        public static UpdatePlan RenderUpdatePlan(Workspace Home, HScriptParser.Crudam_updateContext context)
        {

            // Get the data source //
            DataSet data = VisitorHelper.GetData(Home, context.full_table_name());

            // Create expression visitor //
            ExpressionVisitor exp_vis = new ExpressionVisitor(null, Home, data.Name, data.Columns, null);

            // Get where //
            Predicate where = VisitorHelper.GetWhere(exp_vis, context.where_clause());

            // Create the key and fnodeset //
            Key keys = new Key();
            FNodeSet expressions = new FNodeSet();
            foreach (HScriptParser.Update_unitContext ctx in context.update_unit())
            {
                keys.Add(data.Columns.ColumnIndex(ctx.IDENTIFIER().GetText()));
                expressions.Add(exp_vis.ToNode(ctx.expression()));
            }

            return new UpdatePlan(data, keys, expressions, where);

        }