Merge branch 'master' into noglob
This commit is contained in:
commit
7d35a8f3f0
27 changed files with 430 additions and 288 deletions
|
|
@ -12,7 +12,7 @@ class PDOStatement extends \PDOStatement implements \IteratorAggregate
|
|||
public $cache = array();
|
||||
public $fields;
|
||||
|
||||
function getIterator() {
|
||||
function getIterator(): Iterator {
|
||||
return new StatementIterator($this);
|
||||
}
|
||||
|
||||
|
|
@ -72,6 +72,9 @@ class PDOStatement extends \PDOStatement implements \IteratorAggregate
|
|||
}
|
||||
|
||||
function getInt($name) {
|
||||
if (!$this->fields) {
|
||||
throw new Error('no fields');
|
||||
}
|
||||
return (int)$this->fields[$name];
|
||||
}
|
||||
|
||||
|
|
@ -80,7 +83,7 @@ class PDOStatement extends \PDOStatement implements \IteratorAggregate
|
|||
}
|
||||
|
||||
function getString($name) {
|
||||
return $this->fields[$name];
|
||||
return isset($this->fields[$name]) ? $this->fields[$name]: null;
|
||||
}
|
||||
|
||||
function getBoolean($name) {
|
||||
|
|
@ -98,4 +101,10 @@ class PDOStatement extends \PDOStatement implements \IteratorAggregate
|
|||
function getRecordCount() {
|
||||
return count($this->cache);
|
||||
}
|
||||
|
||||
function execute($args = null) {
|
||||
$result = parent::execute($args);
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,33 +21,27 @@ class Statement
|
|||
$this->conn = $conn;
|
||||
}
|
||||
|
||||
function setInt($n, $value)
|
||||
{
|
||||
function setInt($n, $value) {
|
||||
$this->binds [] = array($n, $value, PDO::PARAM_INT);
|
||||
}
|
||||
|
||||
function setString($n, $value)
|
||||
{
|
||||
function setString($n, $value) {
|
||||
$this->binds [] = array($n, $value, PDO::PARAM_STR);
|
||||
}
|
||||
|
||||
function setBlob($n, $value)
|
||||
{
|
||||
function setBlob($n, $value) {
|
||||
$this->binds [] = array($n, $value, PDO::PARAM_LOB);
|
||||
}
|
||||
|
||||
function setLimit($limit)
|
||||
{
|
||||
function setLimit($limit) {
|
||||
$this->limit = $limit;
|
||||
}
|
||||
|
||||
function setOffset($offset)
|
||||
{
|
||||
function setOffset($offset) {
|
||||
$this->offset = $offset;
|
||||
}
|
||||
|
||||
function executeQuery()
|
||||
{
|
||||
function executeQuery() {
|
||||
if ($this->limit) {
|
||||
$this->query .= " LIMIT {$this->limit} OFFSET {$this->offset}";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue