mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 03:40:37 +02:00
code cleanup
This commit is contained in:
@@ -495,13 +495,24 @@ class e_db_pdo implements e_db
|
|||||||
// fetch mode
|
// fetch mode
|
||||||
if(empty($table))
|
if(empty($table))
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if(!$multi)
|
||||||
|
{
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
|
||||||
$ret = array();
|
$ret = array();
|
||||||
if(!$multi) return $this->fetch();
|
|
||||||
|
|
||||||
while($row = $this->fetch())
|
while($row = $this->fetch())
|
||||||
{
|
{
|
||||||
if(null !== $indexField) $ret[$row[$indexField]] = $row;
|
if(null !== $indexField)
|
||||||
else $ret[] = $row;
|
{
|
||||||
|
$ret[$row[$indexField]] = $row;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$ret[] = $row;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
@@ -511,14 +522,22 @@ class e_db_pdo implements e_db
|
|||||||
if($table && !$where && is_bool($fields))
|
if($table && !$where && is_bool($fields))
|
||||||
{
|
{
|
||||||
// table is the query, fields used for multi
|
// table is the query, fields used for multi
|
||||||
if($fields) $mode = 'multi';
|
if($fields)
|
||||||
else $mode = 'single';
|
{
|
||||||
|
$mode = 'multi';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$mode = 'single';
|
||||||
|
}
|
||||||
|
|
||||||
$fields = null;
|
$fields = null;
|
||||||
}
|
}
|
||||||
elseif($fields && '*' !== $fields && strpos($fields, ',') === false && $where)
|
elseif($fields && '*' !== $fields && strpos($fields, ',') === false && $where)
|
||||||
{
|
{
|
||||||
$mode = 'single';
|
$mode = 'single';
|
||||||
}
|
}
|
||||||
|
|
||||||
if($multi)
|
if($multi)
|
||||||
{
|
{
|
||||||
$mode = 'multi';
|
$mode = 'multi';
|
||||||
@@ -1492,7 +1511,7 @@ class e_db_pdo implements e_db
|
|||||||
elseif ($this->mySQLresult === TRUE)
|
elseif ($this->mySQLresult === TRUE)
|
||||||
{ // Successful query which may return a row count (because it operated on a number of rows without returning a result set)
|
{ // Successful query which may return a row count (because it operated on a number of rows without returning a result set)
|
||||||
if(preg_match('#^(DELETE|INSERT|REPLACE|UPDATE)#',$query, $matches))
|
if(preg_match('#^(DELETE|INSERT|REPLACE|UPDATE)#',$query, $matches))
|
||||||
{ // Need to check mysql_affected_rows() - to return number of rows actually updated
|
{
|
||||||
/** @var PDOStatement $resource */
|
/** @var PDOStatement $resource */
|
||||||
$resource = $this->mySQLresult;
|
$resource = $this->mySQLresult;
|
||||||
$tmp = $resource->rowCount();
|
$tmp = $resource->rowCount();
|
||||||
|
Reference in New Issue
Block a user