/// <summary>
        /// Adds a RIGHT JOIN clause.
        /// </summary>
        /// <param name="Select">The OracleSqlBuilderSelect instance.</param>
        /// <param name="TableAlias">The alias of the table.</param>
        /// <param name="ConditionStatement">The condition statment/s of the joined table.</param>
        /// <returns>The current instance of this class.</returns>
        public OracleSqlBuilderSelect SetRightJoin(OracleSqlBuilderSelect Select, string TableAlias, string ConditionStatement)
        {
            if (Select == null)
            {
                throw new ArgumentException("Select argument should not be null.");
            }
            string strQuery = Select.ToString();

            if (String.IsNullOrWhiteSpace(strQuery))
            {
                throw new ArgumentException("Select argument should not be empty.");
            }
            TableAlias = this._RemoveBackTick(TableAlias);
            if (String.IsNullOrWhiteSpace(TableAlias))
            {
                throw new ArgumentException("TableAlias argument should not be empty.");
            }
            ConditionStatement = this._RemoveBackTick(ConditionStatement);
            if (String.IsNullOrWhiteSpace(ConditionStatement))
            {
                throw new ArgumentException("Condition argument should not be empty.");
            }
            this._Joins.Add(String.Format("RIGHT JOIN (\n{0}\n) {1}\n\tON ({2})", this._AddTab(strQuery), this._EncloseBackTick(TableAlias), this._Name(ConditionStatement)));
            return(this);
        }
        /// <summary>
        /// Initializes the query as a table, and table alias for the SELECT statement.
        /// </summary>
        /// <param name="Select">The OracleSqlBuilderSelect instance.</param>
        /// <param name="TableAlias">The alias of the query.</param>
        public OracleSqlBuilderSelect(OracleSqlBuilderSelect Select, string TableAlias)
        {
            if (Select == null)
            {
                throw new ArgumentException("Select argument should not be null.");
            }
            string strQuery = Select.ToString();

            if (String.IsNullOrWhiteSpace(strQuery))
            {
                throw new ArgumentException("Select argument should not be empty.");
            }
            if (String.IsNullOrWhiteSpace(TableAlias))
            {
                throw new ArgumentException("TableAlias argument should not be empty.");
            }
            this._From       = String.Format("(\n{0}\n) {1}", this._AddTab(strQuery), this._EncloseBackTick(this._RemoveBackTick(TableAlias)));
            this._TableAlias = this._RemoveBackTick(TableAlias);
            this._InitProperties();
        }
 /// <summary>
 /// Adds an expression/column to the SELECT clause.
 /// </summary>
 /// <param name="Condition">The condition to check before adding to the SELECT clause.</param>
 /// <param name="Select">The OracleSqlBuilderSelect instance.</param>
 /// <param name="Alias">The alias of the expression.</param>
 /// <returns>The current instance of this class.</returns>
 public OracleSqlBuilderSelect SetSelect(bool Condition, OracleSqlBuilderSelect Select, string Alias)
 {
     if (Condition)
     {
         if (Select == null)
         {
             throw new ArgumentException("Select argument should not be null.");
         }
         string strQuery = Select.ToString();
         if (String.IsNullOrWhiteSpace(strQuery))
         {
             throw new ArgumentException("Select argument should not be empty.");
         }
         if (String.IsNullOrWhiteSpace(Alias))
         {
             throw new ArgumentException("Alias argument should not be empty.");
         }
         this._Fields.Add(String.Format("(\n{0}\n) AS {1}", this._AddTab(strQuery), this._EncloseBackTick(this._RemoveBackTick(Alias))));
     }
     return(this);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Executes a query and returns a OracleSqlData instance.
 /// </summary>
 /// <param name="Select">The instance of OracleSqlBuilderSelect.</param>
 /// <returns>The instance of OracleSqlData.</returns>
 internal OracleSqlData Execute(OracleSqlBuilderSelect Select)
 {
     return(this.Execute(OracleSqlConnectionString.Read(), Select));
 }
 /// <summary>
 /// Adds an expression/column to the SELECT clause.
 /// </summary>
 /// <param name="Select">The OracleSqlBuilderSelect instance.</param>
 /// <param name="Alias">The alias of the expression.</param>
 /// <returns>The current instance of this class.</returns>
 public OracleSqlBuilderSelect SetSelect(OracleSqlBuilderSelect Select, string Alias)
 {
     return(this.SetSelect(true, Select, Alias));
 }