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

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@106938 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Andreas Piening 2010-06-23 02:11:11 +00:00 committed by Sam Minnee
parent 34ec202c0d
commit b5ad10bff1

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