package com.philmcrew.data; import com.philmcrew.utility.FixedToDelim; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; import java.sql.PreparedStatement; import java.sql.SQLException; /** * http://earth-info.nga.mil/gns/html/gis_contryfiles.html *

* Created by IntelliJ IDEA. * User: mfriedman * Date: Jan 30, 2006 * Time: 8:14:50 AM * To change this template use File | Settings | File Templates. */ public class GnsGeoNames implements DataFile { private String inputFileName; public GnsGeoNames(String inputFileName) { this.inputFileName = inputFileName; } public String getTable() { return "gns_geo_names"; } public URL getDataSource() throws MalformedURLException { return null; } public InputStream getInputStream() throws IOException { return new FileInputStream(inputFileName); } public String getCreateQuery() { return "create table gns_geo_names (" + "region_code char(1), " // 1 + "unique_feature_id int, " // 2 + "unique_name_id int, " // 3 + "latitude number, " // 4 + "longitude number, " // 5 + "dms_latitude int, " // 6 + "dms_longitude int, " // 7 + "universal_transverse_mercator char(4), " // 8 + "joint_op_graphic char(7), " // 9 + "feature_class char(1), " // 10 + "feature_des_code char(5), " // 11 + "pop_place_class char(1), " // 12 + "country_code char(2), " // 13 + "admin_div1 char(2), " // 14 + "admin_div2 varchar(200), " // 15 + "dimension_data int, " // 16 + "country_code_2nd char(2), " // 17 + "name_type char(1), " // 18 + "language_code char(2), " // 19 + "short_form varchar(128), " // 20 + "generic varchar(128), " // 21 + "sort_name varchar(200), " // 22 + "full_name varchar(200), " // 23 + "full_name_nd varchar(200), " // 24 + "mod_date char(10)" // 25 + ")"; } public String getDeleteQuery() { return "delete from gns_geo_names"; } public String getInsertQuery() { return "insert into gns_geo_names values (" + "?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; } public int deliminate(InputStream inputStream, PreparedStatement pst) throws SQLException { FixedToDelim fixedToDelim = new FixedToDelim(); return fixedToDelim.fixedDeliminate(inputStream, pst, "\t", 25); } }