void table_base::remove_where(const abstract_predicate &pred) const { if (a_priori_false(pred)) return; const unique_ptr<sql> cmd = clone(_sql_delete); if (! a_priori_true(pred)) cmd->write_where(pred); _database.get_session()->exec(*cmd); }
unique_ptr<sql> table_base::sql_update( const abstract_mapper_base &dest, const Src &src, const abstract_predicate &pred, const abstract_mapper_base *returning ) const { if (! is_subset(dest.columns(), _value_mapper.columns())) throw outside_table_exception(_binomen); unique_ptr<sql> cmd = _database.make_sql(); cmd->write_update(_binomen, dest, src, readback_id()); if (! a_priori_true(pred)) cmd->write_where(pred); if (returning != nullptr) cmd->write_returning(*returning); return cmd; }
void sql::write_where(const abstract_predicate &pred) { assert (! a_priori_true(pred)); write(" WHERE "); write_evaluation(predicate(pred)); }