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); }
SqlSelect SqlWith::operator()(const SqlSelect& select) { SqlSet set; set.SetRaw(text + " " + SqlStatement(select).GetText()); return set; }
static inline void sCat(SqlSet& s, SqlVal v) { s.Cat(v); }
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); }
virtual void Field(const char *name, Ref) { set->Cat(SqlId(name)); }
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); }