aboutsummaryrefslogtreecommitdiff
path: root/app/Models/CategoryDAO.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2019-10-06 00:14:19 +0200
committerGravatar GitHub <noreply@github.com> 2019-10-06 00:14:19 +0200
commitbe4c942cb3bd2b41dc2e01eb437dfd4f2f73ab4a (patch)
tree164475741f79c2057db1c956dcf77e720835654a /app/Models/CategoryDAO.php
parent1b15e22897c9190a75be33698764d625a7813cb2 (diff)
SQL allow recreating existing user (#2555)
* SQL allow recreating existing user Taking advantage of https://github.com/FreshRSS/FreshRSS/pull/2554 In a case when FreshRSS data is lost, but database data still intact (in particular MySQL or PostgreSQL), this patch allows recreating previous users without error * Better error retrieval Especially when error occur during the prepare statement
Diffstat (limited to 'app/Models/CategoryDAO.php')
-rw-r--r--app/Models/CategoryDAO.php8
1 files changed, 4 insertions, 4 deletions
diff --git a/app/Models/CategoryDAO.php b/app/Models/CategoryDAO.php
index 2bae5ef83..dd49b542d 100644
--- a/app/Models/CategoryDAO.php
+++ b/app/Models/CategoryDAO.php
@@ -19,7 +19,7 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo implements FreshRSS_Searchable
if ($stm && $stm->execute($values)) {
return $this->pdo->lastInsertId('`_category_id_seq`');
} else {
- $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo();
+ $info = $stm == null ? $this->pdo->errorInfo() : $stm->errorInfo();
Minz_Log::error('SQL error addCategory: ' . $info[2]);
return false;
}
@@ -53,7 +53,7 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo implements FreshRSS_Searchable
if ($stm && $stm->execute($values)) {
return $stm->rowCount();
} else {
- $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo();
+ $info = $stm == null ? $this->pdo->errorInfo() : $stm->errorInfo();
Minz_Log::error('SQL error updateCategory: ' . $info[2]);
return false;
}
@@ -69,7 +69,7 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo implements FreshRSS_Searchable
if ($stm && $stm->execute()) {
return $stm->rowCount();
} else {
- $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo();
+ $info = $stm == null ? $this->pdo->errorInfo() : $stm->errorInfo();
Minz_Log::error('SQL error deleteCategory: ' . $info[2]);
return false;
}
@@ -174,7 +174,7 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo implements FreshRSS_Searchable
if ($stm && $stm->execute($values)) {
return $this->pdo->lastInsertId('`_category_id_seq`');
} else {
- $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo();
+ $info = $stm == null ? $this->pdo->errorInfo() : $stm->errorInfo();
Minz_Log::error('SQL error check default category: ' . json_encode($info));
return false;
}