From 7ef68870c30f9a4e91756b65513f7872c87e8039 Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Wed, 8 Mar 2017 13:49:40 +0100 Subject: combined update/insert --- it_dbi.class | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/it_dbi.class b/it_dbi.class index 4e20359..48a02b8 100644 --- a/it_dbi.class +++ b/it_dbi.class @@ -917,6 +917,14 @@ function valid() } +/** + * Updates or inserts record. Destroys iterator of dbi object used + */ +function upsert($tags) +{ + return $this->read($tags[$this->_p['keyfield']]) ? $this->update($tags) : $this->replace($tags); +} + /** * STATIC: create an object and read its record from DB. * @param $id ID of record to read -- cgit v1.2.3