Builder for convenient
configuration of the import functionality. Note that most scenarios for customizing input data can be handled by
implementing a custom ImportFilter.
| Modifier and Type | Class and Description |
|---|---|
| public static class | ImportUtil.
Builder which simplifies configuration of an import operation. |
| Modifier and Type | Field and Description |
|---|---|
| private static final int | COPY_TABLE_BATCH_SIZE
Batch commit size for copying other result sets into this database |
| pack-priv static final String | LINE_SEPARATOR
the platform line separator |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private static Table | createUniqueTable(Database db, String name, List<ColumnBuilder> columns, ResultSetMetaData md, ImportFilter filter)
Returns a new table with a unique name and the given table definition. |
| public static String | Returns: the name of the imported tableSource file to import f, Database db, String Name of the new table to create name, String Regular expression representing the delimiter string. delim)Copy a delimited text file into a new table in this database. |
| public static String | Returns: the name of the imported tableSource file to import f, Database db, String Name of the new table to create name, String Regular expression representing the delimiter string. delim, ImportFilter valid import filter filter)Copy a delimited text file into a new table in this database. |
| public static String | Returns: the name of the imported tableSource file to import f, Database db, String Name of the new table to create name, String Regular expression representing the delimiter string. delim, char the quote character quote, ImportFilter valid import filter filter, boolean if useExistingTable)true use current table if it already exists, otherwise, create new table with
unique nameCopy a delimited text file into a new table in this database. |
| public static String | Returns: the name of the imported tableSource file to import f, Database db, String Name of the new table to create name, String Regular expression representing the delimiter string. delim, char the quote character quote, ImportFilter valid import filter filter, boolean if useExistingTable, boolean true use current table if it already exists, otherwise, create new table with
unique nameif header)false the first line is not a header row, only valid if useExistingTable is trueCopy a delimited text file into a new table in this database. |
| public static String | Returns: the name of the imported tableSource reader to import in, Database db, String Name of the new table to create name, String Regular expression representing the delimiter string. delim)Copy a delimited text file into a new table in this database. |
| public static String | Returns: the name of the imported tableSource reader to import in, Database db, String Name of the new table to create name, String Regular expression representing the delimiter string. delim, ImportFilter valid import filter filter)Copy a delimited text file into a new table in this database. |
| public static String | Returns: the name of the imported tableSource reader to import in, Database db, String Name of the new table to create name, String Regular expression representing the delimiter string. delim, ImportFilter valid import filter filter, boolean if useExistingTable)true use current table if it already exists, otherwise, create new table with
unique nameCopy a delimited text file into a new (or optionally exixsting) table in this database. |
| public static String | Returns: the name of the imported tableSource reader to import in, Database db, String Name of the new table to create name, String Regular expression representing the delimiter string. delim, char the quote character quote, ImportFilter valid import filter filter, boolean if useExistingTable)true use current table if it already exists, otherwise, create new table with
unique nameCopy a delimited text file into a new (or optionally exixsting) table in this database. |
| public static String | Returns: the name of the imported tableSource reader to import in, Database db, String Name of the new table to create name, String Regular expression representing the delimiter string. delim, char the quote character quote, ImportFilter valid import filter filter, boolean if useExistingTable, boolean true use current table if it already exists, otherwise, create new table with
unique nameif header)false the first line is not a header row, only valid if useExistingTable is trueCopy a delimited text file into a new (or optionally exixsting) table in this database. |
| public static String | Returns: the name of the copied tableResultSet to copy from source, Database db, String Name of the new table to create name)Copy an existing JDBC ResultSet into a new table in this database. |
| public static String | Returns: the name of the imported tableResultSet to copy from source, Database db, String Name of the new table to create name, ImportFilter valid import filter filter)Copy an existing JDBC ResultSet into a new table in this database. |
| public static String | Returns: the name of the imported tableResultSet to copy from source, Database db, String Name of the new table to create name, ImportFilter valid import filter filter, boolean if useExistingTable)true use current table if it already exists, otherwise, create new table with
unique nameCopy an existing JDBC ResultSet into a new (or optionally existing) table in this database. |
| private static Object[] | splitLine(String line, Pattern delim, char quote, BufferedReader in, int numColumns)
Splits the given line using the given delimiter pattern and quote character. |
| public static List | Returns: a List of ColumnsReturns a List of Column instances converted from the given ResultSetMetaData (this is the same method used by
the various |
| COPY_TABLE_BATCH_SIZE | back to summary |
|---|---|
| private static final int COPY_TABLE_BATCH_SIZE Batch commit size for copying other result sets into this database | |
| LINE_SEPARATOR | back to summary |
|---|---|
| pack-priv static final String LINE_SEPARATOR the platform line separator | |
| ImportUtil | back to summary |
|---|---|
| private ImportUtil() | |
| createUniqueTable | back to summary |
|---|---|
| private static Table createUniqueTable(Database db, String name, List<ColumnBuilder> columns, ResultSetMetaData md, ImportFilter filter) throws IOException Returns a new table with a unique name and the given table definition. | |
| importFile | back to summary |
|---|---|
| public static String importFile(File f, Database db, String name, String delim) throws IOException Copy a delimited text file into a new table in this database.
Equivalent to: | |
| importFile | back to summary |
|---|---|
| public static String importFile(File f, Database db, String name, String delim, ImportFilter filter) throws IOException Copy a delimited text file into a new table in this database.
Equivalent to:
| |
| importFile | back to summary |
|---|---|
| public static String importFile(File f, Database db, String name, String delim, char quote, ImportFilter filter, boolean useExistingTable) throws IOException Copy a delimited text file into a new table in this database.
Equivalent to:
| |
| importFile | back to summary |
|---|---|
| public static String importFile(File f, Database db, String name, String delim, char quote, ImportFilter filter, boolean useExistingTable, boolean header) throws IOException Copy a delimited text file into a new table in this database.
Equivalent to:
| |
| importReader | back to summary |
|---|---|
| public static String importReader(BufferedReader in, Database db, String name, String delim) throws IOException Copy a delimited text file into a new table in this database.
Equivalent to:
| |
| importReader | back to summary |
|---|---|
| public static String importReader(BufferedReader in, Database db, String name, String delim, ImportFilter filter) throws IOException Copy a delimited text file into a new table in this database.
Equivalent to:
| |
| importReader | back to summary |
|---|---|
| public static String importReader(BufferedReader in, Database db, String name, String delim, ImportFilter filter, boolean useExistingTable) throws IOException Copy a delimited text file into a new (or optionally exixsting) table in this database.
Equivalent to:
| |
| importReader | back to summary |
|---|---|
| public static String importReader(BufferedReader in, Database db, String name, String delim, char quote, ImportFilter filter, boolean useExistingTable) throws IOException Copy a delimited text file into a new (or optionally exixsting) table in this database.
Equivalent to:
| |
| importReader | back to summary |
|---|---|
| public static String importReader(BufferedReader in, Database db, String name, String delim, char quote, ImportFilter filter, boolean useExistingTable, boolean header) throws IOException Copy a delimited text file into a new (or optionally exixsting) table in this database.
| |
| importResultSet | back to summary |
|---|---|
| public static String importResultSet(ResultSet source, Database db, String name) throws SQLException, IOException Copy an existing JDBC ResultSet into a new table in this database.
Equivalent to:
| |
| importResultSet | back to summary |
|---|---|
| public static String importResultSet(ResultSet source, Database db, String name, ImportFilter filter) throws SQLException, IOException Copy an existing JDBC ResultSet into a new table in this database.
Equivalent to:
| |
| importResultSet | back to summary |
|---|---|
| public static String importResultSet(ResultSet source, Database db, String name, ImportFilter filter, boolean useExistingTable) throws SQLException, IOException Copy an existing JDBC ResultSet into a new (or optionally existing) table in this database.
| |
| splitLine | back to summary |
|---|---|
| private static Object[] splitLine(String line, Pattern delim, char quote, BufferedReader in, int numColumns) throws IOException Splits the given line using the given delimiter pattern and quote character. May read additional lines for quotes spanning newlines. | |
| toColumns | back to summary |
|---|---|
| public static List Returns a List of Column instances converted from the given ResultSetMetaData (this is the same method used by
the various
| |
| Modifier and Type | Field and Description |
|---|---|
| private Database | |
| private String | |
| private ImportFilter | |
| private boolean | |
| private char | |
| private String | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public String | importFile(File f)
Imports the given delimited file into a table, using the settings of this builder. |
| public String | importReader(BufferedReader reader)
Imports delimited data from the given reader into a table, using the settings of this builder. |
| public String | importResultSet(ResultSet source)
Imports the given result set into a table, using the settings of this builder. |
| public ImportUtil. | |
| public ImportUtil. | |
| public ImportUtil. | |
| public ImportUtil. | |
| public ImportUtil. | |
| public ImportUtil. | |
| public ImportUtil. |
| db | back to summary |
|---|---|
| private Database db | |
| delim | back to summary |
|---|---|
| private String delim | |
| filter | back to summary |
|---|---|
| private ImportFilter filter | |
| header | back to summary |
|---|---|
| private boolean header | |
| quote | back to summary |
|---|---|
| private char quote | |
| tableName | back to summary |
|---|---|
| private String tableName | |
| useExistingTable | back to summary |
|---|---|
| private boolean useExistingTable | |
| Builder | back to summary |
|---|---|
| public Builder(Database db) | |
| Builder | back to summary |
|---|---|
| public Builder(Database db, String tableName) | |
| importFile | back to summary |
|---|---|
| public String importFile(File f) throws IOException Imports the given delimited file into a table, using the settings of this builder. | |
| importReader | back to summary |
|---|---|
| public String importReader(BufferedReader reader) throws IOException Imports delimited data from the given reader into a table, using the settings of this builder. | |
| importResultSet | back to summary |
|---|---|
| public String importResultSet(ResultSet source) throws SQLException, IOException Imports the given result set into a table, using the settings of this builder. | |
| withDatabase | back to summary |
|---|---|
| public ImportUtil. | |
| withDelimiter | back to summary |
|---|---|
| public ImportUtil. | |
| withFilter | back to summary |
|---|---|
| public ImportUtil. | |
| withHeader | back to summary |
|---|---|
| public ImportUtil. | |
| withQuote | back to summary |
|---|---|
| public ImportUtil. | |
| withTableName | back to summary |
|---|---|
| public ImportUtil. | |
| withUseExistingTable | back to summary |
|---|---|
| public ImportUtil. | |