From 2e46b434da4b37a5a70e62e8fd5b502b119c27e1 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 1 Dec 2017 16:56:15 +0300 Subject: [PATCH] pdo: set warnings --- classes/article.php | 4 ++-- classes/db.php | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/classes/article.php b/classes/article.php index 8fb863ef..8f59e2b8 100644 --- a/classes/article.php +++ b/classes/article.php @@ -274,7 +274,7 @@ class Article extends Handler_Protected { $tags_str = db_escape_string($_REQUEST["tags_str"]); $tags = array_unique(trim_array(explode(",", $tags_str))); - db_query("BEGIN"); + $this->pdo->beginTransaction(); $result = db_query("SELECT int_id FROM ttrss_user_entries WHERE ref_id = '$id' AND owner_uid = '".$_SESSION["uid"]."' LIMIT 1"); @@ -319,7 +319,7 @@ class Article extends Handler_Protected { AND owner_uid = " . $_SESSION["uid"]); } - db_query("COMMIT"); + $this->pdo->commit(); $tags = Article::get_article_tags($id); $tags_str = $this->format_tags_string($tags, $id); diff --git a/classes/db.php b/classes/db.php index 0ef3e3f4..94dec766 100644 --- a/classes/db.php +++ b/classes/db.php @@ -31,6 +31,8 @@ class Db implements IDb { DB_USER, DB_PASS); + $this->pdo->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING ); + if (!$this->pdo) { print("Error connecting via PDO."); exit(101);