Merge pull request #19311 from atm-john/12.0_fix_missing_return_status_for_getrow
FIX : missing return status
This commit is contained in:
commit
23749b57ec
@ -308,16 +308,20 @@ abstract class DoliDB implements Database
|
|||||||
* Note : This method executes a given SQL query and retrieves the first row of results as an object. It should only be used with SELECT queries
|
* Note : This method executes a given SQL query and retrieves the first row of results as an object. It should only be used with SELECT queries
|
||||||
* Dont add LIMIT to your query, it will be added by this method
|
* Dont add LIMIT to your query, it will be added by this method
|
||||||
* @param string $sql the sql query string
|
* @param string $sql the sql query string
|
||||||
* @return bool| object
|
* @return bool|int|object false on failure, 0 on empty, object on success
|
||||||
*/
|
*/
|
||||||
public function getRow($sql)
|
public function getRow($sql)
|
||||||
{
|
{
|
||||||
$sql .= ' LIMIT 1;';
|
$sql .= ' LIMIT 1';
|
||||||
|
|
||||||
$res = $this->query($sql);
|
$res = $this->query($sql);
|
||||||
if ($res)
|
if ($res) {
|
||||||
{
|
$obj = $this->fetch_object($res);
|
||||||
return $this->fetch_object($res);
|
if ($obj) {
|
||||||
|
return $obj;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user