1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2026-02-09 05:31:34 +00:00

Merge branch 'pdo-experimental' of git.fakecake.org:tt-rss into pdo-experimental

This commit is contained in:
Andrew Dolgov
2017-12-01 10:17:36 +03:00
3 changed files with 119 additions and 165 deletions

View File

@@ -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'");
}

View File

@@ -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();
}
}