From fdd06ba1f81d07e4597beb0b5b17f44c296b5921 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Wed, 9 Dec 2015 16:33:34 +0100 Subject: [PATCH] use getLastInsertId from query builder for convenience --- lib/private/comments/manager.php | 2 +- tests/lib/comments/manager.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/private/comments/manager.php b/lib/private/comments/manager.php index 05f981f244..09e59f2837 100644 --- a/lib/private/comments/manager.php +++ b/lib/private/comments/manager.php @@ -455,7 +455,7 @@ class Manager implements ICommentsManager { ->execute(); if ($affectedRows > 0) { - $comment->setId(strval($this->dbConn->lastInsertId('*PREFIX*comments'))); + $comment->setId(strval($qb->getLastInsertId())); } return $affectedRows > 0; diff --git a/tests/lib/comments/manager.php b/tests/lib/comments/manager.php index d5c415c250..c8d65c951e 100644 --- a/tests/lib/comments/manager.php +++ b/tests/lib/comments/manager.php @@ -46,7 +46,7 @@ class Test_Comments_Manager extends TestCase ]) ->execute(); - return \OC::$server->getDatabaseConnection()->lastInsertId('*PREFIX*comments'); + return $qb->getLastInsertId(); } protected function getManager() { @@ -90,7 +90,7 @@ class Test_Comments_Manager extends TestCase ]) ->execute(); - $id = strval(\OC::$server->getDatabaseConnection()->lastInsertId('*PREFIX*comments')); + $id = strval($qb->getLastInsertId()); $comment = $manager->get($id); $this->assertTrue($comment instanceof \OCP\Comments\IComment);