Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
documentation
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
14 Oct 2010 at 21:18 UTC
Updated:
5 Mar 2011 at 01:11 UTC
Jump to comment: Most recent file
Comments
Comment #1
jkopel commentedIt would seem that skipping an item on update simply leaves the field with it's prior value.
In other words in an update "missing items" are unchanged.
Similarly if there is a serial value it should never change on update since the record itself is the same.
Should the documentation really reflect this?
It seems like standard behavior for a database update, but I guess if you are not familiar with the process it might help.
I could see something like:
"On update missing items and serial values remain unchanged."
Comment #2
jhodgdonI think this is a reasonable suggestion, and that the documentation for this function is a bit sketchy anyway, and could be expanded to make it clearer.
Comment #3
jhodgdonI read through the code in drupal_write_record() carefully, and I think this explains what it does.
We should probably fix this in D6 too, since the function behaves *somewhat* the same there. But I don't think it would be a straight port of the patch.
Comment #4
joachim commentedThanks, that's a big improvement!
RTBC :)
Comment #5
jbrown commentedI refactored this function for D7.
@param $record needs to make a distinction between what happens to the record in the database and $record.
It isn't necessary to explain that primary keys aren't being updated to what they are already set to - even if they were, it wouldn't make any difference to the API of this function. It is an extremely micro optimisation.
How about:
... If inserting a new record, values not provided in $record will be populated with the default values from the schema (the database already knows these values), as well as a single serial (auto-increment) field (if present). If updating an existing record, only provided values are updated and $record is not modified.
Comment #6
jhodgdonOK... How's this? Mostly what jbrown wrote...
Comment #7
jhodgdonAnd definitely, the D6 function is a bit different in how it behaves, but the doc is similarly needing some love.
Comment #8
jbrown commentedWorks for me!
Comment #9
gddExtremely nitpicky reroll because one of the lines was over 80 characters. Otherwise looks good.
Comment #10
jbrown commentedYou have uploaded some other patch.
Comment #11
jbrown commented#6: 942006-6.patch queued for re-testing.
Comment #12
jbrown commentedThe patch in #6 is fine - the longest line is exactly 80 chars.
Comment #13
dries commentedCommitted to CVS HEAD. Thanks.