mirror of
https://gitlab.com/hashborgir/d2tools.git
synced 2025-10-14 00:44:23 -05:00
Begin Refactor
This commit is contained in:
48
vendor/gabordemooij/redbean/RedBeanPHP/Cursor/NullCursor.php
vendored
Normal file
48
vendor/gabordemooij/redbean/RedBeanPHP/Cursor/NullCursor.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace RedBeanPHP\Cursor;
|
||||
|
||||
use RedBeanPHP\Cursor as Cursor;
|
||||
|
||||
/**
|
||||
* NULL Database Cursor
|
||||
* Implementation of the NULL Cursor.
|
||||
* Used for an empty BeanCollection. This Cursor
|
||||
* can be used for instance if a query fails but the interface
|
||||
* demands a cursor to be returned.
|
||||
*
|
||||
* @file RedBeanPHP/Cursor/NULLCursor.php
|
||||
* @author Gabor de Mooij and the RedBeanPHP Community
|
||||
* @license BSD/GPLv2
|
||||
*
|
||||
* @copyright
|
||||
* (c) G.J.G.T. (Gabor) de Mooij and the RedBeanPHP Community.
|
||||
* This source file is subject to the BSD/GPLv2 License that is bundled
|
||||
* with this source code in the file license.txt.
|
||||
*/
|
||||
class NullCursor implements Cursor
|
||||
{
|
||||
/**
|
||||
* @see Cursor::getNextItem
|
||||
*/
|
||||
public function getNextItem()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Cursor::reset
|
||||
*/
|
||||
public function reset()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Cursor::close
|
||||
*/
|
||||
public function close()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
74
vendor/gabordemooij/redbean/RedBeanPHP/Cursor/PDOCursor.php
vendored
Normal file
74
vendor/gabordemooij/redbean/RedBeanPHP/Cursor/PDOCursor.php
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace RedBeanPHP\Cursor;
|
||||
|
||||
use RedBeanPHP\Cursor as Cursor;
|
||||
|
||||
/**
|
||||
* PDO Database Cursor
|
||||
* Implementation of PDO Database Cursor.
|
||||
* Used by the BeanCollection to fetch one bean at a time.
|
||||
* The PDO Cursor is used by Query Writers to support retrieval
|
||||
* of large bean collections. For instance, this class is used to
|
||||
* implement the findCollection()/BeanCollection functionality.
|
||||
*
|
||||
* @file RedBeanPHP/Cursor/PDOCursor.php
|
||||
* @author Gabor de Mooij and the RedBeanPHP Community
|
||||
* @license BSD/GPLv2
|
||||
*
|
||||
* @copyright
|
||||
* (c) G.J.G.T. (Gabor) de Mooij and the RedBeanPHP Community.
|
||||
* This source file is subject to the BSD/GPLv2 License that is bundled
|
||||
* with this source code in the file license.txt.
|
||||
*/
|
||||
class PDOCursor implements Cursor
|
||||
{
|
||||
/**
|
||||
* @var PDOStatement
|
||||
*/
|
||||
protected $res;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $fetchStyle;
|
||||
|
||||
/**
|
||||
* Constructor, creates a new instance of a PDO Database Cursor.
|
||||
*
|
||||
* @param PDOStatement $res the PDO statement
|
||||
* @param string $fetchStyle fetch style constant to use
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( \PDOStatement $res, $fetchStyle )
|
||||
{
|
||||
$this->res = $res;
|
||||
$this->fetchStyle = $fetchStyle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Cursor::getNextItem
|
||||
*/
|
||||
public function getNextItem()
|
||||
{
|
||||
return $this->res->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Cursor::reset
|
||||
*/
|
||||
public function reset()
|
||||
{
|
||||
$this->close();
|
||||
$this->res->execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Cursor::close
|
||||
*/
|
||||
public function close()
|
||||
{
|
||||
$this->res->closeCursor();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user