Package org.apache.derby.impl.load
Class ImportAbstract
- java.lang.Object
-
- org.apache.derby.vti.VTITemplate
-
- org.apache.derby.impl.load.ImportAbstract
-
- All Implemented Interfaces:
java.lang.AutoCloseable,java.sql.ResultSet,java.sql.Wrapper,AwareVTI
- Direct Known Subclasses:
Import
abstract class ImportAbstract extends VTITemplate
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.derby.vti.VTITemplate
VTITemplate.ColumnDescriptor
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.lang.StringCOLUMNNAMEPREFIX(package private) java.lang.String[]columnNames(package private) java.lang.String[]columnTypeNames(package private) java.lang.StringcolumnTypeNamesString(package private) int[]columnWidths(package private) ControlInfocontrolFileReader(package private) ImportReadDataimportReadData(package private) ImportResultSetMetaDataimportResultSetMetaData(package private) intlineNumberprotected booleanlobsInExtFile(package private) java.lang.String[]nextRow(package private) intnoOfColumnsExpected(package private) intnumberOfColumns(package private) int[]tableColumnTypes(package private) java.lang.StringtableColumnTypesStr(package private) java.util.HashMapudtClasses(package private) java.lang.StringudtClassNamesStringprivate booleanwasNull
-
Constructor Summary
Constructors Constructor Description ImportAbstract()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclose()closes the resultsetstatic java.lang.ObjectdestringifyObject(java.lang.String raw)Read an object which was serialized to a string using StringUtil(package private) voiddoAllTheWork()Does all the workjava.sql.BlobgetBlob(int columnIndex)Returnsjava.sql.Blobtype object that contains the column data from the import file.byte[]getBytes(int columnIndex)Returns byte array that contains the column data from the import file.java.sql.ClobgetClob(int columnIndex)Returnsjava.sql.Clobtype object that contains the column data from the import file.intgetCurrentLineNumber()gets the current line number(package private) abstract ImportReadDatagetImportReadData()java.sql.ResultSetMetaDatagetMetaData()Gets the resultset meta datajava.lang.ObjectgetObject(int columnIndex)Returns Object that contains the column data from the import file.intgetRow()gets the next rowjava.lang.StringgetString(int columnIndex)java.sql.SQLExceptionimportError(java.lang.Exception ex)Close the stream and wrap exception in a SQLExceptionprivate booleanisColumnInExtFile(int colIndex)Check if for this column type, real data is stored in an external file and only the reference is in the main import file.(package private) voidloadColumnNames()booleannext()static java.lang.ObjectreadObject(byte[] bytes)Read a serializable from a set of bytes.booleanwasNull()-
Methods inherited from class org.apache.derby.vti.VTITemplate
absolute, afterLast, beforeFirst, cancelRowUpdates, clearWarnings, deleteRow, findColumn, first, getArray, getArray, getAsciiStream, getAsciiStream, getBigDecimal, getBigDecimal, getBigDecimal, getBigDecimal, getBinaryStream, getBinaryStream, getBlob, getBoolean, getBoolean, getByte, getByte, getBytes, getCharacterStream, getCharacterStream, getClob, getConcurrency, getContext, getCursorName, getDate, getDate, getDate, getDate, getDouble, getDouble, getFetchDirection, getFetchSize, getFloat, getFloat, getHoldability, getInt, getInt, getLong, getLong, getNCharacterStream, getNCharacterStream, getNClob, getNClob, getNString, getNString, getObject, getObject, getObject, getObject, getObject, getRef, getRef, getReturnTableSignature, getRowId, getRowId, getShort, getShort, getSQLXML, getSQLXML, getStatement, getString, getTime, getTime, getTime, getTime, getTimestamp, getTimestamp, getTimestamp, getTimestamp, getType, getUnicodeStream, getUnicodeStream, getURL, getURL, getWarnings, insertRow, isAfterLast, isBeforeFirst, isClosed, isFirst, isLast, isWrapperFor, last, moveToCurrentRow, moveToInsertRow, notImplemented, previous, refreshRow, relative, rowDeleted, rowInserted, rowUpdated, setContext, setFetchDirection, setFetchSize, unwrap, updateArray, updateArray, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateBigDecimal, updateBigDecimal, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBlob, updateBlob, updateBlob, updateBlob, updateBlob, updateBlob, updateBoolean, updateBoolean, updateByte, updateByte, updateBytes, updateBytes, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateClob, updateClob, updateClob, updateClob, updateClob, updateClob, updateDate, updateDate, updateDouble, updateDouble, updateFloat, updateFloat, updateInt, updateInt, updateLong, updateLong, updateNCharacterStream, updateNCharacterStream, updateNCharacterStream, updateNCharacterStream, updateNClob, updateNClob, updateNClob, updateNClob, updateNClob, updateNClob, updateNString, updateNString, updateNull, updateNull, updateObject, updateObject, updateObject, updateObject, updateRef, updateRef, updateRow, updateRowId, updateRowId, updateShort, updateShort, updateSQLXML, updateSQLXML, updateString, updateString, updateTime, updateTime, updateTimestamp, updateTimestamp
-
-
-
-
Field Detail
-
controlFileReader
ControlInfo controlFileReader
-
importReadData
ImportReadData importReadData
-
columnNames
java.lang.String[] columnNames
-
numberOfColumns
int numberOfColumns
-
columnWidths
int[] columnWidths
-
lineNumber
int lineNumber
-
nextRow
java.lang.String[] nextRow
-
importResultSetMetaData
ImportResultSetMetaData importResultSetMetaData
-
noOfColumnsExpected
int noOfColumnsExpected
-
lobsInExtFile
protected boolean lobsInExtFile
-
tableColumnTypesStr
java.lang.String tableColumnTypesStr
-
tableColumnTypes
int[] tableColumnTypes
-
columnTypeNamesString
java.lang.String columnTypeNamesString
-
columnTypeNames
java.lang.String[] columnTypeNames
-
udtClassNamesString
java.lang.String udtClassNamesString
-
udtClasses
java.util.HashMap udtClasses
-
wasNull
private boolean wasNull
-
COLUMNNAMEPREFIX
static final java.lang.String COLUMNNAMEPREFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
getImportReadData
abstract ImportReadData getImportReadData() throws java.lang.Exception
- Throws:
java.lang.Exception
-
doAllTheWork
void doAllTheWork() throws java.lang.ExceptionDoes all the work- Throws:
java.lang.Exception- if there is an error
-
loadColumnNames
void loadColumnNames()
-
getMetaData
public java.sql.ResultSetMetaData getMetaData()
Gets the resultset meta data- Specified by:
getMetaDatain interfacejava.sql.ResultSet- Overrides:
getMetaDatain classVTITemplate- Throws:
java.sql.SQLException- if there is an error
-
getRow
public int getRow() throws java.sql.SQLExceptiongets the next row- Specified by:
getRowin interfacejava.sql.ResultSet- Overrides:
getRowin classVTITemplate- Throws:
java.sql.SQLException- if there is an error
-
getCurrentLineNumber
public int getCurrentLineNumber()
gets the current line number
-
next
public boolean next() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
close
public void close() throws java.sql.SQLExceptioncloses the resultset- Throws:
java.sql.SQLException- if there is an error
-
wasNull
public boolean wasNull()
- Specified by:
wasNullin interfacejava.sql.ResultSet- Overrides:
wasNullin classVTITemplate
-
getString
public java.lang.String getString(int columnIndex) throws java.sql.SQLException- Specified by:
getStringin interfacejava.sql.ResultSet- Overrides:
getStringin classVTITemplate- Throws:
java.sql.SQLException- if there is an error
-
getClob
public java.sql.Clob getClob(int columnIndex) throws java.sql.SQLExceptionReturnsjava.sql.Clobtype object that contains the column data from the import file.- Specified by:
getClobin interfacejava.sql.ResultSet- Overrides:
getClobin classVTITemplate- Parameters:
columnIndex- number of the column. starts at 1.- Throws:
java.sql.SQLException- if any occurs during create of the clob object.
-
getBlob
public java.sql.Blob getBlob(int columnIndex) throws java.sql.SQLExceptionReturnsjava.sql.Blobtype object that contains the column data from the import file.- Specified by:
getBlobin interfacejava.sql.ResultSet- Overrides:
getBlobin classVTITemplate- Parameters:
columnIndex- number of the column. starts at 1.- Throws:
java.sql.SQLException- if any occurs during create of the blob object.
-
getObject
public java.lang.Object getObject(int columnIndex) throws java.sql.SQLExceptionReturns Object that contains the column data from the import file.- Specified by:
getObjectin interfacejava.sql.ResultSet- Overrides:
getObjectin classVTITemplate- Parameters:
columnIndex- number of the column. starts at 1.- Throws:
java.sql.SQLException- if any error occurs.
-
readObject
public static java.lang.Object readObject(byte[] bytes) throws java.lang.ExceptionRead a serializable from a set of bytes.- Throws:
java.lang.Exception
-
destringifyObject
public static java.lang.Object destringifyObject(java.lang.String raw) throws java.lang.ExceptionRead an object which was serialized to a string using StringUtil- Throws:
java.lang.Exception
-
getBytes
public byte[] getBytes(int columnIndex) throws java.sql.SQLExceptionReturns byte array that contains the column data from the import file.- Specified by:
getBytesin interfacejava.sql.ResultSet- Overrides:
getBytesin classVTITemplate- Parameters:
columnIndex- number of the column. starts at 1.- Throws:
java.sql.SQLException- if any error occurs.
-
isColumnInExtFile
private boolean isColumnInExtFile(int colIndex)
Check if for this column type, real data is stored in an external file and only the reference is in the main import file.- Parameters:
colIndex- number of the column. starts at 1.- Returns:
- true, if the column data in a different file from the main import file , otherwise false.
-
importError
public java.sql.SQLException importError(java.lang.Exception ex)
Close the stream and wrap exception in a SQLException- Parameters:
ex- Exception causing the import error- Throws:
java.sql.SQLException
-
-