Альтернативный белый список

This commit is contained in:
Origami11 2020-11-02 18:00:14 +03:00
parent 86a180123b
commit 82c129305e
19 changed files with 82 additions and 131 deletions

View file

@ -1,7 +1,5 @@
<?php
require_once __DIR__ .'/../Tools/String.php';
class Database_PDOStatement extends PDOStatement implements IteratorAggregate
{
protected $cursorPos = 0;
@ -76,7 +74,7 @@ class Database_PDOStatement extends PDOStatement implements IteratorAggregate
}
function getString($name) {
return $this->fields[$name];
return isset($this->fields[$name]) ? $this->fields[$name]: null;
}
function getBoolean($name) {
@ -88,10 +86,16 @@ class Database_PDOStatement extends PDOStatement implements IteratorAggregate
}
function getArray($name) {
return strToArray($this->fields[$name]);
return Tools_String::strToArray($this->fields[$name]);
}
function getRecordCount() {
return count($this->cache);
}
function execute($args = null) {
$result = parent::execute($args);
return $result;
}
}

View file

@ -17,33 +17,27 @@ class Database_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}";
}