コード例 #1
0
 /**
  * This function makes the database
  * like the table specification.
  */
 public static function sync_table_specification_with_database($root_password)
 {
     $specified_tables = self::get_tables();
     #print_r($specified_tables);
     foreach ($specified_tables as $specified_table) {
         #$table_name = $specified_table->get_name();
         #echo '$table_name: ' . $table_name . PHP_EOL;
         /*
          * Does the table exist?
          *
          * If not, create it.
          */
         $dbh = Database_ConnectionsHelper::get_root_connection($root_password);
         #$query = "SHOW TABLES LIKE $table_name";
         #
         #$result = mysql_query($query, $dbh);
         #
         #if (mysql_num_rows($result) == 0) {
         #	$stmt =
         #}
         #$stmt = "CREATE TABLE IF NOT EXISTS $table_name";
         $create_statement = $specified_table->get_create_statement();
         echo '$create_statement: ' . $create_statement . PHP_EOL;
         #mysql_query($stmt, $dbh);
     }
 }