NAMESPACE_UPP SqlSet operator|(const SqlSet& s1, const SqlSet& s2) { if(s1.IsEmpty()) return s2; if(s2.IsEmpty()) return s1; return SqlSet(s1(SqlSet::SET, ~SQLITE3) + " union " + s2(SqlSet::SET, ~SQLITE3), SqlSet::SETOP); }
SqlBool NotIn(const SqlVal& a, const SqlSet& b) { if(a.IsNull() || b.IsEmpty()) return true; return SqlBool(a(SqlS::COMP) + " not in " + b(), SqlS::COMP); }
SqlBool In(const SqlVal& a, const SqlSet& b) { if(a.IsNull() || b.IsEmpty()) return false; return SqlBool(a(SqlS::COMP) + " in " + b(), SqlS::COMP); }
SqlSet operator-(const SqlSet& s1, const SqlSet& s2) { if(s1.IsEmpty() || s2.IsEmpty()) return s1; return SqlSet(s1(SqlSet::SET) + SqlCode(MSSQL|PGSQL|SQLITE3, " except ")(" minus ") + s2(SqlSet::SET), SqlSet::SETOP); }
SqlSet operator&(const SqlSet& s1, const SqlSet& s2) { if(s1.IsEmpty()) return s2; if(s2.IsEmpty()) return s1; return SqlSet(s1(SqlSet::SET, ~SQLITE3) + " intersect " + s2(SqlSet::SET, ~SQLITE3), SqlSet::SETOP); }
SqlSet operator+(const SqlSet& s1, const SqlSet& s2) { if(s1.IsEmpty()) return s2; if(s2.IsEmpty()) return s1; return SqlSet(s1(SqlSet::SET, ~SQLITE3) + " union all " + s2(SqlSet::SET, ~SQLITE3), SqlSet::SETOP); }