? fix_prefixing.patch
? fix_prefixing_2.patch
Index: object_driver.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/object_driver/object_driver.module,v
retrieving revision 1.9
diff -u -p -r1.9 object_driver.module
--- object_driver.module	8 Apr 2007 16:45:03 -0000	1.9
+++ object_driver.module	14 Jul 2007 14:15:37 -0000
@@ -479,21 +479,22 @@ function object_driver_load($class, $id,
 function object_driver_save(&$obj) {
   $class = $obj->class;
 
-  $id_name = $class .'_id';
-  $obj->is_new = FALSE;
+  // Is this a new object?
+  $obj->is_new = empty($obj->$id_name);
 
-  if (empty($obj->$id_name)) {
-    // Insert a new object
-    $obj->is_new = TRUE;
-    $obj->$id_name = db_next_id("{$table}_id");
-  }
-  
   if (function_exists($class .'_save')) {
     call_user_func($class .'_save', $obj);
   }
   else { // Default functionality
+    $id_name = $class .'_id';
     $obj_def = call_user_func($class .'_class_define');
     $table = isset($obj_def['table']) ? $obj_def['table'] : $class;
+
+    if ($obj->is_new) {
+      // Insert a new object
+      $obj->$id_name = db_next_id("{". $table ."}_id");
+    }
+    
     $column_names = array();
     $column_placeholders = array();
     $column_assignments = array();
@@ -513,10 +514,10 @@ function object_driver_save(&$obj) {
     }
     $data[] = $obj->$id_name;
     if ($obj->is_new) {
-      db_query("INSERT INTO {$table} (". implode(', ', $column_names) .", $id_name) VALUES (". implode(', ', $column_placeholders) .', %d)', $data);
+      db_query("INSERT INTO {". $table ."} (". implode(', ', $column_names) .", $id_name) VALUES (". implode(', ', $column_placeholders) .', %d)', $data);
     }
     else {
-      db_query("UPDATE {$table} SET ". implode(', ', $column_assignments) ." WHERE $id_name = %d", $data);
+      db_query("UPDATE {". $table ."} SET ". implode(', ', $column_assignments) ." WHERE $id_name = %d", $data);
     }
   }
   if ($obj->is_new) {
