/[drupal]/contributions/modules/object_driver/object_driver.install
ViewVC logotype

Contents of /contributions/modules/object_driver/object_driver.install

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download) (as text)
Thu Sep 13 02:03:52 2007 UTC (2 years, 2 months ago) by pwolanin
Branch: MAIN
CVS Tags: DRUPAL-5--1-0, HEAD
File MIME type: text/x-php
#159096 fix table prefixing
1 <?php
2 // $Id$
3
4 function object_driver_install() {
5 return;
6 }
7
8 /**
9 * Fix mis-named rows in {sequences}.
10 */
11
12 function object_driver_update_5000() {
13 $ret = array();
14
15 switch ($GLOBALS['db_type']) {
16 case 'mysql':
17 case 'mysqli':
18 $class_list = object_driver_class_list();
19 foreach ($class_list as $class) {
20 $id_name = $class .'_id';
21 $obj_def = call_user_func($class .'_class_define');
22 $table = isset($obj_def['table']) ? $obj_def['table'] : $class;
23
24 $max = db_result(db_query("SELECT MAX(". $id_name .") FROM {". $table ."}"));
25 db_next_id("{". $table ."}_id");
26 $name = db_prefix_tables("{". $table ."}_id");
27
28 $ret[] = update_sql("REPLACE INTO {sequences} VALUES ('". $name ."', ". $max .")");
29 }
30 }
31
32 return $ret;
33 }

  ViewVC Help
Powered by ViewVC 1.1.2