Use namedparameter

This commit is contained in:
Roeland Jago Douma 2016-01-11 15:58:32 +01:00
parent 4d037b76b4
commit 0f454ff5aa
2 changed files with 3 additions and 9 deletions

View File

@ -185,8 +185,7 @@ class DefaultShareProvider implements IShareProvider {
$qb = $this->dbConn->getQueryBuilder(); $qb = $this->dbConn->getQueryBuilder();
$qb->select('*') $qb->select('*')
->from('share') ->from('share')
->where($qb->expr()->eq('parent', $qb->createParameter('parent'))) ->where($qb->expr()->eq('parent', $qb->createNamedParameter($parent->getId())))
->setParameter(':parent', $parent->getId())
->orderBy('id'); ->orderBy('id');
$cursor = $qb->execute(); $cursor = $qb->execute();
@ -210,8 +209,7 @@ class DefaultShareProvider implements IShareProvider {
$qb = $this->dbConn->getQueryBuilder(); $qb = $this->dbConn->getQueryBuilder();
$qb->delete('share') $qb->delete('share')
->where($qb->expr()->eq('id', $qb->createParameter('id'))) ->where($qb->expr()->eq('id', $qb->createNamedParameter($share->getId())));
->setParameter(':id', $share->getId());
try { try {
$qb->execute(); $qb->execute();
@ -244,8 +242,7 @@ class DefaultShareProvider implements IShareProvider {
$qb->select('*') $qb->select('*')
->from('share') ->from('share')
->where($qb->expr()->eq('id', $qb->createParameter('id'))) ->where($qb->expr()->eq('id', $qb->createNamedParameter($id)));
->setParameter(':id', $id);
$cursor = $qb->execute(); $cursor = $qb->execute();
$data = $cursor->fetch(); $data = $cursor->fetch();

View File

@ -374,9 +374,6 @@ class DefaultShareProviderTest extends \Test\TestCase {
$qb->expects($this->once()) $qb->expects($this->once())
->method('where') ->method('where')
->will($this->returnSelf()); ->will($this->returnSelf());
$qb->expects($this->once())
->method('setParameter')
->will($this->returnSelf());
$qb->expects($this->once()) $qb->expects($this->once())
->method('execute') ->method('execute')
->will($this->throwException(new \Exception)); ->will($this->throwException(new \Exception));