Exemplo n.º 1
0
        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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 3
0
 public static SqlClause Add([NotNull] this SqlClause source, [NotNull] params IDbDataParameter[] parameters)
 {
     return(source.Add((IEnumerable <IDbDataParameter>)parameters));
 }
Exemplo n.º 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);
 }
Exemplo n.º 5
0
 public static SqlClause AddLess(this SqlClause sqlClause,
                                 [NotNull] string columnName,
                                 [CanBeNull] IDbDataParameter parameter)
 {
     return(sqlClause.AddPredicate(columnName, " < ", parameter));
 }
Exemplo n.º 6
0
        public static SqlClause AddIsNotNull(this SqlClause sqlClause, [NotNull] string columnName)
        {
            sqlClause.Add(columnName + " is not null");

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