示例#1
0
 $table_schema = array();
 // iterate through source tables
 foreach ($tables_src as $table) {
     if (array_search($table, $skip_tables) !== FALSE) {
         if ($debug) {
             echo "Skipping {$table}<br>\n";
         }
         continue;
     }
     if ($debug) {
         echo "Creating {$table}<br>\n";
     }
     if ($empty_tables && $gDb_dst->tableExists($table)) {
         $gDb_dst->dropTables(array($table));
     }
     $schema = $gDb_src->MetaColumns($table, false, true);
     $t = "";
     $first = true;
     foreach (array_keys($schema) as $col) {
         $t .= !$first ? ",\n" : "";
         $x = $schema[$col];
         $t .= $x->name . " ";
         switch ($x->type) {
             case "tinyint":
             case "int":
                 $i = abs(((int) $x->max_length ^ 2) - 1);
                 $i = $i == 5 ? 4 : $i;
                 $i = $i == 0 ? 1 : $i;
                 $t .= "I" . $i;
                 break;
             case "double":