From: Andrew Dolgov Date: Fri, 1 Dec 2017 13:56:15 +0000 (+0300) Subject: pdo: set warnings X-Git-Tag: 17.12~91 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=2e46b434da4b37a5a70e62e8fd5b502b119c27e1;p=tt-rss.git pdo: set warnings --- 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);