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://geonames.usgs.gov/layout.html *

* Created by IntelliJ IDEA. * User: mfriedman * Date: Jan 30, 2006 * Time: 9:14:25 AM * To change this template use File | Settings | File Templates. */ public class Fips55 implements DataFile { private String inputFileName; public Fips55(String inputFileName) { this.inputFileName = inputFileName; } public String getTable() { return "fips_55"; } public URL getDataSource() throws MalformedURLException { return null; } public InputStream getInputStream() throws IOException { return new FileInputStream(inputFileName); } public String getCreateQuery() { return "create table fips_55 (" + "feature_id char(9), " // 1 + "fips_state_code char(2), " // 2 + "fips55_place_code char(5), " // 3 + "feature_class varchar(25), " // 4 + "fips55_class_code char(2), " // 5 + "feature_name varchar(100), " // 6 + "other_name_code char(6), " // 7 + "state_alpha_code char(2), " // 8 + "county_seq_num char(2), " // 9 + "fips_county_code char(3), " // 10 + "county_name varchar(36), " // 11 + "latitude number, " // 12 + "longitude number, " // 13 + "part_of_code char(6), " // 14 + "gsa_code char(4) " // 15 + ")"; } public String getDeleteQuery() { return "delete from fips_55"; } public String getInsertQuery() { return "insert into fips_55 values (" + "?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; } public int deliminate(InputStream inputStream, PreparedStatement pst) throws SQLException { FixedToDelim fixedToDelim = new FixedToDelim(); return fixedToDelim.fixedDeliminate(inputStream, pst, "\t", 15); } }