示例#1
0
        internal ExecArgument(System.String arg, ParameterArgument[] arguments)
            : base(arg)
        {
            SetArgType(arg);
            if (!CheckNull(Arg(() => arg, arg)))
            {
                return;
            }

            Arguments       = arguments;
            _compilableType = ResolveCompilableType(arg);

            Build = (buildContext, buildArgs) =>
            {
                string sql;

                // stored procedure
                if (_compilableType == Compilable.ObjectType.StoredProc)
                {
                    if (ProcessVariable(buildContext, buildArgs, out sql))
                    {
                        return(sql);
                    }

                    sql = Filter.DelimitMultiPartOrParam(arg, IdentifierType.Table, out chainException);
                }
                // SQL batch
                else
                {
                    sql = Text.GenerateSql(500)
                          .NewLine(arg)
                          .TerminateSingle()
                          .ToString();
                }

                buildContext.TryTakeException(chainException);
                return(sql);
            };
        }
示例#2
0
        internal ExecArgument(Identifier arg, ParameterArgument[] arguments)
            : this(arg as Chainer)
        {
            _compilableType = Compilable.ObjectType.StoredProc;

            SetArgType(arg);

            if (!CheckNull(Arg(() => arg, arg)))
            {
                return;
            }

            Arguments = arguments;
            SetArgType(arg);

            Build = (buildContext, buildArgs) =>
            {
                string sql;
                sql = arg.Build(buildContext, buildArgs);
                buildContext.TryTakeException(chainException);
                return(sql);
            };
        }