You are here

function _serial_rename_tables in Serial Field 6

Same name and namespace in other branches
  1. 7 serial.inc \_serial_rename_tables()

Renames serial table(s) when a content type us renamed.

Parameters

$old_type_name: an old node type machine name

$new_type_name: a new node type machine name

1 call to _serial_rename_tables()
serial_node_type in ./serial.module
Implementation of hook_node_type()

File

./serial.inc, line 45
Internal functions for the Serial module.

Code

function _serial_rename_tables($old_type_name, $new_type_name) {
  $sql = "SELECT f.field_name FROM {content_node_field} f, {content_node_field_instance} i " . "WHERE f.field_name = i.field_name AND f.type = 'serial' AND i.type_name = '%s'";
  $result = db_query(db_rewrite_sql($sql), $new_type_name);
  while ($data = db_fetch_object($result)) {
    $old_table = _serial_get_table_name($old_type_name, $data->field_name);
    $new_table = _serial_get_table_name($new_type_name, $data->field_name);
    db_rename_table($ret, $old_table, $new_table);
  }
}