bool xRedisClient::sunionstore(const RedisDBIdx& dbi, const KEY& deskey, const DBIArray& vdbi, const KEYS& vkey, int64_t& count) { VALUES sValue; if (!sunion(vdbi, vkey, sValue)) { return false; } return sadd(dbi, deskey, sValue, count); }
bool xRedisClient::sunionstore(const RedisDBIdx& dbi, const KEY& deskey, const DBIArray& vdbi, const KEYS& vkey, int64_t& count) { VALUES sValue; if (!dbi.mIOFlag) { SetIOtype(dbi, MASTER, true); } if (!sunion(vdbi, vkey, sValue)) { return false; } return sadd(dbi, deskey, sValue, count); }
//everything in t1 + everything in t2 not in t1 Table Database::set_union(Table t1, Table t2){ if(union_compatible(t1, t2)) { Table sunion(t1.get_name()); //adding records sunion.set_records(t1.get_records()); for (int i = 0; i < t2.get_records().size(); ++i) { if(!record_exists(t1,t2.get_records()[i])) sunion.add_record(t2.get_records()[i]); } //adding attributes sunion.set_attributes(t1.get_attributes()); return sunion; } else throw runtime_error("Error: Sets are incompatible\n"); return Table("NULL"); }
Set Set::operator +(const Set& obj){ return sunion(*this,obj);; }