简体   繁体   English

Idaeablade PassthruEsqlQuery返回空列表

[英]Idaeablade PassthruEsqlQuery returns empty list

I have two queries that should do the same job: 我有两个查询应该执行相同的工作:

1. 1。

var date = DateTime.
var q = _entityManager.Websites.Include("OfflineSites")
        .Where(website => (website.LastCheck == null) || SqlFunctions.DateDiff("minute",  website.LastCheck.Value, date) >= website.CurrentPingTime);                  
q.QueryStrategy = QueryStrategy.DataSourceOnly;

var lst = q.Execute().Cast<Website>().ToList();

2. 2。

 var query = new PassthruEsqlQuery(typeof(Website), @"Select * From Websites Where Id in (Select Id From (Select Id,CurrentPingTime,Abs(DateDiff(minute,CURRENT_TIMESTAMP,LastCheck)) LastCheckDiffNow From Websites )
                                                                as ret  Where CurrentPingTime <= LastCheckDiffNow)");
query.QueryStrategy = QueryStrategy.DataSourceOnly;

var result = query.With(_entityManager).Execute().Cast<Website>(); 
var lst = result.ToList()

However the first works like charm but is slower, the second one returns empty list. 但是第一个像魅力一样工作,但速度较慢,第二个返回空列表。 this is strange because I have checked the sql code in SSMS and it provided good results. 这很奇怪,因为我已经检查了SSMS中的sql代码,并提供了良好的结果。 What can be the reason for this behaviour. 可能是这种行为的原因。

Are you sure that this PassthruEsqlQuery isn't actually throwing an error? 您确定此PassthruEsqlQuery实际上没有引发错误吗? The PassthruEsqlQuery requires ESQL, not SQL, and what you're showing doesn't look correct. PassthruEsqlQuery需要ESQL,而不是SQL,并且所显示的内容看起来不正确。 There's some more information on the DevForce query here , and ESQL here . 有一个在DevForce查询一些更多的信息在这里 ,和ESQL 这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM