123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace Ant.ORM
- {
- public class JoinSql
- {
- /// <summary>
- /// Gets the join type value.
- /// </summary>
- /// <param name="j">The j.</param>
- /// <returns></returns>
- public static string GetJoinTypeValue(JoinTypes j)
- {
- switch (j)
- {
- case JoinTypes.Outer:
- return " OUTER JOIN ";
- case JoinTypes.LeftInner:
- return " LEFT INNER JOIN ";
- case JoinTypes.LeftJoin:
- return " LEFT JOIN ";
- case JoinTypes.LeftOuter:
- return " LEFT OUTER JOIN ";
- case JoinTypes.RightJoin:
- return " RIGHT JOIN ";
- case JoinTypes.RightInner:
- return " RIGHT INNER JOIN ";
- case JoinTypes.RightOuter:
- return " RIGHT OUTER JOIN ";
- case JoinTypes.Cross:
- return " CROSS JOIN ";
- case JoinTypes.NotEqual:
- return " JOIN ";
- }
- return " INNER JOIN ";
- }
- }
- #region 操作符
-
-
- public class QueryOperator
- {
- /// <summary>
- /// Gets the comparison operator.
- /// </summary>
- /// <param name="comp">The comp.</param>
- /// <returns></returns>
- public static string GetComparisonOperator(Comparison comp)
- {
- switch (comp)
- {
- case Comparison.NotEquals:
- return " <> ";
- case Comparison.Like:
- return " LIKE ";
- case Comparison.NotLike:
- return " NOT LIKE ";
- case Comparison.GreaterThan:
- return " > ";
- case Comparison.GreaterOrEquals:
- return " >= ";
- case Comparison.LessThan:
- return " < ";
- case Comparison.LessOrEquals:
- return " <= ";
- case Comparison.Blank:
- return " ";
- case Comparison.Is:
- return " IS ";
- case Comparison.IsNot:
- return " IS NOT ";
- case Comparison.In:
- return " IN ";
- case Comparison.NotIn:
- return " NOT IN ";
- }
- return " = ";
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="op"></param>
- /// <returns></returns>
- public static string GetOperator(Operator op)
- {
- if (op == Operator.EqualLarger)
- return ">=";
- else if (op == Operator.Equal)
- return "=";
- else if (op == Operator.EqualSmaller)
- return "<=";
- else if (op == Operator.Smaller)
- return "<";
- else if (op == Operator.NotEqual)
- return "!=";
- else if (op == Operator.Larger)
- return ">";
- else if (op == Operator.Like)
- return "like";
- return string.Empty;
- }
- }
- #endregion
- }
|