org.h2gis.drivers.dbf
Class DBFDriverFunction

java.lang.Object
  extended by org.h2gis.drivers.dbf.DBFDriverFunction
All Implemented Interfaces:
DriverFunction

public class DBFDriverFunction
extends Object
implements DriverFunction

Author:
Nicolas Fortin

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.h2gis.h2spatialapi.DriverFunction
DriverFunction.IMPORT_DRIVER_TYPE
 
Field Summary
static String DESCRIPTION
           
 
Constructor Summary
DBFDriverFunction()
           
 
Method Summary
static DbaseFileHeader dBaseHeaderFromMetaData(ResultSetMetaData metaData)
          Create a DBF header from the columns specified in parameter.
 void exportTable(Connection connection, String tableReference, File fileName, ProgressVisitor progress)
           
 void exportTable(Connection connection, String tableReference, File fileName, ProgressVisitor progress, String encoding)
           
 String[] getExportFormats()
           
 String getFormatDescription(String format)
           
 DriverFunction.IMPORT_DRIVER_TYPE getImportDriverType()
           
 String[] getImportFormats()
           
static String getQuestionMark(int count)
          Generate the concatenation of ?
static String getSQLColumnTypes(DbaseFileHeader header, boolean isH2Database)
          Return SQL Columns declaration
 void importFile(Connection connection, String tableReference, File fileName, ProgressVisitor progress)
           
 void importFile(Connection connection, String tableReference, File fileName, ProgressVisitor progress, String forceFileEncoding)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DESCRIPTION

public static String DESCRIPTION
Constructor Detail

DBFDriverFunction

public DBFDriverFunction()
Method Detail

exportTable

public void exportTable(Connection connection,
                        String tableReference,
                        File fileName,
                        ProgressVisitor progress)
                 throws SQLException,
                        IOException
Specified by:
exportTable in interface DriverFunction
Throws:
SQLException
IOException

exportTable

public void exportTable(Connection connection,
                        String tableReference,
                        File fileName,
                        ProgressVisitor progress,
                        String encoding)
                 throws SQLException,
                        IOException
Throws:
SQLException
IOException

getFormatDescription

public String getFormatDescription(String format)
Specified by:
getFormatDescription in interface DriverFunction

getImportDriverType

public DriverFunction.IMPORT_DRIVER_TYPE getImportDriverType()
Specified by:
getImportDriverType in interface DriverFunction

getImportFormats

public String[] getImportFormats()
Specified by:
getImportFormats in interface DriverFunction

getExportFormats

public String[] getExportFormats()
Specified by:
getExportFormats in interface DriverFunction

importFile

public void importFile(Connection connection,
                       String tableReference,
                       File fileName,
                       ProgressVisitor progress)
                throws SQLException,
                       IOException
Specified by:
importFile in interface DriverFunction
Throws:
SQLException
IOException

importFile

public void importFile(Connection connection,
                       String tableReference,
                       File fileName,
                       ProgressVisitor progress,
                       String forceFileEncoding)
                throws SQLException,
                       IOException
Parameters:
connection - Active connection, do not close this connection.
tableReference - [[catalog.]schema.]table reference
fileName - File path to read
forceFileEncoding - File encoding to use, null will use the provided file encoding in file header.
Throws:
SQLException - Table write error
IOException - File read error

getQuestionMark

public static String getQuestionMark(int count)
Generate the concatenation of ? characters. Used by PreparedStatement.

Parameters:
count - Number of ? character to generation
Returns:
Value ex: "?, ?, ?"

getSQLColumnTypes

public static String getSQLColumnTypes(DbaseFileHeader header,
                                       boolean isH2Database)
                                throws IOException
Return SQL Columns declaration

Parameters:
header - DBAse file header
Returns:
Array of columns ex: ["id INTEGER", "len DOUBLE"]
Throws:
IOException

dBaseHeaderFromMetaData

public static DbaseFileHeader dBaseHeaderFromMetaData(ResultSetMetaData metaData)
                                               throws SQLException
Create a DBF header from the columns specified in parameter.

Parameters:
metaData - SQL ResultSetMetadata
Returns:
DbfaseFileHeader instance.
Throws:
SQLException - If one or more type are not supported by DBF


Copyright © 2015 IRSTV CNRS-FR-2488. All Rights Reserved.