diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/appframework/db/db.php | 3 | ||||
-rw-r--r-- | lib/private/backgroundjob/joblist.php | 13 | ||||
-rw-r--r-- | lib/private/comments/manager.php | 15 | ||||
-rw-r--r-- | lib/private/db/querybuilder/querybuilder.php | 12 | ||||
-rw-r--r-- | lib/public/appframework/db/mapper.php | 2 | ||||
-rw-r--r-- | lib/public/db/querybuilder/iquerybuilder.php | 12 | ||||
-rw-r--r-- | lib/public/idbconnection.php | 3 |
7 files changed, 32 insertions, 28 deletions
diff --git a/lib/private/appframework/db/db.php b/lib/private/appframework/db/db.php index 5fdc5d1066c..72d481885ca 100644 --- a/lib/private/appframework/db/db.php +++ b/lib/private/appframework/db/db.php @@ -25,6 +25,7 @@ namespace OC\AppFramework\Db; +use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\IDb; use OCP\IDBConnection; @@ -240,7 +241,7 @@ class Db implements IDb { * @param int $type Type of the parameter. * @return string The quoted parameter. */ - public function quote($input, $type = \PDO::PARAM_STR) { + public function quote($input, $type = IQueryBuilder::PARAM_STR) { return $this->connection->quote($input, $type); } diff --git a/lib/private/backgroundjob/joblist.php b/lib/private/backgroundjob/joblist.php index 2920cb5214c..b8230fca4de 100644 --- a/lib/private/backgroundjob/joblist.php +++ b/lib/private/backgroundjob/joblist.php @@ -28,6 +28,7 @@ use OCP\AppFramework\QueryException; use OCP\BackgroundJob\IJob; use OCP\BackgroundJob\IJobList; use OCP\AutoloadNotAllowedException; +use OCP\DB\QueryBuilder\IQueryBuilder; class JobList implements IJobList { /** @var \OCP\IDBConnection */ @@ -69,7 +70,7 @@ class JobList implements IJobList { ->values([ 'class' => $query->createNamedParameter($class), 'argument' => $query->createNamedParameter($argument), - 'last_run' => $query->createNamedParameter(0, \PDO::PARAM_INT), + 'last_run' => $query->createNamedParameter(0, IQueryBuilder::PARAM_INT), ]); $query->execute(); } @@ -102,7 +103,7 @@ class JobList implements IJobList { protected function removeById($id) { $query = $this->connection->getQueryBuilder(); $query->delete('jobs') - ->where($query->expr()->eq('id', $query->createNamedParameter($id, \PDO::PARAM_INT))); + ->where($query->expr()->eq('id', $query->createNamedParameter($id, IQueryBuilder::PARAM_INT))); $query->execute(); } @@ -171,7 +172,7 @@ class JobList implements IJobList { $query = $this->connection->getQueryBuilder(); $query->select('*') ->from('jobs') - ->where($query->expr()->gt('id', $query->createNamedParameter($lastId, \PDO::PARAM_INT))) + ->where($query->expr()->gt('id', $query->createNamedParameter($lastId, IQueryBuilder::PARAM_INT))) ->orderBy('id', 'ASC') ->setMaxResults(1); $result = $query->execute(); @@ -216,7 +217,7 @@ class JobList implements IJobList { $query = $this->connection->getQueryBuilder(); $query->select('*') ->from('jobs') - ->where($query->expr()->eq('id', $query->createNamedParameter($id, \PDO::PARAM_INT))); + ->where($query->expr()->eq('id', $query->createNamedParameter($id, IQueryBuilder::PARAM_INT))); $result = $query->execute(); $row = $result->fetch(); $result->closeCursor(); @@ -286,8 +287,8 @@ class JobList implements IJobList { public function setLastRun($job) { $query = $this->connection->getQueryBuilder(); $query->update('jobs') - ->set('last_run', $query->createNamedParameter(time(), \PDO::PARAM_INT)) - ->where($query->expr()->eq('id', $query->createNamedParameter($job->getId(), \PDO::PARAM_INT))); + ->set('last_run', $query->createNamedParameter(time(), IQueryBuilder::PARAM_INT)) + ->where($query->expr()->eq('id', $query->createNamedParameter($job->getId(), IQueryBuilder::PARAM_INT))); $query->execute(); } } diff --git a/lib/private/comments/manager.php b/lib/private/comments/manager.php index 36b2d9d08b8..8fc05884784 100644 --- a/lib/private/comments/manager.php +++ b/lib/private/comments/manager.php @@ -25,6 +25,7 @@ use OCP\Comments\CommentsEvent; use OCP\Comments\IComment; use OCP\Comments\ICommentsManager; use OCP\Comments\NotFoundException; +use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\IDBConnection; use OCP\IConfig; use OCP\ILogger; @@ -233,7 +234,7 @@ class Manager implements ICommentsManager { $resultStatement = $qb->select('*') ->from('comments') ->where($qb->expr()->eq('id', $qb->createParameter('id'))) - ->setParameter('id', $id, \PDO::PARAM_INT) + ->setParameter('id', $id, IQueryBuilder::PARAM_INT) ->execute(); $data = $resultStatement->fetch(); @@ -675,9 +676,9 @@ class Manager implements ICommentsManager { ->where($qb->expr()->eq('user_id', $qb->createParameter('user_id'))) ->andWhere($qb->expr()->eq('object_type', $qb->createParameter('object_type'))) ->andWhere($qb->expr()->eq('object_id', $qb->createParameter('object_id'))) - ->setParameter('user_id', $user->getUID(), \PDO::PARAM_STR) - ->setParameter('object_type', $objectType, \PDO::PARAM_STR) - ->setParameter('object_id', $objectId, \PDO::PARAM_STR) + ->setParameter('user_id', $user->getUID(), IQueryBuilder::PARAM_STR) + ->setParameter('object_type', $objectType, IQueryBuilder::PARAM_STR) + ->setParameter('object_id', $objectId, IQueryBuilder::PARAM_STR) ->execute(); if ($affectedRows > 0) { @@ -707,9 +708,9 @@ class Manager implements ICommentsManager { ->where($qb->expr()->eq('user_id', $qb->createParameter('user_id'))) ->andWhere($qb->expr()->eq('object_type', $qb->createParameter('object_type'))) ->andWhere($qb->expr()->eq('object_id', $qb->createParameter('object_id'))) - ->setParameter('user_id', $user->getUID(), \PDO::PARAM_STR) - ->setParameter('object_type', $objectType, \PDO::PARAM_STR) - ->setParameter('object_id', $objectId, \PDO::PARAM_STR) + ->setParameter('user_id', $user->getUID(), IQueryBuilder::PARAM_STR) + ->setParameter('object_type', $objectType, IQueryBuilder::PARAM_STR) + ->setParameter('object_id', $objectId, IQueryBuilder::PARAM_STR) ->execute(); $data = $resultStatement->fetch(); diff --git a/lib/private/db/querybuilder/querybuilder.php b/lib/private/db/querybuilder/querybuilder.php index de803116dc4..76959668476 100644 --- a/lib/private/db/querybuilder/querybuilder.php +++ b/lib/private/db/querybuilder/querybuilder.php @@ -168,7 +168,7 @@ class QueryBuilder implements IQueryBuilder { * * @param string|integer $key The parameter position or name. * @param mixed $value The parameter value. - * @param string|null $type One of the PDO::PARAM_* constants. + * @param string|null $type One of the IQueryBuilder::PARAM_* constants. * * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. */ @@ -988,7 +988,7 @@ class QueryBuilder implements IQueryBuilder { * * @return IParameter the placeholder name used. */ - public function createNamedParameter($value, $type = \PDO::PARAM_STR, $placeHolder = null) { + public function createNamedParameter($value, $type = IQueryBuilder::PARAM_STR, $placeHolder = null) { return new Parameter($this->queryBuilder->createNamedParameter($value, $type, $placeHolder)); } @@ -1005,8 +1005,8 @@ class QueryBuilder implements IQueryBuilder { * $qb = $conn->getQueryBuilder(); * $qb->select('u.*') * ->from('users', 'u') - * ->where('u.username = ' . $qb->createPositionalParameter('Foo', PDO::PARAM_STR)) - * ->orWhere('u.username = ' . $qb->createPositionalParameter('Bar', PDO::PARAM_STR)) + * ->where('u.username = ' . $qb->createPositionalParameter('Foo', IQueryBuilder::PARAM_STR)) + * ->orWhere('u.username = ' . $qb->createPositionalParameter('Bar', IQueryBuilder::PARAM_STR)) * </code> * * @param mixed $value @@ -1014,7 +1014,7 @@ class QueryBuilder implements IQueryBuilder { * * @return IParameter */ - public function createPositionalParameter($value, $type = \PDO::PARAM_STR) { + public function createPositionalParameter($value, $type = IQueryBuilder::PARAM_STR) { return new Parameter($this->queryBuilder->createPositionalParameter($value, $type)); } @@ -1027,7 +1027,7 @@ class QueryBuilder implements IQueryBuilder { * $qb->select('u.*') * ->from('users', 'u') * ->where('u.username = ' . $qb->createParameter('name')) - * ->setParameter('name', 'Bar', PDO::PARAM_STR)) + * ->setParameter('name', 'Bar', IQueryBuilder::PARAM_STR)) * </code> * * @param string $name diff --git a/lib/public/appframework/db/mapper.php b/lib/public/appframework/db/mapper.php index 065a9f01ea1..56808997323 100644 --- a/lib/public/appframework/db/mapper.php +++ b/lib/public/appframework/db/mapper.php @@ -202,7 +202,7 @@ abstract class Mapper { /** * Returns the correct PDO constant based on the value type * @param $value - * @return PDO constant + * @return int PDO constant * @since 8.1.0 */ private function getPDOType($value) { diff --git a/lib/public/db/querybuilder/iquerybuilder.php b/lib/public/db/querybuilder/iquerybuilder.php index 5a020f4f6a2..444910a9c5a 100644 --- a/lib/public/db/querybuilder/iquerybuilder.php +++ b/lib/public/db/querybuilder/iquerybuilder.php @@ -156,7 +156,7 @@ interface IQueryBuilder { * * @param string|integer $key The parameter position or name. * @param mixed $value The parameter value. - * @param string|null $type One of the PDO::PARAM_* constants. + * @param string|null $type One of the IQueryBuilder::PARAM_* constants. * * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. * @since 8.2.0 @@ -780,7 +780,7 @@ interface IQueryBuilder { * @return IParameter * @since 8.2.0 */ - public function createNamedParameter($value, $type = \PDO::PARAM_STR, $placeHolder = null); + public function createNamedParameter($value, $type = self::PARAM_STR, $placeHolder = null); /** * Creates a new positional parameter and bind the given value to it. @@ -795,8 +795,8 @@ interface IQueryBuilder { * $qb = $conn->getQueryBuilder(); * $qb->select('u.*') * ->from('users', 'u') - * ->where('u.username = ' . $qb->createPositionalParameter('Foo', PDO::PARAM_STR)) - * ->orWhere('u.username = ' . $qb->createPositionalParameter('Bar', PDO::PARAM_STR)) + * ->where('u.username = ' . $qb->createPositionalParameter('Foo', IQueryBuilder::PARAM_STR)) + * ->orWhere('u.username = ' . $qb->createPositionalParameter('Bar', IQueryBuilder::PARAM_STR)) * </code> * * @param mixed $value @@ -805,7 +805,7 @@ interface IQueryBuilder { * @return IParameter * @since 8.2.0 */ - public function createPositionalParameter($value, $type = \PDO::PARAM_STR); + public function createPositionalParameter($value, $type = self::PARAM_STR); /** * Creates a new parameter @@ -816,7 +816,7 @@ interface IQueryBuilder { * $qb->select('u.*') * ->from('users', 'u') * ->where('u.username = ' . $qb->createParameter('name')) - * ->setParameter('name', 'Bar', PDO::PARAM_STR)) + * ->setParameter('name', 'Bar', IQueryBuilder::PARAM_STR)) * </code> * * @param string $name diff --git a/lib/public/idbconnection.php b/lib/public/idbconnection.php index c5767e65a82..ebfc95a3d38 100644 --- a/lib/public/idbconnection.php +++ b/lib/public/idbconnection.php @@ -32,6 +32,7 @@ // 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; +use OCP\DB\QueryBuilder\IQueryBuilder; /** * Interface IDBConnection @@ -193,7 +194,7 @@ interface IDBConnection { * @return string The quoted parameter. * @since 8.0.0 */ - public function quote($input, $type = \PDO::PARAM_STR); + public function quote($input, $type = IQueryBuilder::PARAM_STR); /** * Gets the DatabasePlatform instance that provides all the metadata about |