OK, so I read about drupal_write_record
, which apparently serves as a function which does an insert_or_update.
However from what I've read, it doesn't know by itself whether to do the insert or the update, but this is determined by the existence (or not) of the 3rd parameter: $primary_keys
which defaults to array()
. Is this true? Do I have to select the record first, see if exists, and then pass or not the 3rd param to drupal_write_record
?
I'm asking this, because how I normally do an insert or update function is to do a select based on the primary key(s), and if the row exists, then I have to do an update, if not, an insert. Is this not the way that drupal_write_record
works?
Using Drupal 7.0 by the way.