summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2018-03-26 21:45:25 +0200
committerGitHub <noreply@github.com>2018-03-26 21:45:25 +0200
commit36dbd7ec8f2af50ce409d9ccc5fd23fd83913263 (patch)
tree9645166031e57f5331e3016bd3761f9763be2e7b
parent4edcaa945f8546c8101637e0e932583b2b3255a9 (diff)
parent8a28bacb8c2dd173596141959f648cd2151b482e (diff)
downloadnextcloud-server-36dbd7ec8f2af50ce409d9ccc5fd23fd83913263.tar.gz
nextcloud-server-36dbd7ec8f2af50ce409d9ccc5fd23fd83913263.zip
Merge pull request #8985 from nextcloud/cleanup_ocp_db
Cleanup ocp db
-rw-r--r--apps/federatedfilesharing/lib/Controller/RequestHandlerController.php29
-rw-r--r--apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php30
-rw-r--r--apps/files_sharing/lib/ShareBackend/File.php11
-rw-r--r--apps/files_sharing/lib/ShareBackend/Folder.php47
-rw-r--r--apps/files_sharing/tests/ShareTest.php4
-rw-r--r--apps/files_sharing/tests/TestCase.php24
-rw-r--r--apps/user_ldap/lib/Helper.php2
-rw-r--r--apps/user_ldap/lib/Jobs/UpdateGroups.php8
-rw-r--r--lib/composer/composer/autoload_classmap.php1
-rw-r--r--lib/composer/composer/autoload_static.php1
-rw-r--r--lib/private/Tags.php14
-rw-r--r--lib/public/DB.php64
12 files changed, 113 insertions, 122 deletions
diff --git a/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php b/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php
index bc81db50b28..90346546a23 100644
--- a/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php
+++ b/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php
@@ -427,9 +427,19 @@ class RequestHandlerController extends OCSController {
$token = isset($_POST['token']) ? $_POST['token'] : null;
- $query = \OCP\DB::prepare('SELECT * FROM `*PREFIX*share_external` WHERE `remote_id` = ? AND `share_token` = ?');
- $query->execute(array($id, $token));
- $share = $query->fetchRow();
+ $qb = $this->connection->getQueryBuilder();
+ $qb->select('*')
+ ->from('share_external')
+ ->where(
+ $qb->expr()->andX(
+ $qb->expr()->eq('remote_id', $qb->createNamedParameter($id)),
+ $qb->expr()->eq('share_token', $qb->createNamedParameter($token))
+ )
+ );
+
+ $result = $qb->execute();
+ $share = $result->fetch();
+ $result->closeCursor();
if ($token && $id && !empty($share)) {
@@ -439,8 +449,17 @@ class RequestHandlerController extends OCSController {
$mountpoint = $share['mountpoint'];
$user = $share['user'];
- $query = \OCP\DB::prepare('DELETE FROM `*PREFIX*share_external` WHERE `remote_id` = ? AND `share_token` = ?');
- $query->execute(array($id, $token));
+ $qb = $this->connection->getQueryBuilder();
+ $qb->delete('share_external')
+ ->where(
+ $qb->expr()->andX(
+ $qb->expr()->eq('remote_id', $qb->createNamedParameter($id)),
+ $qb->expr()->eq('share_token', $qb->createNamedParameter($token))
+ )
+ );
+
+ $result = $qb->execute();
+ $result->closeCursor();
if ($share['accepted']) {
$path = trim($mountpoint, '/');
diff --git a/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php b/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php
index 035b7da15ca..d76f93751a4 100644
--- a/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php
+++ b/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php
@@ -119,11 +119,13 @@ class RequestHandlerControllerTest extends TestCase {
}
protected function tearDown() {
- $query = \OCP\DB::prepare('DELETE FROM `*PREFIX*share_external`');
- $query->execute();
+ $qb = $this->connection->getQueryBuilder();
+ $qb->delete('share_external');
+ $qb->execute();
- $query = \OCP\DB::prepare('DELETE FROM `*PREFIX*share`');
- $query->execute();
+ $qb = $this->connection->getQueryBuilder();
+ $qb->delete('share');
+ $qb->execute();
parent::tearDown();
}
@@ -142,9 +144,15 @@ class RequestHandlerControllerTest extends TestCase {
$this->s2s->createShare(null);
- $query = \OCP\DB::prepare('SELECT * FROM `*PREFIX*share_external` WHERE `remote_id` = ?');
- $result = $query->execute(array('1'));
- $data = $result->fetchRow();
+ $qb = $this->connection->getQueryBuilder();
+ $qb->select('*')
+ ->from('share_external')
+ ->where(
+ $qb->expr()->eq('remote_id', $qb->createNamedParameter(1))
+ );
+ $result = $qb->execute();
+ $data = $result->fetch();
+ $result->closeCursor();
$this->assertSame('localhost', $data['remote']);
$this->assertSame('token', $data['share_token']);
@@ -187,7 +195,7 @@ class RequestHandlerControllerTest extends TestCase {
$this->share->expects($this->any())->method('verifyShare')->willReturn(true);
- $dummy = \OCP\DB::prepare('
+ $dummy = \OC_DB::prepare('
INSERT INTO `*PREFIX*share`
(`share_type`, `uid_owner`, `item_type`, `item_source`, `item_target`, `file_source`, `file_target`, `permissions`, `stime`, `token`, `share_with`)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
@@ -195,7 +203,7 @@ class RequestHandlerControllerTest extends TestCase {
$dummy->execute(array(\OCP\Share::SHARE_TYPE_REMOTE, self::TEST_FILES_SHARING_API_USER1, 'test', '1', '/1', '1', '/test.txt', '1', time(), 'token1', 'foo@bar'));
$dummy->execute(array(\OCP\Share::SHARE_TYPE_REMOTE, self::TEST_FILES_SHARING_API_USER1, 'test', '1', '/1', '1', '/test.txt', '1', time(), 'token2', 'bar@bar'));
- $verify = \OCP\DB::prepare('SELECT * FROM `*PREFIX*share`');
+ $verify = \OC_DB::prepare('SELECT * FROM `*PREFIX*share`');
$result = $verify->execute();
$data = $result->fetchAll();
$this->assertCount(2, $data);
@@ -203,7 +211,7 @@ class RequestHandlerControllerTest extends TestCase {
$_POST['token'] = 'token1';
$this->s2s->declineShare(array('id' => $data[0]['id']));
- $verify = \OCP\DB::prepare('SELECT * FROM `*PREFIX*share`');
+ $verify = \OC_DB::prepare('SELECT * FROM `*PREFIX*share`');
$result = $verify->execute();
$data = $result->fetchAll();
$this->assertCount(1, $data);
@@ -212,7 +220,7 @@ class RequestHandlerControllerTest extends TestCase {
$_POST['token'] = 'token2';
$this->s2s->declineShare(array('id' => $data[0]['id']));
- $verify = \OCP\DB::prepare('SELECT * FROM `*PREFIX*share`');
+ $verify = \OC_DB::prepare('SELECT * FROM `*PREFIX*share`');
$result = $verify->execute();
$data = $result->fetchAll();
$this->assertEmpty($data);
diff --git a/apps/files_sharing/lib/ShareBackend/File.php b/apps/files_sharing/lib/ShareBackend/File.php
index e09591b37c0..dc1018f88a5 100644
--- a/apps/files_sharing/lib/ShareBackend/File.php
+++ b/apps/files_sharing/lib/ShareBackend/File.php
@@ -207,8 +207,15 @@ class File implements \OCP\Share_Backend_File_Dependent {
if (isset($source['parent'])) {
$parent = $source['parent'];
while (isset($parent)) {
- $query = \OCP\DB::prepare('SELECT `parent`, `uid_owner` FROM `*PREFIX*share` WHERE `id` = ?', 1);
- $item = $query->execute(array($parent))->fetchRow();
+ $qb = \OC::$server->getDatabaseConnection()->getQueryBuilder();
+ $qb->select('parent', 'uid_owner')
+ ->from('share')
+ ->where(
+ $qb->expr()->eq('id', $qb->createNamedParameter($parent))
+ );
+ $result = $qb->execute();
+ $item = $result->fetch();
+ $result->closeCursor();
if (isset($item['parent'])) {
$parent = $item['parent'];
} else {
diff --git a/apps/files_sharing/lib/ShareBackend/Folder.php b/apps/files_sharing/lib/ShareBackend/Folder.php
index c48a26300a2..0bb67e49b66 100644
--- a/apps/files_sharing/lib/ShareBackend/Folder.php
+++ b/apps/files_sharing/lib/ShareBackend/Folder.php
@@ -70,35 +70,62 @@ class Folder extends File implements \OCP\Share_Backend_Collection {
* @return mixed parent ID or null
*/
private function getParentId($child) {
- $query = \OCP\DB::prepare('SELECT `parent` FROM `*PREFIX*filecache` WHERE `fileid` = ?');
- $result = $query->execute(array($child));
- $row = $result->fetchRow();
+ $qb = \OC::$server->getDatabaseConnection()->getQueryBuilder();
+ $qb->select('parent')
+ ->from('filecache')
+ ->where(
+ $qb->expr()->eq('fileid', $qb->createNamedParameter($child))
+ );
+ $result = $qb->execute();
+ $row = $result->fetch();
+ $result->closeCursor();
return $row ? $row['parent'] : null;
}
public function getChildren($itemSource) {
$children = array();
$parents = array($itemSource);
- $query = \OCP\DB::prepare('SELECT `id` FROM `*PREFIX*mimetypes` WHERE `mimetype` = ?');
- $result = $query->execute(array('httpd/unix-directory'));
+
+ $qb = \OC::$server->getDatabaseConnection()->getQueryBuilder();
+ $qb->select('id')
+ ->from('mimetypes')
+ ->where(
+ $qb->expr()->eq('mimetype', $qb->createNamedParameter('httpd/unix-directory'))
+ );
+ $result = $qb->execute();
+ $row = $result->fetch();
+ $result->closeCursor();
+
if ($row = $result->fetchRow()) {
$mimetype = (int) $row['id'];
} else {
$mimetype = -1;
}
while (!empty($parents)) {
- $parents = "'".implode("','", $parents)."'";
- $query = \OCP\DB::prepare('SELECT `fileid`, `name`, `mimetype` FROM `*PREFIX*filecache`'
- .' WHERE `parent` IN ('.$parents.')');
- $result = $query->execute();
+
+ $qb = \OC::$server->getDatabaseConnection()->getQueryBuilder();
+
+ $parents = array_map(function($parent) use ($qb) {
+ return $qb->createNamedParameter($parent);
+ }, $parents);
+
+ $qb->select('`fileid', 'name', '`mimetype')
+ ->from('filecache')
+ ->where(
+ $qb->expr()->in('parent', $parents)
+ );
+
+ $result = $qb->execute();
+
$parents = array();
- while ($file = $result->fetchRow()) {
+ while ($file = $result->fetch()) {
$children[] = array('source' => $file['fileid'], 'file_path' => $file['name']);
// If a child folder is found look inside it
if ((int) $file['mimetype'] === $mimetype) {
$parents[] = $file['fileid'];
}
}
+ $result->closeCursor();
}
return $children;
}
diff --git a/apps/files_sharing/tests/ShareTest.php b/apps/files_sharing/tests/ShareTest.php
index 9b60255ed97..ca649768d71 100644
--- a/apps/files_sharing/tests/ShareTest.php
+++ b/apps/files_sharing/tests/ShareTest.php
@@ -63,10 +63,6 @@ class ShareTest extends TestCase {
self::$tempStorage = null;
- // clear database table
- $query = \OCP\DB::prepare('DELETE FROM `*PREFIX*share`');
- $query->execute();
-
parent::tearDown();
}
diff --git a/apps/files_sharing/tests/TestCase.php b/apps/files_sharing/tests/TestCase.php
index 3b1ccb71a94..e49b696e68a 100644
--- a/apps/files_sharing/tests/TestCase.php
+++ b/apps/files_sharing/tests/TestCase.php
@@ -120,8 +120,9 @@ abstract class TestCase extends \Test\TestCase {
}
protected function tearDown() {
- $query = \OCP\DB::prepare('DELETE FROM `*PREFIX*share`');
- $query->execute();
+ $qb = \OC::$server->getDatabaseConnection()->getQueryBuilder();
+ $qb->delete('share');
+ $qb->execute();
parent::tearDown();
}
@@ -206,16 +207,15 @@ abstract class TestCase extends \Test\TestCase {
* @return array with: item_source, share_type, share_with, item_type, permissions
*/
protected function getShareFromId($shareID) {
- $sql = 'SELECT `item_source`, `share_type`, `share_with`, `item_type`, `permissions` FROM `*PREFIX*share` WHERE `id` = ?';
- $args = array($shareID);
- $query = \OCP\DB::prepare($sql);
- $result = $query->execute($args);
-
- $share = Null;
-
- if ($result) {
- $share = $result->fetchRow();
- }
+ $qb = \OC::$server->getDatabaseConnection()->getQueryBuilder();
+ $qb->select('item_source', '`share_type', 'share_with', 'item_type', 'permissions')
+ ->from('share')
+ ->where(
+ $qb->expr()->eq('id', $qb->createNamedParameter($shareID))
+ );
+ $result = $qb->execute();
+ $share = $result->fetch();
+ $result->closeCursor();
return $share;
diff --git a/apps/user_ldap/lib/Helper.php b/apps/user_ldap/lib/Helper.php
index fb5b5478102..a4bac9667b9 100644
--- a/apps/user_ldap/lib/Helper.php
+++ b/apps/user_ldap/lib/Helper.php
@@ -155,7 +155,7 @@ class Helper {
$saveOtherConfigurations = 'AND `configkey` NOT LIKE \'s%\'';
}
- $query = \OCP\DB::prepare('
+ $query = \OC_DB::prepare('
DELETE
FROM `*PREFIX*appconfig`
WHERE `configkey` LIKE ?
diff --git a/apps/user_ldap/lib/Jobs/UpdateGroups.php b/apps/user_ldap/lib/Jobs/UpdateGroups.php
index c5eff77dbe3..2b57874c62f 100644
--- a/apps/user_ldap/lib/Jobs/UpdateGroups.php
+++ b/apps/user_ldap/lib/Jobs/UpdateGroups.php
@@ -93,7 +93,7 @@ class UpdateGroups extends \OC\BackgroundJob\TimedJob {
*/
static private function handleKnownGroups($groups) {
\OCP\Util::writeLog('user_ldap', 'bgJ "updateGroups" – Dealing with known Groups.', \OCP\Util::DEBUG);
- $query = \OCP\DB::prepare('
+ $query = \OC_DB::prepare('
UPDATE `*PREFIX*ldap_group_members`
SET `owncloudusers` = ?
WHERE `owncloudname` = ?
@@ -131,7 +131,7 @@ class UpdateGroups extends \OC\BackgroundJob\TimedJob {
*/
static private function handleCreatedGroups($createdGroups) {
\OCP\Util::writeLog('user_ldap', 'bgJ "updateGroups" – dealing with created Groups.', \OCP\Util::DEBUG);
- $query = \OCP\DB::prepare('
+ $query = \OC_DB::prepare('
INSERT
INTO `*PREFIX*ldap_group_members` (`owncloudname`, `owncloudusers`)
VALUES (?, ?)
@@ -153,7 +153,7 @@ class UpdateGroups extends \OC\BackgroundJob\TimedJob {
*/
static private function handleRemovedGroups($removedGroups) {
\OCP\Util::writeLog('user_ldap', 'bgJ "updateGroups" – dealing with removed groups.', \OCP\Util::DEBUG);
- $query = \OCP\DB::prepare('
+ $query = \OC_DB::prepare('
DELETE
FROM `*PREFIX*ldap_group_members`
WHERE `owncloudname` = ?
@@ -212,7 +212,7 @@ class UpdateGroups extends \OC\BackgroundJob\TimedJob {
if(is_array(self::$groupsFromDB)) {
return self::$groupsFromDB;
}
- $query = \OCP\DB::prepare('
+ $query = \OC_DB::prepare('
SELECT `owncloudname`, `owncloudusers`
FROM `*PREFIX*ldap_group_members`
');
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php
index 32534c2a9e9..66abafab99e 100644
--- a/lib/composer/composer/autoload_classmap.php
+++ b/lib/composer/composer/autoload_classmap.php
@@ -98,7 +98,6 @@ return array(
'OCP\\Contacts\\ContactsMenu\\ILinkAction' => $baseDir . '/lib/public/Contacts/ContactsMenu/ILinkAction.php',
'OCP\\Contacts\\ContactsMenu\\IProvider' => $baseDir . '/lib/public/Contacts/ContactsMenu/IProvider.php',
'OCP\\Contacts\\IManager' => $baseDir . '/lib/public/Contacts/IManager.php',
- 'OCP\\DB' => $baseDir . '/lib/public/DB.php',
'OCP\\DB\\ISchemaWrapper' => $baseDir . '/lib/public/DB/ISchemaWrapper.php',
'OCP\\DB\\QueryBuilder\\ICompositeExpression' => $baseDir . '/lib/public/DB/QueryBuilder/ICompositeExpression.php',
'OCP\\DB\\QueryBuilder\\IExpressionBuilder' => $baseDir . '/lib/public/DB/QueryBuilder/IExpressionBuilder.php',
diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php
index d37777001b6..c33f07a54ad 100644
--- a/lib/composer/composer/autoload_static.php
+++ b/lib/composer/composer/autoload_static.php
@@ -128,7 +128,6 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OCP\\Contacts\\ContactsMenu\\ILinkAction' => __DIR__ . '/../../..' . '/lib/public/Contacts/ContactsMenu/ILinkAction.php',
'OCP\\Contacts\\ContactsMenu\\IProvider' => __DIR__ . '/../../..' . '/lib/public/Contacts/ContactsMenu/IProvider.php',
'OCP\\Contacts\\IManager' => __DIR__ . '/../../..' . '/lib/public/Contacts/IManager.php',
- 'OCP\\DB' => __DIR__ . '/../../..' . '/lib/public/DB.php',
'OCP\\DB\\ISchemaWrapper' => __DIR__ . '/../../..' . '/lib/public/DB/ISchemaWrapper.php',
'OCP\\DB\\QueryBuilder\\ICompositeExpression' => __DIR__ . '/../../..' . '/lib/public/DB/QueryBuilder/ICompositeExpression.php',
'OCP\\DB\\QueryBuilder\\IExpressionBuilder' => __DIR__ . '/../../..' . '/lib/public/DB/QueryBuilder/IExpressionBuilder.php',
diff --git a/lib/private/Tags.php b/lib/private/Tags.php
index cf1c5c0fbad..c78297e5290 100644
--- a/lib/private/Tags.php
+++ b/lib/private/Tags.php
@@ -288,7 +288,7 @@ class Tags implements \OCP\ITags {
. '` WHERE `categoryid` = ?';
try {
- $stmt = \OCP\DB::prepare($sql);
+ $stmt = \OC_DB::prepare($sql);
$result = $stmt->execute(array($tagId));
if ($result === null) {
\OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), \OCP\Util::ERROR);
@@ -530,7 +530,7 @@ class Tags implements \OCP\ITags {
// Find all objectid/tagId pairs.
$result = null;
try {
- $stmt = \OCP\DB::prepare('SELECT `id` FROM `' . self::TAG_TABLE . '` '
+ $stmt = \OC_DB::prepare('SELECT `id` FROM `' . self::TAG_TABLE . '` '
. 'WHERE `uid` = ?');
$result = $stmt->execute(array($arguments['uid']));
if ($result === null) {
@@ -546,7 +546,7 @@ class Tags implements \OCP\ITags {
if(!is_null($result)) {
try {
- $stmt = \OCP\DB::prepare('DELETE FROM `' . self::RELATION_TABLE . '` '
+ $stmt = \OC_DB::prepare('DELETE FROM `' . self::RELATION_TABLE . '` '
. 'WHERE `categoryid` = ?');
while( $row = $result->fetchRow()) {
try {
@@ -568,7 +568,7 @@ class Tags implements \OCP\ITags {
}
}
try {
- $stmt = \OCP\DB::prepare('DELETE FROM `' . self::TAG_TABLE . '` '
+ $stmt = \OC_DB::prepare('DELETE FROM `' . self::TAG_TABLE . '` '
. 'WHERE `uid` = ?');
$result = $stmt->execute(array($arguments['uid']));
if ($result === null) {
@@ -600,7 +600,7 @@ class Tags implements \OCP\ITags {
$query .= 'WHERE `objid` IN (' . str_repeat('?,', count($ids)-1) . '?) ';
$query .= 'AND `type`= ?';
$updates[] = $this->type;
- $stmt = \OCP\DB::prepare($query);
+ $stmt = \OC_DB::prepare($query);
$result = $stmt->execute($updates);
if ($result === null) {
\OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), \OCP\Util::ERROR);
@@ -719,7 +719,7 @@ class Tags implements \OCP\ITags {
try {
$sql = 'DELETE FROM `' . self::RELATION_TABLE . '` '
. 'WHERE `objid` = ? AND `categoryid` = ? AND `type` = ?';
- $stmt = \OCP\DB::prepare($sql);
+ $stmt = \OC_DB::prepare($sql);
$stmt->execute(array($objid, $tagId, $this->type));
} catch(\Exception $e) {
\OC::$server->getLogger()->logException($e, [
@@ -769,7 +769,7 @@ class Tags implements \OCP\ITags {
try {
$sql = 'DELETE FROM `' . self::RELATION_TABLE . '` '
. 'WHERE `categoryid` = ?';
- $stmt = \OCP\DB::prepare($sql);
+ $stmt = \OC_DB::prepare($sql);
$result = $stmt->execute(array($id));
if ($result === null) {
\OCP\Util::writeLog('core',
diff --git a/lib/public/DB.php b/lib/public/DB.php
deleted file mode 100644
index 85a34ff37a0..00000000000
--- a/lib/public/DB.php
+++ /dev/null
@@ -1,64 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- *
- * @author Bart Visscher <bartv@thisnet.nl>
- * @author Dan Bartram <daneybartram@gmail.com>
- * @author Frank Karlitschek <frank@karlitschek.de>
- * @author Joas Schilling <coding@schilljs.com>
- * @author Jörn Friedrich Dreyer <jfd@butonic.de>
- * @author Lukas Reschke <lukas@statuscode.ch>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Robin Appelman <robin@icewind.nl>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- * @author Thomas Müller <thomas.mueller@tmit.eu>
- * @author Thomas Tanghus <thomas@tanghus.net>
- *
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
- */
-
-/**
- * Public interface of ownCloud for apps to use.
- * DB Class
- *
- */
-
-// use OCP namespace for all classes that are considered public.
-// This means that they should be used by apps instead of the internal ownCloud classes
-namespace OCP;
-
-/**
- * This class provides access to the internal database system. Use this class exlusively if you want to access databases
- * @deprecated 8.1.0 use methods of \OCP\IDBConnection - \OC::$server->getDatabaseConnection()
- * @since 4.5.0
- */
-class DB {
- /**
- * Prepare a SQL query
- * @param string $query Query string
- * @param int $limit Limit of the SQL statement
- * @param int $offset Offset of the SQL statement
- * @return \OC_DB_StatementWrapper prepared SQL query
- *
- * SQL query via Doctrine prepare(), needs to be execute()'d!
- * @deprecated 8.1.0 use prepare() of \OCP\IDBConnection - \OC::$server->getDatabaseConnection()
- * @since 4.5.0
- */
- static public function prepare( $query, $limit=null, $offset=null ) {
- return \OC_DB::prepare($query, $limit, $offset);
- }
-
-}