/dd/ -> 0_0033_inc.php
1  <?php
2  
3  // 0_0033_inc.php - See code
4  // 0_0033_inc.php - author: Nico Stuurman
5  
6    /***************************************************************************
7    * Copyright (c) 2002 by Nico Stuurman                                      *
8    * ------------------------------------------------------------------------ *
9    * This code is part of phplabware (http://phplabware.sf.net)               *
10    *                                                                          *
11    *                                                                          *
12    *  This program is free software; you can redistribute it and/or modify it *
13    *  under the terms of the GNU General Public License as published by the   *
14    *  Free Software Foundation; either version 2 of the License, or (at your  *
15    *  option) any later version.                                              *
16    \**************************************************************************/ 
17  
18  // rename associated_sql, add columns link_first, link_second, and modifiable
19  $r=$db->Execute("SELECT table_desc_name FROM tableoftables WHERE table_desc_name IS NOT NULL");
20  while (!$r->EOF) {
21     $table_desc_name=$r->fields["table_desc_name"];
22     $db->Execute("ALTER TABLE $table_desc_name CHANGE associated_sql associated_column text");
23     $db->Execute("ALTER TABLE $table_desc_name RENAME associated_sql TO associated_column");
24     $db->Execute("ALTER TABLE $table_desc_name ADD COLUMN link_first text");
25     $db->Execute("ALTER TABLE $table_desc_name ADD COLUMN link_last text");
26     $db->Execute("ALTER TABLE $table_desc_name ADD COLUMN modifiable varchar(1)");
27     $db->Execute("UPDATE $table_desc_name SET modifiable='Y'");
28     $db->Execute("UPDATE $table_desc_name SET modifiable='N' WHERE columnname='magic' OR columnname='lastmoddate' OR columnname='lastmodby' OR columnname='date' OR columnname='access' OR columnname='id' OR columnname='ownerid'");
29     
30     $r->MoveNext();
31  }
32  
33  ?>