Add optional Criteria && || operator support (#1797)
This commit is contained in:
parent
63b7f5eb13
commit
fd7af8110f
|
@ -21,8 +21,16 @@ namespace orm
|
|||
{
|
||||
const Criteria operator&&(Criteria cond1, Criteria cond2)
|
||||
{
|
||||
assert(cond1);
|
||||
assert(cond2);
|
||||
bool cond1valid = (bool)cond1, cond2valid = (bool)cond2;
|
||||
assert(cond1valid || cond2valid);
|
||||
if (cond1valid && !cond2valid)
|
||||
{
|
||||
return cond1;
|
||||
}
|
||||
if (!cond1valid && cond2valid)
|
||||
{
|
||||
return cond2;
|
||||
}
|
||||
Criteria cond;
|
||||
cond.conditionString_ = "( ";
|
||||
cond.conditionString_ += cond1.conditionString_;
|
||||
|
@ -47,8 +55,16 @@ const Criteria operator&&(Criteria cond1, Criteria cond2)
|
|||
|
||||
const Criteria operator||(Criteria cond1, Criteria cond2)
|
||||
{
|
||||
assert(cond1);
|
||||
assert(cond2);
|
||||
bool cond1valid = (bool)cond1, cond2valid = (bool)cond2;
|
||||
assert(cond1valid || cond2valid);
|
||||
if (cond1valid && !cond2valid)
|
||||
{
|
||||
return cond1;
|
||||
}
|
||||
if (!cond1valid && cond2valid)
|
||||
{
|
||||
return cond2;
|
||||
}
|
||||
Criteria cond;
|
||||
cond.conditionString_ = "( ";
|
||||
cond.conditionString_ += cond1.conditionString_;
|
||||
|
|
Loading…
Reference in New Issue