diff options
author | Thomas Tanghus <thomas@tanghus.net> | 2012-09-17 16:01:25 +0200 |
---|---|---|
committer | Thomas Tanghus <thomas@tanghus.net> | 2012-09-17 16:01:25 +0200 |
commit | ffe04182a86a326861763a5e6afa3577c52e07a5 (patch) | |
tree | 61a9cdb5d01a0d344d539240c3795865b4b7a089 /lib/public/db.php | |
parent | 6568671bdccb335ef7daddac0147056f457a3ea4 (diff) | |
download | nextcloud-server-ffe04182a86a326861763a5e6afa3577c52e07a5.tar.gz nextcloud-server-ffe04182a86a326861763a5e6afa3577c52e07a5.zip |
Added methods OC_DB::insertIfNotExist() and OCP\DB::insertIfNotExist().
Diffstat (limited to 'lib/public/db.php')
-rw-r--r-- | lib/public/db.php | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/public/db.php b/lib/public/db.php index 6ce62b27ca2..b9e56985e9d 100644 --- a/lib/public/db.php +++ b/lib/public/db.php @@ -46,6 +46,27 @@ class DB { } /** + * @brief Insert a row if a matching row doesn't exists. + * @param $table string The table name (will replace *PREFIX*) to perform the replace on. + * @param $input array + * + * The input array if in the form: + * + * array ( 'id' => array ( 'value' => 6, + * 'key' => true + * ), + * 'name' => array ('value' => 'Stoyan'), + * 'family' => array ('value' => 'Stefanov'), + * 'birth_date' => array ('value' => '1975-06-20') + * ); + * @returns true/false + * + */ + public static function insertIfNotExist($table, $input) { + return(\OC_DB::insertIfNotExist($table, $input)); + } + + /** * @brief gets last value of autoincrement * @param $table string The optional table name (will replace *PREFIX*) and add sequence suffix * @returns id |