summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2013-07-23 18:09:38 +0200
committerBart Visscher <bartv@thisnet.nl>2013-07-23 18:09:42 +0200
commit3eb5fff02a477fbb3bd4080a4eb4e773e8db5d1f (patch)
tree965932b91d3b6f8a175c52ccb31f29be7a5288bf
parentbe7c6139938564fc2ce5a12982eb82f60087f900 (diff)
downloadnextcloud-server-3eb5fff02a477fbb3bd4080a4eb4e773e8db5d1f.tar.gz
nextcloud-server-3eb5fff02a477fbb3bd4080a4eb4e773e8db5d1f.zip
Add documentation to OC\DB\adapter class
-rw-r--r--lib/db/adapter.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/db/adapter.php b/lib/db/adapter.php
index 20e7ea4a600..2e4f230f366 100644
--- a/lib/db/adapter.php
+++ b/lib/db/adapter.php
@@ -8,6 +8,10 @@
namespace OC\DB;
+/**
+ * This handles the way we use to write queries, into something that can be
+ * handled by the database abstraction layer.
+ */
class Adapter {
protected $conn;
@@ -15,14 +19,28 @@ class Adapter {
$this->conn = $conn;
}
+ /**
+ * @param string $table name
+ * @return int id of last insert statement
+ */
public function lastInsertId($table) {
return $this->conn->realLastInsertId($table);
}
+ /**
+ * @param $statement that needs to be changed so the db can handle it
+ * @return string changed statement
+ */
public function fixupStatement($statement) {
return $statement;
}
+ /**
+ * @brief insert the @input values when they do not exist yet
+ * @param string $table name
+ * @param array key->value pairs
+ * @return count of inserted rows
+ */
public function insertIfNotExist($table, $input) {
$query = 'INSERT INTO `' .$table . '` (`'
. implode('`,`', array_keys($input)) . '`) SELECT '