Use DB transaction methods of the DB connection (#57)

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
master
Morris Jobke 2018-03-21 12:21:18 +01:00 committed by Loïc Blot
parent e4dbe91f3e
commit 07b9460666
2 changed files with 4 additions and 4 deletions

View File

@ -59,10 +59,10 @@ class CityMapper extends Mapper {
}
public function create ($userId, $name) {
\OCP\DB::beginTransaction();
$this->db->beginTransaction();
$query = \OCP\DB::prepare('INSERT INTO *PREFIX*weather_city(user_id, name) VALUES (?,?)');
$query->execute(array($userId, $name));
\OCP\DB::commit();
$this->db->commit();
$sql = 'SELECT max(id) as maxid FROM *PREFIX*weather_city WHERE user_id = ? and name = ?';
$query = \OCP\DB::prepare($sql);

View File

@ -37,7 +37,7 @@ class SettingsMapper extends Mapper {
}
public function setSetting ($settingName, $userId, $settingValue) {
\OCP\DB::beginTransaction();
$this->db->beginTransaction();
$query = \OCP\DB::prepare('DELETE FROM *PREFIX*weather_config ' .
'WHERE `user` = ? and `key` = ?');
$query->execute(array($userId, $settingName));
@ -45,7 +45,7 @@ class SettingsMapper extends Mapper {
$query = \OCP\DB::prepare('INSERT INTO *PREFIX*weather_config ' .
'(`user`,`key`,`value`) VALUES (?,?,?)');
$query->execute(array($userId, $settingName, $settingValue));
\OCP\DB::commit();
$this->db->commit();
}
public function getSetting ($userId, $settingName) {