Package org.h2gis.functions.io.dbf

## Class DBFDriverFunction

- java.lang.Object
- - org.h2gis.functions.io.dbf.DBFDriverFunction

All Implemented Interfaces:
  `org.h2gis.api.DriverFunction`

    public class DBFDriverFunction
    extends Object
    implements org.h2gis.api.DriverFunction

Author:
  Erwan Bocher, CNRS, Nicolas Fortin, Sylvain PALOMINOS (UBS 2019)

### Nested Class Summary

### Nested classes/interfaces inherited from interface org.h2gis.api.DriverFunction

`org.h2gis.api.DriverFunction.IMPORT_DRIVER_TYPE`

### Field Summary

Fields
`static String` `DESCRIPTION`

### Constructor Summary

Constructors
`DBFDriverFunction()`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`static DbaseFileHeader` `dBaseHeaderFromMetaData​(ResultSetMetaData metaData, List<Integer> retainedColumns)` Create a DBF header from the columns specified in parameter.
`String[]` `exportTable​(Connection connection, String tableReference, File fileName, boolean deleteFiles, org.h2gis.api.ProgressVisitor progress)`
`String[]` `exportTable​(Connection connection, String tableReference, File fileName, String options, boolean deleteFiles, org.h2gis.api.ProgressVisitor progress)`
`String[]` `exportTable​(Connection connection, String tableReference, File fileName, String encoding, org.h2gis.api.ProgressVisitor progress)`
`String[]` `exportTable​(Connection connection, String tableReference, File fileName, org.h2gis.api.ProgressVisitor progress)`
`String[]` `getExportFormats()`
`String` `getFormatDescription​(String format)`
`org.h2gis.api.DriverFunction.IMPORT_DRIVER_TYPE` `getImportDriverType()`
`String[]` `getImportFormats()`
`static String` `getQuestionMark​(int count)` Generate the concatenation of ? characters.
`static String` `getSQLColumnTypes​(DbaseFileHeader header, org.h2gis.utilities.dbtypes.DBTypes dbTypes, List<org.h2.table.Column> cols)` Return SQL Columns declaration
`String[]` `importFile​(Connection connection, String tableReference, File fileName, boolean deleteTables, org.h2gis.api.ProgressVisitor progress)`
`String[]` `importFile​(Connection connection, String tableReference, File fileName, String options, boolean deleteTables, org.h2gis.api.ProgressVisitor progress)`
`String[]` `importFile​(Connection connection, String tableReference, File fileName, String forceFileEncoding, org.h2gis.api.ProgressVisitor progress)`
`String[]` `importFile​(Connection connection, String tableReference, File fileName, org.h2gis.api.ProgressVisitor progress)`
`boolean` `isSpatialFormat​(String extension)`

### 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 String[] exportTable​(Connection connection,
                                String tableReference,
                                File fileName,
                                org.h2gis.api.ProgressVisitor progress)
                         throws SQLException,
                                IOException

Specified by:
  `exportTable` in interface `org.h2gis.api.DriverFunction`
Throws:
  `SQLException`
  `IOException`

#### exportTable

    public String[] exportTable​(Connection connection,
                                String tableReference,
                                File fileName,
                                boolean deleteFiles,
                                org.h2gis.api.ProgressVisitor progress)
                         throws SQLException,
                                IOException

Specified by:
  `exportTable` in interface `org.h2gis.api.DriverFunction`
Throws:
  `SQLException`
  `IOException`

#### exportTable

    public String[] exportTable​(Connection connection,
                                String tableReference,
                                File fileName,
                                String options,
                                boolean deleteFiles,
                                org.h2gis.api.ProgressVisitor progress)
                         throws SQLException,
                                IOException

Specified by:
  `exportTable` in interface `org.h2gis.api.DriverFunction`
Throws:
  `SQLException`
  `IOException`

#### exportTable

    public String[] exportTable​(Connection connection,
                                String tableReference,
                                File fileName,
                                String encoding,
                                org.h2gis.api.ProgressVisitor progress)
                         throws SQLException,
                                IOException

Specified by:
  `exportTable` in interface `org.h2gis.api.DriverFunction`
Throws:
  `SQLException`
  `IOException`

#### getFormatDescription

    public String getFormatDescription​(String format)

Specified by:
  `getFormatDescription` in interface `org.h2gis.api.DriverFunction`

#### getImportDriverType

    public org.h2gis.api.DriverFunction.IMPORT_DRIVER_TYPE getImportDriverType()

Specified by:
  `getImportDriverType` in interface `org.h2gis.api.DriverFunction`

#### getImportFormats

    public String[] getImportFormats()

Specified by:
  `getImportFormats` in interface `org.h2gis.api.DriverFunction`

#### getExportFormats

    public String[] getExportFormats()

Specified by:
  `getExportFormats` in interface `org.h2gis.api.DriverFunction`

#### isSpatialFormat

    public boolean isSpatialFormat​(String extension)

Specified by:
  `isSpatialFormat` in interface `org.h2gis.api.DriverFunction`

#### importFile

    public String[] importFile​(Connection connection,
                               String tableReference,
                               File fileName,
                               org.h2gis.api.ProgressVisitor progress)
                        throws SQLException,
                               IOException

Specified by:
  `importFile` in interface `org.h2gis.api.DriverFunction`
Throws:
  `SQLException`
  `IOException`

#### importFile

    public String[] importFile​(Connection connection,
                               String tableReference,
                               File fileName,
                               String forceFileEncoding,
                               org.h2gis.api.ProgressVisitor progress)
                        throws SQLException,
                               IOException

Specified by:
  `importFile` in interface `org.h2gis.api.DriverFunction`
Throws:
  `SQLException`
  `IOException`

#### importFile

    public String[] importFile​(Connection connection,
                               String tableReference,
                               File fileName,
                               boolean deleteTables,
                               org.h2gis.api.ProgressVisitor progress)
                        throws SQLException,
                               IOException

Specified by:
  `importFile` in interface `org.h2gis.api.DriverFunction`
Throws:
  `SQLException`
  `IOException`

#### importFile

    public String[] importFile​(Connection connection,
                               String tableReference,
                               File fileName,
                               String options,
                               boolean deleteTables,
                               org.h2gis.api.ProgressVisitor progress)
                        throws SQLException,
                               IOException

Specified by:
  `importFile` in interface `org.h2gis.api.DriverFunction`
Throws:
  `SQLException`
  `IOException`

#### 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,
                                           org.h2gis.utilities.dbtypes.DBTypes dbTypes,
                                           List<org.h2.table.Column> cols)
                                    throws IOException

Return SQL Columns declaration

Parameters:
  `header` - DBAse file header
  `cols` - array columns that will be populated
Returns:
  Array of columns ex: ["id INTEGER", "len DOUBLE"]
Throws:
  `IOException`

#### dBaseHeaderFromMetaData

    public static DbaseFileHeader dBaseHeaderFromMetaData​(ResultSetMetaData metaData,
                                                          List<Integer> retainedColumns)
                                                   throws SQLException

Create a DBF header from the columns specified in parameter.

Parameters:
  `metaData` - SQL ResultSetMetadata
  `retainedColumns` - list of column indexes
Returns:
  DbfaseFileHeader instance.
Throws:
  `SQLException` - If one or more type are not supported by DBF