/// <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); }
/// <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); }
/// <summary> /// Closes the script /// </summary> /// <returns></returns> public DBScript End() { DBScript toclear = this.GetLastParentBlock(); if (null != toclear) { toclear.Last = null; } return(this); }
/// <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); }
/// <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); }
/// <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); } }
/// <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); }