Permalink
Browse files

Added DB::query() that returns a PDOStatement object to fetch items w…

…hile keeping memory usage low
  • Loading branch information...
1 parent 92b14f6 commit bfcd3ca1acd88ea5769652c4ca2fb6f83b1284c1 @jbroadway committed Jun 25, 2012
Showing with 15 additions and 0 deletions.
  1. +15 −0 lib/DB.php
View
15 lib/DB.php
@@ -279,6 +279,21 @@ public static function execute () {
return false;
}
}
+
+ /**
+ * Execute a query and return the PDO statement object
+ * so you can minimize memory usage.
+ */
+ public static function query () {
+ try {
+ list ($stmt, $args) = self::prepare (func_get_args ());
+ $stmt->execute ($args);
+ return $stmt;
+ } catch (Exception $e) {
+ self::$error = $e->getMessage ();
+ return false;
+ }
+ }
/**
* Fetch a single object.

0 comments on commit bfcd3ca

Please sign in to comment.