public static SqlClause Add([NotNull] this SqlClause source, [NotNull] SqlClause sqlClause, bool trimmed = false)
        {
            if (sqlClause == null)
            {
                throw new ArgumentNullException("sqlClause");
            }

            var sql = sqlClause.GetSql();

            if (trimmed)
            {
                sql = sql.Trim(' ', '\t', '\n', '\r');
            }

            source.Add(sql);
            source.Add(sqlClause.GetParameters());

            return(source);
        }
Example #2
0
        public SqlClause Add([NotNull] string key, [NotNull] SqlClause sqlClause, bool overwrite = false)
        {
            if (sqlClause == null)
            {
                throw new ArgumentNullException("sqlClause");
            }

            if (this.ContainsExpression(key) && !overwrite)
            {
                return(this);
            }

            this.Add(key, sqlClause.GetSql(), overwrite);

            foreach (var parameter in sqlClause.GetParameters())
            {
                this.Add(parameter);
            }

            return(this);
        }
 public static SqlClause Add([NotNull] this SqlClause source, [NotNull] params IDbDataParameter[] parameters)
 {
     return(source.Add((IEnumerable <IDbDataParameter>)parameters));
 }
Example #4
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="SqlSelectStatementBuilder" /> class.
 /// </summary>
 public SqlSelectStatementBuilder([NotNull] string tableName)
 {
     this.select = SqlClauseBuilder.Select();
     this.from   = SqlClauseBuilder.From(tableName);
 }
Example #5
0
 public static SqlClause AddLess(this SqlClause sqlClause,
                                 [NotNull] string columnName,
                                 [CanBeNull] IDbDataParameter parameter)
 {
     return(sqlClause.AddPredicate(columnName, " < ", parameter));
 }
Example #6
0
        public static SqlClause AddIsNotNull(this SqlClause sqlClause, [NotNull] string columnName)
        {
            sqlClause.Add(columnName + " is not null");

            return(sqlClause);
        }
Example #7
0
 public static SqlClause AddNotIn(this SqlClause sqlClause,
                                  [NotNull] string columnName,
                                  [CanBeNull] params IDbDataParameter[] parameters)
 {
     return(sqlClause.AddNotIn(columnName, (IEnumerable <IDbDataParameter>)parameters));
 }