diff options
author | Andrew Dolgov <[email protected]> | 2013-05-07 15:36:14 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2013-05-07 15:36:14 +0400 |
commit | 82076ce53113be9cc053f8740356e7e1b81e5643 (patch) | |
tree | 5eba36805f593ec7dd0aad671b5bcca0ae01cf53 /classes/db/stmt.php | |
parent | 66af65f14b4f3c670bb3f9ca7b1c80081f9281d1 (diff) | |
parent | 23923fb29b345c1eea5b70a6df4d30395425bf37 (diff) |
Merge branch 'master' into css-feedtree-counter
Conflicts:
tt-rss.css
Diffstat (limited to 'classes/db/stmt.php')
-rw-r--r-- | classes/db/stmt.php | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/classes/db/stmt.php b/classes/db/stmt.php new file mode 100644 index 000000000..4d3596ef1 --- /dev/null +++ b/classes/db/stmt.php @@ -0,0 +1,32 @@ +<?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(); + } +} +?> |