diff options
author | Urban Müller | 2017-03-08 13:49:40 +0100 |
---|---|---|
committer | Urban Müller | 2017-03-08 13:49:40 +0100 |
commit | 7ef68870c30f9a4e91756b65513f7872c87e8039 (patch) | |
tree | 9d08099894ab4190fcf1a5c4b5275690bb2c72ad | |
parent | 7fb48dc959d3428c9c0594dbc270b122a11287ca (diff) | |
download | itools-7ef68870c30f9a4e91756b65513f7872c87e8039.tar.gz itools-7ef68870c30f9a4e91756b65513f7872c87e8039.tar.bz2 itools-7ef68870c30f9a4e91756b65513f7872c87e8039.zip |
combined update/insert
-rw-r--r-- | it_dbi.class | 8 |
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 |