Beispiel #1
0
        public virtual void Delete()
        {
            QueueSql.Sql = new StringBuilder();
            var strWhereSql = Visit.Where(QueueSql.ExpWhere);

            if (!string.IsNullOrWhiteSpace(strWhereSql))
            {
                strWhereSql = "WHERE " + strWhereSql;
            }

            QueueSql.Sql.AppendFormat("DELETE FROM {0} {1}", QueueManger.DbProvider.KeywordAegis(QueueSql.Name), strWhereSql);
        }
 private static SqlCaluse NotLikeMethod(MethodCallExpression exp, SqlCaluse sqlCaluse)
 {
     ExpressionVisit.Where(exp.Arguments[0], sqlCaluse);
     sqlCaluse         += " Not Like ";
     sqlCaluse.LikeMode = 1;
     ExpressionVisit.Where(exp.Arguments[1], sqlCaluse);
     return(sqlCaluse);
 }
        protected override SqlCaluse Where(BinaryExpression exp, SqlCaluse sqlCaluse)
        {
            ExpressionVisit.Where(exp.Left, sqlCaluse);
            var insertIndex = sqlCaluse.Length;

            ExpressionVisit.Where(exp.Right, sqlCaluse);
            var endIndex = sqlCaluse.Length;
            var b        = endIndex - insertIndex == 5 && sqlCaluse.EndWith("null");

            OperatorParser(exp.NodeType, insertIndex, sqlCaluse.Sql, b);
            return(sqlCaluse);
        }
Beispiel #4
0
        public virtual void ToInfo()
        {
            Queue.Sql = new StringBuilder();
            var strSelectSql  = Visit.Select(Queue.ExpSelect);
            var strWhereSql   = Visit.Where(Queue.ExpWhere);
            var strOrderBySql = Visit.OrderBy(Queue.ExpOrderBy);

            if (string.IsNullOrWhiteSpace(strSelectSql))
            {
                strSelectSql = "*";
            }
            if (!string.IsNullOrWhiteSpace(strWhereSql))
            {
                strWhereSql = "WHERE " + strWhereSql;
            }
            if (!string.IsNullOrWhiteSpace(strOrderBySql))
            {
                strOrderBySql = "ORDER BY " + strOrderBySql;
            }

            Queue.Sql.AppendFormat("SELECT {0} FROM {1} {2} {3} rownum <=1", strSelectSql, Query.DbProvider.KeywordAegis(TableName), strWhereSql, strOrderBySql);
        }
Beispiel #5
0
 protected override SqlCaluse Where(UnaryExpression exp, SqlCaluse sqlCaluse)
 {
     ExpressionVisit.Where(exp.Operand, sqlCaluse);
     return(sqlCaluse);
 }
Beispiel #6
0
        public virtual Queue ToEntity()
        {
            Queue.Sql = new StringBuilder();
            var strSelectSql  = Visit.Select(Queue.ExpSelect);
            var strWhereSql   = Visit.Where(Queue.ExpWhere);
            var strOrderBySql = Visit.OrderBy(Queue.ExpOrderBy);

            if (string.IsNullOrWhiteSpace(strSelectSql))
            {
                strSelectSql = "*";
            }
            if (!string.IsNullOrWhiteSpace(strWhereSql))
            {
                strWhereSql = "WHERE " + strWhereSql;
            }
            if (!string.IsNullOrWhiteSpace(strOrderBySql))
            {
                strOrderBySql = "ORDER BY " + strOrderBySql;
            }

            Queue.Sql.AppendFormat("SELECT TOP 1 {0} FROM {1} {2} {3}", strSelectSql, QueueManger.DbProvider.KeywordAegis(Queue.Name), strWhereSql, strOrderBySql);
            return(Queue);
        }