pdo: set warnings

This commit is contained in:
Andrew Dolgov 2017-12-01 16:56:15 +03:00
parent c39ee27235
commit 2e46b434da
2 changed files with 4 additions and 2 deletions

View File

@ -274,7 +274,7 @@ class Article extends Handler_Protected {
$tags_str = db_escape_string($_REQUEST["tags_str"]); $tags_str = db_escape_string($_REQUEST["tags_str"]);
$tags = array_unique(trim_array(explode(",", $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 $result = db_query("SELECT int_id FROM ttrss_user_entries WHERE
ref_id = '$id' AND owner_uid = '".$_SESSION["uid"]."' LIMIT 1"); ref_id = '$id' AND owner_uid = '".$_SESSION["uid"]."' LIMIT 1");
@ -319,7 +319,7 @@ class Article extends Handler_Protected {
AND owner_uid = " . $_SESSION["uid"]); AND owner_uid = " . $_SESSION["uid"]);
} }
db_query("COMMIT"); $this->pdo->commit();
$tags = Article::get_article_tags($id); $tags = Article::get_article_tags($id);
$tags_str = $this->format_tags_string($tags, $id); $tags_str = $this->format_tags_string($tags, $id);

View File

@ -31,6 +31,8 @@ class Db implements IDb {
DB_USER, DB_USER,
DB_PASS); DB_PASS);
$this->pdo->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING );
if (!$this->pdo) { if (!$this->pdo) {
print("Error connecting via PDO."); print("Error connecting via PDO.");
exit(101); exit(101);