]> git.mjollnir.org Git - moodle.git/commitdiff
Fix storing onf NULLs by set_field_xxx() into binary columns.
authorstronk7 <stronk7>
Thu, 15 Oct 2009 15:17:21 +0000 (15:17 +0000)
committerstronk7 <stronk7>
Thu, 15 Oct 2009 15:17:21 +0000 (15:17 +0000)
lib/dml/pgsql_native_moodle_database.php

index 67f213cd5be60e0b87102b8666f67cb6632e5df1..323e7da9d377dbf045efe5528744190195c60bbc 100644 (file)
@@ -981,7 +981,7 @@ class pgsql_native_moodle_database extends moodle_database {
         $columns = $this->get_columns($table);
         $column = $columns[$newfield];
 
-        if ($column->meta_type == 'B') { /// If the column is a BLOB
+        if ($column->meta_type == 'B' && $newvalue !== null) { /// If the column is a BLOB and the value is not null
         /// Update BYTEA and return
             $newvalue = pg_escape_bytea($this->pgsql, $newvalue);
             $sql = "UPDATE {$this->prefix}$table SET $newfield = '$newvalue'::bytea $select";