mirror of
https://github.com/dg/dibi.git
synced 2025-07-10 00:56:24 +02:00
fetchSingle returns FALSE
This commit is contained in:
@ -161,7 +161,7 @@ class DataSource implements IDataSource
|
||||
|
||||
/**
|
||||
* Like fetch(), but returns only first field.
|
||||
* @return mixed value on success, null if no next record
|
||||
* @return mixed value on success, false if no next record
|
||||
*/
|
||||
public function fetchSingle()
|
||||
{
|
||||
|
@ -311,7 +311,7 @@ class Fluent implements IDataSource
|
||||
|
||||
/**
|
||||
* Like fetch(), but returns only first field.
|
||||
* @return mixed value on success, null if no next record
|
||||
* @return mixed value on success, false if no next record
|
||||
*/
|
||||
public function fetchSingle()
|
||||
{
|
||||
|
@ -179,13 +179,13 @@ class Result implements IDataSource
|
||||
|
||||
/**
|
||||
* Like fetch(), but returns only first field.
|
||||
* @return mixed value on success, null if no next record
|
||||
* @return mixed value on success, false if no next record
|
||||
*/
|
||||
final public function fetchSingle()
|
||||
{
|
||||
$row = $this->getResultDriver()->fetch(true);
|
||||
if ($row === null) {
|
||||
return null;
|
||||
return false;
|
||||
}
|
||||
$this->fetched = true;
|
||||
$this->normalize($row);
|
||||
|
@ -18,6 +18,9 @@ $conn->loadFile(__DIR__ . "/data/$config[system].sql");
|
||||
// fetch a single value
|
||||
$res = $conn->query('SELECT [title] FROM [products] ORDER BY [product_id]');
|
||||
Assert::same('Chair', $res->fetchSingle());
|
||||
Assert::same('Table', $res->fetchSingle());
|
||||
Assert::same('Computer', $res->fetchSingle());
|
||||
Assert::false($res->fetchSingle());
|
||||
|
||||
|
||||
// fetch complete result set
|
||||
|
Reference in New Issue
Block a user