You are here

function recipe_update in Recipe 6

Same name and namespace in other branches
  1. 5 recipe.module \recipe_update()
  2. 7.2 recipe.module \recipe_update()
  3. 7 recipe.module \recipe_update()

Implementation of hook_update().

As an existing node is being updated in the database, we need to do our own database updates.

File

./recipe.module, line 172
recipe.module - share recipes

Code

function recipe_update($node) {
  db_query("UPDATE {recipe} SET source = '%s', yield = %d, yield_unit = '%s', notes = '%s', instructions = '%s', preptime = %d WHERE nid = %d", $node->source, $node->yield, $node->yield_unit, $node->notes, $node->instructions, $node->preptime, $node->nid);
  if (!db_affected_rows()) {
    recipe_insert($node);
    return;
  }
  recipe_save_ingredients($node);
}