|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.derby.vti.VTITemplate
org.apache.derby.impl.load.ImportAbstract
org.apache.derby.impl.load.Import
This class implements import of data from a URL into a table. Import functions provided here in this class shouble be called through Systement Procedures. Import uses VTI , which is supprted only through Systemem procedures mechanism.
Field Summary | |
protected static java.lang.String |
COLUMNNAMEPREFIX
|
protected java.lang.String[] |
columnNames
|
protected int[] |
columnWidths
|
protected ControlInfo |
controlFileReader
|
protected ImportReadData |
importReadData
|
protected java.sql.ResultSetMetaData |
importResultSetMetaData
|
private java.lang.String |
inputFileName
|
protected java.lang.String[] |
nextRow
|
protected int |
noOfColumnsExpected
|
protected int |
numberOfColumns
|
Fields inherited from interface java.sql.ResultSet |
CLOSE_CURSORS_AT_COMMIT, CONCUR_READ_ONLY, CONCUR_UPDATABLE, FETCH_FORWARD, FETCH_REVERSE, FETCH_UNKNOWN, HOLD_CURSORS_OVER_COMMIT, TYPE_FORWARD_ONLY, TYPE_SCROLL_INSENSITIVE, TYPE_SCROLL_SENSITIVE |
Constructor Summary | |
Import(java.lang.String inputFileName,
java.lang.String columnDelimiter,
java.lang.String characterDelimiter,
java.lang.String codeset,
int noOfColumnsExpected)
Constructior to Invoke Import from a select statement |
Method Summary | |
void |
close()
closes the resultset |
protected void |
doAllTheWork()
Does all the work |
private void |
doImport()
|
protected ImportReadData |
getImportReadData()
virtual method from the abstract class |
java.sql.ResultSetMetaData |
getMetaData()
Gets the resultset meta data |
int |
getRow()
gets the next row |
java.lang.String |
getString(int columnIndex)
|
static void |
importData(java.sql.Connection connection,
java.lang.String schemaName,
java.lang.String tableName,
java.lang.String insertColumnList,
java.lang.String columnIndexes,
java.lang.String inputFileName,
java.lang.String columnDelimiter,
java.lang.String characterDelimiter,
java.lang.String codeset,
short replace)
SYSCS_IMPORT_DATA system Procedure from ij or from a Java application invokes this method to perform import to a table from a file. |
static void |
importTable(java.sql.Connection connection,
java.lang.String schemaName,
java.lang.String tableName,
java.lang.String inputFileName,
java.lang.String columnDelimiter,
java.lang.String characterDelimiter,
java.lang.String codeset,
short replace)
SYSCS_IMPORT_TABLE system Procedure from ij or from a Java application invokes this method to perform import to a table from a file. |
protected void |
loadColumnNames()
|
boolean |
next()
|
private static void |
performImport(java.sql.Connection connection,
java.lang.String schemaName,
java.lang.String insertColumnList,
java.lang.String columnIndexes,
java.lang.String tableName,
java.lang.String inputFileName,
java.lang.String columnDelimiter,
java.lang.String characterDelimiter,
java.lang.String codeset,
short replace)
|
boolean |
wasNull()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private java.lang.String inputFileName
protected ControlInfo controlFileReader
protected ImportReadData importReadData
protected java.lang.String[] columnNames
protected int numberOfColumns
protected int[] columnWidths
protected java.lang.String[] nextRow
protected java.sql.ResultSetMetaData importResultSetMetaData
protected int noOfColumnsExpected
protected static final java.lang.String COLUMNNAMEPREFIX
Constructor Detail |
public Import(java.lang.String inputFileName, java.lang.String columnDelimiter, java.lang.String characterDelimiter, java.lang.String codeset, int noOfColumnsExpected) throws java.sql.SQLException
inputFileName
- The URL of the ASCII file from which import will happen
java.lang.Exception
- on error
java.sql.SQLException
Method Detail |
private void doImport() throws java.lang.Exception
java.lang.Exception
public static void importTable(java.sql.Connection connection, java.lang.String schemaName, java.lang.String tableName, java.lang.String inputFileName, java.lang.String columnDelimiter, java.lang.String characterDelimiter, java.lang.String codeset, short replace) throws java.sql.SQLException
schemaName
- The name of the schema where table to import existstableName
- Name of the Table the data has to be imported to.inputFileName
- Name of the file from which data has to be imported.characterDelimiter
- Delimiter that is used to quiote non-numeric typescodeset
- Codeset of the data in the filereplace
- Indicates whether the data in table has to be replaced or
appended.(0 - append , > 0 Replace the data)
SQL
- Exception on errors
java.sql.SQLException
public static void importData(java.sql.Connection connection, java.lang.String schemaName, java.lang.String tableName, java.lang.String insertColumnList, java.lang.String columnIndexes, java.lang.String inputFileName, java.lang.String columnDelimiter, java.lang.String characterDelimiter, java.lang.String codeset, short replace) throws java.sql.SQLException
schemaName
- The name of the schema where table to import existstableName
- Name of the Table the data has to be imported to.insertColumnList
- Comma Seperated column name list to which data
has to be imported from file.eg: 'c2,c2,'c3'.columnIndexes
- Comma sepearted Lit Index of the columns in the file(first column
starts at 1). eg: '3 ,4 , 5'inputFileName
- Name of the file from which data has to be imported.characterDelimiter
- Delimiter that is used to quiote non-numeric typescodeset
- Codeset of the data in the filereplace
- Indicates whether the data in table has to be replaced or
appended.(0 - append , > 0 Replace the data)
SQL
- Exception on errors
java.sql.SQLException
private static void performImport(java.sql.Connection connection, java.lang.String schemaName, java.lang.String insertColumnList, java.lang.String columnIndexes, java.lang.String tableName, java.lang.String inputFileName, java.lang.String columnDelimiter, java.lang.String characterDelimiter, java.lang.String codeset, short replace) throws java.sql.SQLException
java.sql.SQLException
protected ImportReadData getImportReadData() throws java.lang.Exception
getImportReadData
in class ImportAbstract
java.lang.Exception
- on errorprotected void doAllTheWork() throws java.lang.Exception
java.lang.Exception
- if there is an errorprotected void loadColumnNames()
public java.sql.ResultSetMetaData getMetaData()
java.sql.SQLException
- if there is an errorpublic int getRow() throws java.sql.SQLException
getRow
in interface java.sql.ResultSet
getRow
in class VTITemplate
java.sql.SQLException
- if there is an errorResultSet
public boolean next() throws java.sql.SQLException
java.sql.SQLException
public void close() throws java.sql.SQLException
java.sql.SQLException
- if there is an errorpublic boolean wasNull()
wasNull
in interface java.sql.ResultSet
wasNull
in class VTITemplate
ResultSet
public java.lang.String getString(int columnIndex) throws java.sql.SQLException
getString
in interface java.sql.ResultSet
getString
in class VTITemplate
java.sql.SQLException
- if there is an errorResultSet
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |