summaryrefslogtreecommitdiff
path: root/it_dbi.class
diff options
context:
space:
mode:
authorUrban Müller2017-03-08 13:49:40 +0100
committerUrban Müller2017-03-08 13:49:40 +0100
commit7ef68870c30f9a4e91756b65513f7872c87e8039 (patch)
tree9d08099894ab4190fcf1a5c4b5275690bb2c72ad /it_dbi.class
parent7fb48dc959d3428c9c0594dbc270b122a11287ca (diff)
downloaditools-7ef68870c30f9a4e91756b65513f7872c87e8039.tar.gz
itools-7ef68870c30f9a4e91756b65513f7872c87e8039.tar.bz2
itools-7ef68870c30f9a4e91756b65513f7872c87e8039.zip
combined update/insert
Diffstat (limited to 'it_dbi.class')
-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