Exemplo n.º 1
0
        $sth->bindParam('is_satellite_provider', $values['is_satellite_provider'], \PDO::PARAM_INT);
        $sth->execute();
    });
    Importer::csvRead($files['GeoLite2-Country-Locations-en.csv'], function ($values) use($dbh) {
        $sth = $dbh->prepare('
			INSERT INTO country_locations (
				geoname_id,
				locale_code,
				continent_code,
				continent_name,
				country_iso_code,
				country_name
			) VALUES (
				:geoname_id,
				:locale_code,
				:continent_code,
				:continent_name,
				:country_iso_code,
				:country_name
			)
			');
        $sth->bindParam('geoname_id', $values['geoname_id'], \PDO::PARAM_INT);
        $sth->bindParam('locale_code', $values['locale_code'], \PDO::PARAM_STR);
        $sth->bindParam('continent_code', $values['continent_code'], \PDO::PARAM_STR);
        $sth->bindParam('continent_name', $values['continent_name'], \PDO::PARAM_STR);
        $sth->bindParam('country_iso_code', $values['country_iso_code'], \PDO::PARAM_STR);
        $sth->bindParam('country_name', $values['country_name'], \PDO::PARAM_STR);
        $sth->execute();
    });
} catch (\Exception $e) {
    echo $e->getMessage() . "\n";
    exit(1);