Exemplo n.º 1
0
        /// <summary>
        /// 创建新的Sql条件语句集合
        /// </summary>
        /// <param name="concatType">连接类型</param>
        /// <param name="conditions">查询语句集合</param>
        /// <exception cref="ArgumentNullException">查询语句集合不能为空</exception>
        /// <returns>Sql条件语句集合</returns>
        public static SqlConditionList CreateList(SqlWhereConcatType concatType, List <ISqlCondition> conditions)
        {
            if (conditions == null)
            {
                throw new ArgumentNullException("conditions");
            }

            return(SqlCondition.CreateList(SqlWhereConcatType.And, conditions.ToArray()));
        }
Exemplo n.º 2
0
 /// <summary>
 /// 两个Sql条件语句执行或操作
 /// </summary>
 /// <param name="condition1">条件1</param>
 /// <param name="condition2">条件2</param>
 /// <returns>条件列表</returns>
 public static SqlConditionList operator |(SqlConditionList condition1, AbstractSqlCondition condition2)
 {
     if (condition1.ConcatType == SqlWhereConcatType.Or)
     {
         condition1.Add(condition2);
         return(condition1);
     }
     else
     {
         return(SqlCondition.Or(condition1, condition2));
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// 两个Sql条件语句执行与操作
 /// </summary>
 /// <param name="condition1">条件1</param>
 /// <param name="condition2">条件2</param>
 /// <returns>条件列表</returns>
 public static SqlConditionList operator &(AbstractSqlCondition condition1, SqlConditionList condition2)
 {
     if (condition2.ConcatType == SqlWhereConcatType.And)
     {
         condition2.Add(condition2);
         return(condition2);
     }
     else
     {
         return(SqlCondition.And(condition1, condition2));
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// 创建判断是否相似的Sql条件语句
 /// </summary>
 /// <param name="columnName">字段名</param>
 /// <param name="value">数据</param>
 /// <returns>Sql条件语句</returns>
 public static SqlBasicParameterCondition Like(String columnName, String value)
 {
     return(SqlCondition.Like(SqlParameter.Create(columnName, value)));
 }
Exemplo n.º 5
0
 /// <summary>
 /// 两个Sql条件语句执行或操作
 /// </summary>
 /// <param name="condition1">条件1</param>
 /// <param name="condition2">条件2</param>
 /// <returns>条件列表</returns>
 public static SqlConditionList operator |(AbstractSqlCondition condition1, AbstractSqlCondition condition2)
 {
     return(SqlCondition.Or(condition1, condition2));
 }
Exemplo n.º 6
0
 /// <summary>
 /// 创建判断是否不在范围内的Sql条件语句
 /// </summary>
 /// <param name="columnName">字段名</param>
 /// <param name="paramName">参数名</param>
 /// <param name="valueOne">数据一</param>
 /// <param name="valueTwo">数据二</param>
 /// <returns>Sql查询语句类</returns>
 public static SqlBasicParameterCondition NotBetween(String columnName, String paramName, Object valueOne, Object valueTwo)
 {
     return(SqlCondition.NotBetween(SqlParameter.Create(columnName, paramName + "_One", valueOne), SqlParameter.Create(columnName, paramName + "_Two", valueTwo)));
 }
Exemplo n.º 7
0
 /// <summary>
 /// 创建判断是否开头不包含的Sql条件语句
 /// </summary>
 /// <param name="columnName">字段名</param>
 /// <param name="value">数据</param>
 /// <returns>Sql条件语句</returns>
 public static SqlBasicParameterCondition NotLikeStartWith(String columnName, String value)
 {
     return(SqlCondition.NotLike(SqlParameter.Create(columnName, "%" + value)));
 }
Exemplo n.º 8
0
 /// <summary>
 /// 创建判断是否结尾不包含的Sql条件语句
 /// </summary>
 /// <param name="columnName">字段名</param>
 /// <param name="paramName">参数名</param>
 /// <param name="value">数据</param>
 /// <returns>Sql查询语句类</returns>
 public static SqlBasicParameterCondition NotLikeEndWith(String columnName, String paramName, String value)
 {
     return(SqlCondition.NotLike(SqlParameter.Create(columnName, paramName, value + "%")));
 }
Exemplo n.º 9
0
 /// <summary>
 /// 创建判断是否结尾不包含的Sql条件语句
 /// </summary>
 /// <param name="columnName">字段名</param>
 /// <param name="tableNameTwo">数据表名二</param>
 /// <param name="columnNameTwo">字段名二</param>
 /// <returns>Sql条件语句</returns>
 public static SqlBasicParameterCondition NotLikeColumn(String columnName, String tableNameTwo, String columnNameTwo)
 {
     return(SqlCondition.NotLike(SqlParameter.CreateCustomAction(columnName, GetFieldName(tableNameTwo, columnNameTwo))));
 }
Exemplo n.º 10
0
 /// <summary>
 /// 创建判断是否包含的Sql条件语句
 /// </summary>
 /// <param name="columnName">字段名</param>
 /// <param name="paramName">参数名</param>
 /// <param name="value">数据</param>
 /// <returns>Sql条件语句</returns>
 public static SqlBasicParameterCondition LikeAll(String columnName, String paramName, String value)
 {
     return(SqlCondition.Like(SqlParameter.Create(columnName, paramName, "%" + value + "%")));
 }
Exemplo n.º 11
0
 /// <summary>
 /// 创建判断是否小于等于的Sql条件语句
 /// </summary>
 /// <param name="columnName">字段名</param>
 /// <param name="tableNameTwo">数据表名二</param>
 /// <param name="columnNameTwo">字段名二</param>
 /// <returns>Sql条件语句</returns>
 public static SqlBasicParameterCondition LessThanOrEqualColumn(String columnName, String tableNameTwo, String columnNameTwo)
 {
     return(SqlCondition.LessThanOrEqual(SqlParameter.CreateCustomAction(columnName, GetFieldName(tableNameTwo, columnNameTwo))));
 }
Exemplo n.º 12
0
 /// <summary>
 /// 创建新的Sql条件语句
 /// </summary>
 /// <param name="function">合计函数类型</param>
 /// <param name="op">条件运算符</param>
 /// <param name="value">数据</param>
 /// <returns>Sql条件语句</returns>
 public static SqlBasicParameterCondition Create(SqlAggregateFunction function, SqlOperator op, Object value)
 {
     return(SqlCondition.Create(function, "*", op, value));
 }
Exemplo n.º 13
0
 /// <summary>
 /// 创建判断是否小于等于的Sql条件语句
 /// </summary>
 /// <param name="columnName">字段名</param>
 /// <param name="paramName">参数名</param>
 /// <param name="value">数据</param>
 /// <returns>Sql查询语句类</returns>
 public static SqlBasicParameterCondition LessThanOrEqual(String columnName, String paramName, Object value)
 {
     return(SqlCondition.LessThanOrEqual(SqlParameter.Create(columnName, paramName, value)));
 }
Exemplo n.º 14
0
 /// <summary>
 /// 创建判断是否大于的Sql条件语句
 /// </summary>
 /// <param name="columnName">字段名</param>
 /// <param name="value">数据</param>
 /// <returns>Sql条件语句</returns>
 public static SqlBasicParameterCondition GreaterThan(String columnName, Object value)
 {
     return(SqlCondition.GreaterThan(SqlParameter.Create(columnName, value)));
 }
Exemplo n.º 15
0
 /// <summary>
 /// 创建判断是否非空的Sql条件语句
 /// </summary>
 /// <param name="columnName">字段名</param>
 /// <returns>Sql条件语句</returns>
 public static SqlBasicParameterCondition IsNotNull(String columnName)
 {
     return(SqlCondition.IsNotNull(SqlParameter.Create(columnName, null)));
 }
Exemplo n.º 16
0
 /// <summary>
 /// 创建或连接的Sql条件语句集合
 /// </summary>
 /// <param name="conditions">查询语句集合</param>
 /// <returns>Sql条件语句集合</returns>
 public static SqlConditionList Or(List <ISqlCondition> conditions)
 {
     return(SqlCondition.CreateList(SqlWhereConcatType.Or, conditions.ToArray()));
 }
Exemplo n.º 17
0
 /// <summary>
 /// 创建或连接的Sql条件语句集合
 /// </summary>
 /// <param name="conditions">查询语句集合</param>
 /// <returns>Sql条件语句集合</returns>
 public static SqlConditionList Or(params ISqlCondition[] conditions)
 {
     return(SqlCondition.CreateList(SqlWhereConcatType.Or, conditions));
 }