From 60688d68db848a94eddb4d6b3a2f6a58742b8523 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Mon, 18 Feb 2008 16:53:37 +0000 Subject: - Patch #181411 by Moshe: use schema API for saving and updating user records. --- includes/common.inc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'includes/common.inc') diff --git a/includes/common.inc b/includes/common.inc index 3e41439f0..ac68ba3e7 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -3273,12 +3273,24 @@ function drupal_write_record($table, &$object, $update = array()) { if (empty($info['serialize'])) { $values[] = $object->$field; } - else { + elseif (!empty($object->$field)) { $values[] = serialize($object->$field); } + else { + $values[] = ''; + } } } + if (empty($fields)) { + // No changes requested. + // If we began with an array, convert back so we don't surprise the caller. + if ($array) { + $object = (array)$object; + } + return; + } + // Build the SQL. $query = ''; if (!count($update)) { -- cgit v1.2.3