/** * */ function sql_to_csv_file($sql, $out_file, $include_header = true) { $str = ""; $query = $this->wrap->query($sql); itr_to_csv_file($query, $out_file, $include_header); }
continue; } $con = new ODBCWrapper("Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=D:/dwork/bs_trafik_data/Trafikstatistik {$year}.mdb", "", ""); $dbf = new DatabaseFunctions($con); $dbf->sql_to_csv_file("\tSELECT *\n\t\t\t\t\t\t\t\t\t\t\t\tFROM PersonOplysninger\n\t\t\t\t\t\t\t\t\t\t\t\tORDER BY navn\n\t\t\t\t\t\t\t\t\t\t\t\t", "export_files/personoplysniner{$year}.csv"); echo "personoplysniner {$year} exported<br>"; } } elseif ($_GET['action'] === "export_trafik") { for ($year = 2000; $year <= 2016; $year++) { if ($year === 2006) { continue; } $con = new ODBCWrapper("Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=D:/dwork/bs_trafik_data/Trafikstatistik {$year}.mdb", "", ""); foreach (array_keys($month_map) as $month_idx) { $itr = new TrafikIterator($con, $year, $month_idx); itr_to_csv_file($itr, "export_files/trafik{$year}.csv", $month_idx === "01", $month_idx !== "01"); } echo "trafik {$year} exported<br>"; } } } //trafik mapping /** * */ class TrafikIterator { public $query; public $year; public $month_idx; function __construct($con, $year, $month_idx)