aboutsummaryrefslogtreecommitdiff
path: root/app/Models/FeedDAO.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2014-07-03 21:26:30 +0200
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2014-07-03 21:26:30 +0200
commitd6f414108667f32fe2b480adeb7ec9c218db2f4a (patch)
treec2d9ff851776ebcd49242b2fb15456cc13be089e /app/Models/FeedDAO.php
parent8a5050289ef695dc4d388eecee692ad9d83e00ce (diff)
Preparation for SQLite
https://github.com/marienfressinaud/FreshRSS/issues/100
Diffstat (limited to 'app/Models/FeedDAO.php')
-rw-r--r--app/Models/FeedDAO.php46
1 files changed, 23 insertions, 23 deletions
diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.php
index 6cb49a5be..3f3847aa4 100644
--- a/app/Models/FeedDAO.php
+++ b/app/Models/FeedDAO.php
@@ -18,8 +18,8 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo {
if ($stm && $stm->execute ($values)) {
return $this->bd->lastInsertId();
} else {
- $info = $stm->errorInfo();
- Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
+ $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo();
+ Minz_Log::record('SQL error addFeed: ' . $info[2], Minz_Log::ERROR);
return false;
}
}
@@ -76,8 +76,8 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo {
if ($stm && $stm->execute ($values)) {
return $stm->rowCount();
} else {
- $info = $stm->errorInfo();
- Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
+ $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo();
+ Minz_Log::record('SQL error updateFeed: ' . $info[2], Minz_Log::ERROR);
return false;
}
}
@@ -106,8 +106,8 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo {
if ($stm && $stm->execute ($values)) {
return $stm->rowCount();
} else {
- $info = $stm->errorInfo();
- Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
+ $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo();
+ Minz_Log::record('SQL error updateLastUpdate: ' . $info[2], Minz_Log::ERROR);
return false;
}
}
@@ -130,8 +130,8 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo {
if ($stm && $stm->execute ($values)) {
return $stm->rowCount();
} else {
- $info = $stm->errorInfo();
- Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
+ $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo();
+ Minz_Log::record('SQL error changeCategory: ' . $info[2], Minz_Log::ERROR);
return false;
}
}
@@ -155,8 +155,8 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo {
if ($stm && $stm->execute ($values)) {
return $stm->rowCount();
} else {
- $info = $stm->errorInfo();
- Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
+ $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo();
+ Minz_Log::record('SQL error deleteFeed: ' . $info[2], Minz_Log::ERROR);
return false;
}
}
@@ -181,8 +181,8 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo {
if ($stm && $stm->execute ($values)) {
return $stm->rowCount();
} else {
- $info = $stm->errorInfo();
- Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
+ $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo();
+ Minz_Log::record('SQL error deleteFeedByCategory: ' . $info[2], Minz_Log::ERROR);
return false;
}
}
@@ -301,8 +301,8 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo {
if ($stm && $stm->execute()) {
return $stm->rowCount();
} else {
- $info = $stm->errorInfo();
- Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
+ $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo();
+ Minz_Log::record('SQL error updateCachedValues: ' . $info[2], Minz_Log::ERROR);
return false;
}
}
@@ -313,11 +313,11 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo {
$values = array($id);
$this->bd->beginTransaction ();
if (!($stm && $stm->execute ($values))) {
- $info = $stm->errorInfo();
- Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
- $this->bd->rollBack ();
- return false;
- }
+ $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo();
+ Minz_Log::record('SQL error truncate: ' . $info[2], Minz_Log::ERROR);
+ $this->bd->rollBack ();
+ return false;
+ }
$affected = $stm->rowCount();
$sql = 'UPDATE `' . $this->prefix . 'feed` f '
@@ -325,8 +325,8 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo {
$values = array ($id);
$stm = $this->bd->prepare ($sql);
if (!($stm && $stm->execute ($values))) {
- $info = $stm->errorInfo();
- Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
+ $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo();
+ Minz_Log::record('SQL error truncate: ' . $info[2], Minz_Log::ERROR);
$this->bd->rollBack ();
return false;
}
@@ -350,8 +350,8 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo {
if ($stm && $stm->execute ()) {
return $stm->rowCount();
} else {
- $info = $stm->errorInfo();
- Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR);
+ $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo();
+ Minz_Log::record('SQL error cleanOldEntries: ' . $info[2], Minz_Log::ERROR);
return false;
}
}