Version 4.5.0
This commit is contained in:
1 parent
1a0c7fd3c2
commit
f79dcf067a
3791 files changed
+248032
-76372
No files matched your search
@@ -84,7 +84,7 @@ class Select implements \Iterator, \Countable
|
||||
break;
|
||||
}
|
||||
|
||||
if ( is_array( $table ) )
|
||||
if ( \is_array( $table ) )
|
||||
{
|
||||
$query .= " `{$this->db->prefix}{$table[0]}` AS `{$table[1]}`";
|
||||
}
|
||||
@@ -147,7 +147,7 @@ class Select implements \Iterator, \Countable
|
||||
$this->rewind();
|
||||
}
|
||||
|
||||
if ( !in_array( $column, $this->columns ) )
|
||||
if ( !\in_array( $column, $this->columns ) )
|
||||
{
|
||||
throw new \InvalidArgumentException;
|
||||
}
|
||||
@@ -170,7 +170,7 @@ class Select implements \Iterator, \Countable
|
||||
$this->rewind();
|
||||
}
|
||||
|
||||
if ( !in_array( $column, $this->columns ) )
|
||||
if ( !\in_array( $column, $this->columns ) )
|
||||
{
|
||||
throw new \InvalidArgumentException;
|
||||
}
|
||||
@@ -225,7 +225,7 @@ class Select implements \Iterator, \Countable
|
||||
$params[] = &$this->row[ $field->name ];
|
||||
}
|
||||
$this->columns = array_keys( $this->row );
|
||||
call_user_func_array( array( $this->stmt, 'bind_result' ), $params );
|
||||
$this->stmt->bind_result( ...$params );
|
||||
|
||||
/* Get the first result */
|
||||
$this->key = -1;
|
||||
@@ -243,7 +243,7 @@ class Select implements \Iterator, \Countable
|
||||
{
|
||||
return $this->row[ $this->valueField ];
|
||||
}
|
||||
elseif ( count( $this->row ) === 1 )
|
||||
elseif ( \count( $this->row ) === 1 )
|
||||
{
|
||||
foreach ( $this->row as $v )
|
||||
{
|
||||
@@ -305,24 +305,15 @@ class Select implements \Iterator, \Countable
|
||||
/**
|
||||
* [Countable] Get number of rows
|
||||
*
|
||||
* @param bool $allRows If TRUE, will get the number of rows ignoring the limit. In order for this to work, the query must have been ran with SQL_CALC_FOUND_ROWS
|
||||
* @return int
|
||||
*/
|
||||
public function count( $allRows = FALSE )
|
||||
public function count()
|
||||
{
|
||||
if ( !$this->stmt )
|
||||
{
|
||||
$this->rewind();
|
||||
}
|
||||
|
||||
if ( $allRows )
|
||||
{
|
||||
$result = $this->db->query( 'SELECT FOUND_ROWS() AS count;' )->fetch_assoc();
|
||||
return $result['count'];
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->stmt->num_rows;
|
||||
}
|
||||
return $this->stmt->num_rows;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user