summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2017-12-01 10:17:36 +0300
committerAndrew Dolgov <[email protected]>2017-12-01 10:17:36 +0300
commitbfc54b036901f3312d622cfdc40833deac6069fb (patch)
tree369c1bcb5a54d08fc30d953f406e226a1174d389 /classes
parentd9e60c0f68931c2e6ff8cdf3a941be2504bca16f (diff)
parent8adb3ec472d972b71336b738ac315320d1904e71 (diff)
Merge branch 'pdo-experimental' of git.fakecake.org:tt-rss into pdo-experimental
Diffstat (limited to 'classes')
-rw-r--r--classes/db.php7
-rw-r--r--classes/db/stmt.php31
2 files changed, 7 insertions, 31 deletions
diff --git a/classes/db.php b/classes/db.php
index 224492502..0ef3e3f43 100644
--- a/classes/db.php
+++ b/classes/db.php
@@ -57,6 +57,13 @@ class Db implements IDb {
return self::$instance;
}
+ public static function pdo() {
+ if (self::$instance == null)
+ self::$instance = new self();
+
+ return self::$instance->pdo;
+ }
+
static function quote($str){
return("'$str'");
}
diff --git a/classes/db/stmt.php b/classes/db/stmt.php
deleted file mode 100644
index 7d6bbb30a..000000000
--- a/classes/db/stmt.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-class Db_Stmt {
- private $stmt;
- private $cache;
-
- function __construct($stmt) {
- $this->stmt = $stmt;
- $this->cache = false;
- }
-
- function fetch_result($row, $param) {
- if (!$this->cache) {
- $this->cache = $this->stmt->fetchAll();
- }
-
- if (isset($this->cache[$row])) {
- return $this->cache[$row][$param];
- } else {
- user_error("Unable to jump to row $row", E_USER_WARNING);
- return false;
- }
- }
-
- function rowCount() {
- return $this->stmt->rowCount();
- }
-
- function fetch() {
- return $this->stmt->fetch();
- }
-} \ No newline at end of file