summaryrefslogtreecommitdiff
path: root/includes/common.inc
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2008-02-18 16:53:37 +0000
committerDries Buytaert <dries@buytaert.net>2008-02-18 16:53:37 +0000
commit60688d68db848a94eddb4d6b3a2f6a58742b8523 (patch)
tree307b29410314cf1b10f1db88a07a25dede64f43b /includes/common.inc
parent029b6b914fdef60b060e3e7db5cbaa6f303ad78e (diff)
downloadbrdo-60688d68db848a94eddb4d6b3a2f6a58742b8523.tar.gz
brdo-60688d68db848a94eddb4d6b3a2f6a58742b8523.tar.bz2
- Patch #181411 by Moshe: use schema API for saving and updating user records.
Diffstat (limited to 'includes/common.inc')
-rw-r--r--includes/common.inc14
1 files changed, 13 insertions, 1 deletions
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)) {