コード例 #1
0
        /// <summary>
        /// Overrides the base implementation to generate the SQL statement for this EXEC query
        /// </summary>
        /// <param name="builder">The builder to use to generate the execute statement</param>
        /// <returns>true</returns>
        public override bool BuildStatement(DBStatementBuilder builder)
        {
            builder.BeginExecuteStatement();
            if (string.IsNullOrEmpty(this.Catalog) == false)
            {
                builder.BeginIdentifier();
                builder.WriteObjectName(this.Owner);
                builder.EndIdentifier();
                builder.AppendIdSeparator();
            }

            if (string.IsNullOrEmpty(this.Owner) == false)
            {
                builder.BeginIdentifier();
                builder.WriteObjectName(this.Owner);
                builder.EndIdentifier();
                builder.AppendIdSeparator();
            }
            else if (string.IsNullOrEmpty(this.Catalog) == false)
            {
                builder.AppendIdSeparator(); //need to include the dot - [Catalog]..[SprocName]
            }

            builder.BeginIdentifier();
            builder.WriteObjectName(this.SprocName);
            builder.EndIdentifier();


            if (this.HasParameters)
            {
                builder.BeginExecuteParameters();
                foreach (DBClause c in this.Parameters)
                {
                    builder.BeginExecuteAParameter();
                    c.BuildStatement(builder);
                    builder.EndExecuteAParameter();
                }
                builder.EndExecuteParameters();
            }

            if (this.IsInnerQuery == false)
            {
                builder.EndExecuteStatement();
            }

            return(true);
        }