コード例 #1
0
ファイル: DBQuery.cs プロジェクト: sampath1983jan/TechData
        /// <summary>
        /// Starts a new script where multiple statements can be executed within the same command
        /// and sets the first statement to the specified query
        /// </summary>
        /// <param name="query">The first statement in the script</param>
        /// <returns>A new DBScript for statement chaining</returns>
        public static DBScript Begin(DBStatement query)
        {
            DBScript s = Begin();

            s.Then(query);
            return(s);
        }
コード例 #2
0
ファイル: DBQuery.cs プロジェクト: sampath1983jan/TechData
        /// <summary>
        /// Starts a new script where the provided multiple statements can be executed within the same command
        /// </summary>
        /// <param name="statements">The statements in the script</param>
        /// <returns>A new DBScript for statement chaining</returns>
        public static DBScript Script(params DBStatement[] statements)
        {
            DBScript s = Begin();

            if (statements != null && statements.Length > 0)
            {
                s.Inner.AddRange(statements);
            }

            return(s);
        }
コード例 #3
0
ファイル: DBScript.cs プロジェクト: sampath1983jan/TechData
        /// <summary>
        /// Closes the script
        /// </summary>
        /// <returns></returns>
        public DBScript End()
        {
            DBScript toclear = this.GetLastParentBlock();

            if (null != toclear)
            {
                toclear.Last = null;
            }

            return(this);
        }
コード例 #4
0
 /// <summary>
 /// Sets the actual exection steps in the stored procedure as the script
 /// </summary>
 /// <param name="script"></param>
 /// <returns></returns>
 public DBCreateProcedureQuery As(DBScript script)
 {
     if (null == this.Script)
     {
         this.Script = script;
     }
     else
     {
         this.Script.Append(script);
     }
     this.Script.IsInnerQuery = true;
     return(this);
 }
コード例 #5
0
ファイル: DBQuery.cs プロジェクト: sampath1983jan/TechData
        /// <summary>
        /// Starts a new script where the provided multiple statements can be executed within the same command
        /// </summary>
        /// <param name="querys">The statements in the script</param>
        /// <returns>A new DBScript for statement chaining</returns>
        public static DBScript Begin(params DBStatement[] querys)
        {
            DBScript s = Begin();

            if (null != querys && querys.Length > 0)
            {
                foreach (DBQuery q in querys)
                {
                    s.Then(q);
                }
            }

            return(s);
        }
コード例 #6
0
ファイル: DBScript.cs プロジェクト: sampath1983jan/TechData
 /// <summary>
 /// Begins a new Inner Statement block
 /// </summary>
 /// <returns></returns>
 public DBScript Begin()
 {
     if (Last != null)
     {
         return(Last.Begin());
     }
     else
     {
         DBScript inner = DBQuery.Begin();
         this.Inner.Add(inner);
         this.Last = inner;
         return(this);
     }
 }
コード例 #7
0
 /// <summary>
 /// Sets or appends the actual execution step(s) in the stored procedure
 /// </summary>
 /// <param name="statements"></param>
 /// <returns></returns>
 public DBCreateProcedureQuery As(params DBStatement[] statements)
 {
     if (null == this.Script)
     {
         this.Script = DBScript.Script(statements);
     }
     else
     {
         foreach (DBStatement state in statements)
         {
             this.Script.Append(state);
         }
     }
     this.Script.IsInnerQuery = true;
     return(this);
 }