MINOR: mysql_fetch_row() expects resource, this will fatal if query was e.g. UPDATE when iterating a result because MySQLQuery::nextRecord() is used by Iterator::valid() and MySQLQuery:: is bool in this case (from r106938)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112543 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-10-15 03:07:22 +00:00
parent f7e61e0d11
commit a0424ccd3e

View File

@ -1082,7 +1082,7 @@ class MySQLQuery extends SS_Query {
public function nextRecord() {
// Coalesce rather than replace common fields.
if($data = mysql_fetch_row($this->handle)) {
if(is_resource($this->handle) && $data = mysql_fetch_row($this->handle)) {
foreach($data as $columnIdx => $value) {
$columnName = mysql_field_name($this->handle, $columnIdx);
// $value || !$ouput[$columnName] means that the *last* occurring value is shown