[Pkg-owncloud-commits] [owncloud] 53/118: Fix doc blocks of insertIfNotExists() method

David Prévot taffit at moszumanska.debian.org
Fri Mar 27 22:13:12 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch stable8
in repository owncloud.

commit 171974e43cc8548a6f438cf67bfe85e55810682a
Author: Joas Schilling <nickvergessen at owncloud.com>
Date:   Wed Mar 11 09:00:47 2015 +0100

    Fix doc blocks of insertIfNotExists() method
    
    Conflicts:
    	lib/private/appframework/db/db.php
---
 lib/private/db/adapter.php       | 13 ++++++++-----
 lib/private/db/adaptersqlite.php | 13 ++++++++-----
 lib/private/db/connection.php    | 14 ++++++++------
 lib/public/db.php                | 22 ++++++++--------------
 lib/public/idbconnection.php     | 24 ++++++++----------------
 5 files changed, 40 insertions(+), 46 deletions(-)

diff --git a/lib/private/db/adapter.php b/lib/private/db/adapter.php
index bd1604c..d0641f1 100644
--- a/lib/private/db/adapter.php
+++ b/lib/private/db/adapter.php
@@ -40,13 +40,16 @@ class Adapter {
 	}
 
 	/**
-	 * insert the @input values when they do not exist yet
-	 * @param string $table name
-	 * @param array $input key->value pair, key has to be sanitized properly
+	 * Insert a row if the matching row does not exists.
+	 *
+	 * @param string $table The table name (will replace *PREFIX* with the actual prefix)
+	 * @param array $input data that should be inserted into the table  (column name => value)
+	 * @param array|null $compare List of values that should be checked for "if not exists"
+	 *				If this is null or an empty array, all keys of $input will be compared
+	 * @return int number of inserted rows
 	 * @throws \Doctrine\DBAL\DBALException
-	 * @return int count of inserted rows
 	 */
-	public function insertIfNotExist($table, $input, $compare = null) {
+	public function insertIfNotExist($table, $input, array $compare = null) {
 		if ($compare === null) {
 			$compare = array_keys($input);
 		}
diff --git a/lib/private/db/adaptersqlite.php b/lib/private/db/adaptersqlite.php
index f93183b..1528285 100644
--- a/lib/private/db/adaptersqlite.php
+++ b/lib/private/db/adaptersqlite.php
@@ -19,13 +19,16 @@ class AdapterSqlite extends Adapter {
 	}
 
 	/**
-	 * @param string $table
-	 * @param array $input
-	 * @param null $compare
-	 * @return int
+	 * Insert a row if the matching row does not exists.
+	 *
+	 * @param string $table The table name (will replace *PREFIX* with the actual prefix)
+	 * @param array $input data that should be inserted into the table  (column name => value)
+	 * @param array|null $compare List of values that should be checked for "if not exists"
+	 *				If this is null or an empty array, all keys of $input will be compared
+	 * @return int number of inserted rows
 	 * @throws \Doctrine\DBAL\DBALException
 	 */
-	public function insertIfNotExist($table, $input, $compare = null) {
+	public function insertIfNotExist($table, $input, array $compare = null) {
 		if ($compare === null) {
 			$compare = array_keys($input);
 		}
diff --git a/lib/private/db/connection.php b/lib/private/db/connection.php
index 012792f..ed71738 100644
--- a/lib/private/db/connection.php
+++ b/lib/private/db/connection.php
@@ -155,14 +155,16 @@ class Connection extends \Doctrine\DBAL\Connection implements IDBConnection {
 	}
 
 	/**
-	 * Insert a row if a matching row does not exists.
-	 * @param string $table. The table to insert into in the form '*PREFIX*tableName'
-	 * @param array $input. An array of field name/value pairs
-	 * @param array $compare
+	 * Insert a row if the matching row does not exists.
+	 *
+	 * @param string $table The table name (will replace *PREFIX* with the actual prefix)
+	 * @param array $input data that should be inserted into the table  (column name => value)
+	 * @param array|null $compare List of values that should be checked for "if not exists"
+	 *				If this is null or an empty array, all keys of $input will be compared
+	 * @return int number of inserted rows
 	 * @throws \Doctrine\DBAL\DBALException
-	 * @return bool The return value from execute()
 	 */
-	public function insertIfNotExist($table, $input, $compare = null) {
+	public function insertIfNotExist($table, $input, array $compare = null) {
 		return $this->adapter->insertIfNotExist($table, $input, $compare);
 	}
 
diff --git a/lib/public/db.php b/lib/public/db.php
index d8d81f2..595ecd6 100644
--- a/lib/public/db.php
+++ b/lib/public/db.php
@@ -48,23 +48,17 @@ class DB {
 	}
 
 	/**
-	 * Insert a row if a matching row doesn't exists.
-	 * @param string $table The optional table name (will replace *PREFIX*) and add sequence suffix
-	 * @param array $input
-	 *
-	 * The input array if in the form:
+	 * Insert a row if the matching row does not exists.
 	 *
-	 * array ( 'id' => array ( 'value' => 6,
-	 *	'key' => true
-	 *	),
-	 *	'name' => array ('value' => 'Stoyan'),
-	 *	'family' => array ('value' => 'Stefanov'),
-	 *	'birth_date' => array ('value' => '1975-06-20')
-	 *	);
-	 * @return bool
+	 * @param string $table The table name (will replace *PREFIX* with the actual prefix)
+	 * @param array $input data that should be inserted into the table  (column name => value)
+	 * @param array|null $compare List of values that should be checked for "if not exists"
+	 *				If this is null or an empty array, all keys of $input will be compared
+	 * @return int number of inserted rows
+	 * @throws \Doctrine\DBAL\DBALException
 	 *
 	 */
-	public static function insertIfNotExist($table, $input, $compare = null) {
+	public static function insertIfNotExist($table, $input, array $compare = null) {
 		return \OC::$server->getDatabaseConnection()->insertIfNotExist($table, $input, $compare);
 	}
 
diff --git a/lib/public/idbconnection.php b/lib/public/idbconnection.php
index 879d1b5..0671cb4 100644
--- a/lib/public/idbconnection.php
+++ b/lib/public/idbconnection.php
@@ -77,24 +77,16 @@ interface IDBConnection {
 	public function lastInsertId($table = null);
 
 	/**
-	 * Insert a row if a matching row doesn't exists.
-	 * @param string $table The table name (will replace *PREFIX*) to perform the replace on.
-	 * @param array $input
-	 * @throws \Doctrine\DBAL\DBALException
-	 *
-	 * 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')
-	 *	);
-	 * @return bool
+	 * Insert a row if the matching row does not exists.
 	 *
+	 * @param string $table The table name (will replace *PREFIX* with the actual prefix)
+	 * @param array $input data that should be inserted into the table  (column name => value)
+	 * @param array|null $compare List of values that should be checked for "if not exists"
+	 *				If this is null or an empty array, all keys of $input will be compared
+	 * @return int number of inserted rows
+	 * @throws \Doctrine\DBAL\DBALException
 	 */
-	public function insertIfNotExist($table, $input, $compare = null);
+	public function insertIfNotExist($table, $input, array $compare = null);
 
 	/**
 	 * Start a transaction

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list