Beispiel #1
0
 /**
   localtranstoday used to be a view; recreate
   it as a table if needed.
 */
 public function normalize($db_name, $mode = BasicModel::NORMALIZE_MODE_CHECK, $doCreate = False)
 {
     if ($db_name == CoreLocal::get('pDatabase')) {
         $this->connection = Database::pDataConnect();
     } else {
         if ($db_name == CoreLocal::get('tDatabase')) {
             $this->connection = Database::tDataConnect();
         } else {
             echo "Error: Unknown database ({$db_name})";
             return false;
         }
     }
     if ($this->connection->isView($this->name)) {
         if ($mode == BasicModel::NORMALIZE_MODE_CHECK) {
             echo "View {$this->name} should be a table!\n";
             echo "==========================================\n";
             printf("%s table %s\n", "Check complete. Need to drop view & create replacement table.", $this->name);
             echo "==========================================\n\n";
             return 999;
         } else {
             $drop = $this->connection->query('DROP VIEW ' . $this->name);
             echo "==========================================\n";
             printf("Dropping view %s %s\n", $this->name, $drop ? "OK" : "failed");
             if ($drop) {
                 $cResult = $this->create();
                 printf("Update complete. Creation of table %s %s\n", $this->name, $cResult ? "OK" : "failed");
             }
             echo "==========================================\n";
             return true;
         }
     } else {
         return parent::normalize($db_name, $mode, $doCreate);
     }
 }
 public function __construct($con)
 {
     unset($this->columns['trans_id']);
     parent::__construct($con);
 }
Beispiel #3
0
 public function __construct($con)
 {
     $this->columns['trans_id']['increment'] = true;
     $this->columns['trans_id']['index'] = true;
     parent::__construct($con);
 }