3 namespace RedBeanPHP\Cursor;
5 use RedBeanPHP\Cursor as Cursor;
9 * Implementation of PDO Database Cursor.
10 * Used by the BeanCollection to fetch one bean at a time.
11 * The PDO Cursor is used by Query Writers to support retrieval
12 * of large bean collections. For instance, this class is used to
13 * implement the findCollection()/BeanCollection functionality.
15 * @file RedBeanPHP/Cursor/PDOCursor.php
16 * @author Gabor de Mooij and the RedBeanPHP Community
20 * (c) G.J.G.T. (Gabor) de Mooij and the RedBeanPHP Community.
21 * This source file is subject to the BSD/GPLv2 License that is bundled
22 * with this source code in the file license.txt.
24 class PDOCursor implements Cursor
34 protected $fetchStyle;
37 * Constructor, creates a new instance of a PDO Database Cursor.
39 * @param PDOStatement $res the PDO statement
40 * @param string $fetchStyle fetch style constant to use
44 public function __construct( \PDOStatement $res, $fetchStyle )
47 $this->fetchStyle = $fetchStyle;
51 * @see Cursor::getNextItem
53 public function getNextItem()
55 return $this->res->fetch();
61 public function close()
63 $this->res->closeCursor();