简体   繁体   English

db4o SODA比较字段值

[英]db4o SODA compare field values

class SomeClass
{
  private DateTime fieldA;
  private DateTime fieldB;
}

Using SODA, what is the proper way to select all objects whose fieldA is greater than fieldB? 使用SODA,选择fieldA大于fieldB的所有对象的正确方法是什么?

Something like this? 像这样吗

var query = this.ObjectContainer.Query();
query.Constrain(typeof(SomeClass));
query.Descend("fieldA").Constrain(query.Descend("fieldB")).Greater();
var list = query.Execute();

You mean how to express a query like the following (SQL) 您的意思是如何表达如下查询(SQL)

select * from SomeTable where fieldA > fieldB

in SODA, right? 在SODA中,对吗?

I am afraid this is not possible (at least not without using an evaluation or a native query - which, in this case, will run as an evaluation anyway). 恐怕这是不可能的(至少不能不使用评估或本机查询-在这种情况下,无论如何它们都将作为评估运行)。

Best 最好

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

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