minor bugfix: don't assume that the query results for queryFirstRow() or queryFirstList() will be an array (can also be a bool)
This commit is contained in:
@@ -674,7 +674,7 @@ class MeekroDB {
|
|||||||
public function queryFirstRow() {
|
public function queryFirstRow() {
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$result = call_user_func_array(array($this, 'query'), $args);
|
$result = call_user_func_array(array($this, 'query'), $args);
|
||||||
if (! $result) return null;
|
if (!$result || !is_array($result)) return null;
|
||||||
return reset($result);
|
return reset($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -682,7 +682,7 @@ class MeekroDB {
|
|||||||
public function queryFirstList() {
|
public function queryFirstList() {
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$result = call_user_func_array(array($this, 'queryAllLists'), $args);
|
$result = call_user_func_array(array($this, 'queryAllLists'), $args);
|
||||||
if (! $result) return null;
|
if (!$result || !is_array($result)) return null;
|
||||||
return reset($result);
|
return reset($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -274,7 +274,7 @@ class BasicTest extends SimpleTest {
|
|||||||
DB::insert('storedata', array(
|
DB::insert('storedata', array(
|
||||||
'picture' => $smile,
|
'picture' => $smile,
|
||||||
));
|
));
|
||||||
DB::query("INSERT INTO storedata (picture) VALUES (%s)", $smile);
|
DB::queryOneRow("INSERT INTO storedata (picture) VALUES (%s)", $smile);
|
||||||
|
|
||||||
$getsmile = DB::queryFirstField("SELECT picture FROM storedata WHERE id=1");
|
$getsmile = DB::queryFirstField("SELECT picture FROM storedata WHERE id=1");
|
||||||
$getsmile2 = DB::queryFirstField("SELECT picture FROM storedata WHERE id=2");
|
$getsmile2 = DB::queryFirstField("SELECT picture FROM storedata WHERE id=2");
|
||||||
|
|||||||
Reference in New Issue
Block a user