Beispiel #1
0
        /// <summary>
        /// Adds a RIGHT JOIN clause.
        /// </summary>
        /// <param name="Select">The SelectCountQuery 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 SelectCountQuery SetRightJoin(SelectCountQuery Select, string TableAlias, string ConditionStatement)
        {
            if (Select == null)
            {
                throw new ArgumentException("Select argument should not be null.");
            }
            string strQuery = Select.ToString();

            if (strQuery.IsNullOrWhiteSpace())
            {
                throw new ArgumentException("Select argument should not be empty.");
            }
            if (TableAlias.IsNullOrWhiteSpace())
            {
                throw new ArgumentException("TableAlias argument should not be empty.");
            }
            if (!this._IsValidField(TableAlias))
            {
                throw new ArgumentException("TableAlias argument should only contain letters, numbers and/or underscores.");
            }
            if (ConditionStatement.IsNullOrWhiteSpace())
            {
                throw new ArgumentException("Condition argument should not be empty.");
            }
            this._Joins.Add(String.Format("RIGHT JOIN ({0}) {1} ON ({2})", strQuery, TableAlias, ConditionStatement));
            return(this);
        }
Beispiel #2
0
        /// <summary>
        /// Initializes the query as a table, and table alias for the SELECT statement.
        /// </summary>
        /// <param name="Select">The SelectCountQuery instance.</param>
        /// <param name="TableAlias">The alias of the query.</param>
        public SelectCountQuery(SelectCountQuery Select, string TableAlias)
        {
            if (Select == null)
            {
                throw new ArgumentException("Select argument should not be null.");
            }
            string strQuery = Select.ToString();

            if (strQuery.IsNullOrWhiteSpace())
            {
                throw new ArgumentException("Select argument should not be empty.");
            }
            if (TableAlias.IsNullOrWhiteSpace())
            {
                throw new ArgumentException("TableAlias argument should not be empty.");
            }
            if (!this._IsValidField(TableAlias))
            {
                throw new ArgumentException("TableAlias argument should only contain letters, numbers and/or underscores.");
            }
            this._From       = String.Format("({0}) {1}", strQuery, TableAlias);
            this._TableAlias = TableAlias;
            this._InitProperties();
        }