db/upgrade.php: Use more recordsets to handle large amounts of equella r...

Please merge to fix:

-->mod_equella
PHP Notice: Undefined index: uuid in /var/www/moodle/mod/equella/db/upgrade.php on line 118

Notice: Undefined index: uuid in /var/www/moodle/mod/equella/db/upgrade.php on line 118
PHP Notice: Undefined index: version in /var/www/moodle/mod/equella/db/upgrade.php on line 121

Notice: Undefined index: version in /var/www/moodle/mod/equella/db/upgrade.php on line 121
PHP Notice: Undefined index: path in /var/www/moodle/mod/equella/db/upgrade.php on line 124

Notice: Undefined index: path in /var/www/moodle/mod/equella/db/upgrade.php on line 124
PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 75 
bytes) in /var/www/moodle/lib/dml/pgsql_native_moodle_database.php on line 1001

Version (equella | 2012082806) and stuck in upgrade loop.