summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--it_dbi.class8
1 files changed, 8 insertions, 0 deletions
diff --git a/it_dbi.class b/it_dbi.class
index 4e20359..48a02b8 100644
--- a/it_dbi.class
+++ b/it_dbi.class
@@ -918,6 +918,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
* @return initialized object or null if ID not found