]> git.mjollnir.org Git - moodle.git/commitdiff
Fix retrieving of NULLs in PG databases and binary fields
authorstronk7 <stronk7>
Wed, 14 Oct 2009 10:32:48 +0000 (10:32 +0000)
committerstronk7 <stronk7>
Wed, 14 Oct 2009 10:32:48 +0000 (10:32 +0000)
lib/dml/pgsql_native_moodle_database.php
lib/dml/pgsql_native_moodle_recordset.php

index 98becbc6289024e585997a6bc740fe9d149a379e..67f213cd5be60e0b87102b8666f67cb6632e5df1 100644 (file)
@@ -653,7 +653,7 @@ class pgsql_native_moodle_database extends moodle_database {
                 $id = reset($row);
                 if ($blobs) {
                     foreach ($blobs as $blob) {
-                        $row[$blob] = pg_unescape_bytea($row[$blob]);
+                        $row[$blob] = $row[$blob] !== null ? pg_unescape_bytea($row[$blob]) : null;
                     }
                 }
                 if (isset($return[$id])) {
index 525a48c916a9788c77f5b2d4605d24ca24780806..41093740e0c89e5eb1aa796e52d4d33bb2579508 100644 (file)
@@ -62,7 +62,7 @@ class pgsql_native_moodle_recordset extends moodle_recordset {
 
         if ($this->blobs) {
             foreach ($this->blobs as $blob) {
-                $row[$blob] = pg_unescape_bytea($row[$blob]);
+                $row[$blob] = $row[$blob] !== null ? pg_unescape_bytea($row[$blob]) : null;
             }
         }