summaryrefslogtreecommitdiff
path: root/classes/db/stmt.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2013-04-18 08:20:45 +0400
committerAndrew Dolgov <[email protected]>2013-04-18 08:20:45 +0400
commit9ee90455b85350e9f9cd04faf36bad8742141cd9 (patch)
tree50f6f9ea66b40cf8bade86e0b3bdcb77e0ae6978 /classes/db/stmt.php
parent7329ab2dd571f79c69134c6a50d505b18546e103 (diff)
add experimental support for PDO (_ENABLE_PDO)
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();
+ }
+}
+?>