summaryrefslogtreecommitdiff
path: root/classes/db/stmt.php
diff options
context:
space:
mode:
Diffstat (limited to 'classes/db/stmt.php')
-rw-r--r--classes/db/stmt.php32
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();
+ }
+}
+?>