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.String
COLUMNNAMEPREFIX
(package private) java.lang.String[]
columnNames
(package private) java.lang.String[]
columnTypeNames
(package private) java.lang.String
columnTypeNamesString
(package private) int[]
columnWidths
(package private) ControlInfo
controlFileReader
(package private) ImportReadData
importReadData
(package private) ImportResultSetMetaData
importResultSetMetaData
(package private) int
lineNumber
protected boolean
lobsInExtFile
(package private) java.lang.String[]
nextRow
(package private) int
noOfColumnsExpected
(package private) int
numberOfColumns
(package private) int[]
tableColumnTypes
(package private) java.lang.String
tableColumnTypesStr
(package private) java.util.HashMap
udtClasses
(package private) java.lang.String
udtClassNamesString
private boolean
wasNull
-
Constructor Summary
Constructors Constructor Description ImportAbstract()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
close()
closes the resultsetstatic java.lang.Object
destringifyObject(java.lang.String raw)
Read an object which was serialized to a string using StringUtil(package private) void
doAllTheWork()
Does all the workjava.sql.Blob
getBlob(int columnIndex)
Returnsjava.sql.Blob
type 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.Clob
getClob(int columnIndex)
Returnsjava.sql.Clob
type object that contains the column data from the import file.int
getCurrentLineNumber()
gets the current line number(package private) abstract ImportReadData
getImportReadData()
java.sql.ResultSetMetaData
getMetaData()
Gets the resultset meta datajava.lang.Object
getObject(int columnIndex)
Returns Object that contains the column data from the import file.int
getRow()
gets the next rowjava.lang.String
getString(int columnIndex)
java.sql.SQLException
importError(java.lang.Exception ex)
Close the stream and wrap exception in a SQLExceptionprivate 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.(package private) void
loadColumnNames()
boolean
next()
static java.lang.Object
readObject(byte[] bytes)
Read a serializable from a set of bytes.boolean
wasNull()
-
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.Exception
Does 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:
getMetaData
in interfacejava.sql.ResultSet
- Overrides:
getMetaData
in classVTITemplate
- Throws:
java.sql.SQLException
- if there is an error
-
getRow
public int getRow() throws java.sql.SQLException
gets the next row- Specified by:
getRow
in interfacejava.sql.ResultSet
- Overrides:
getRow
in 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.SQLException
closes the resultset- Throws:
java.sql.SQLException
- if there is an error
-
wasNull
public boolean wasNull()
- Specified by:
wasNull
in interfacejava.sql.ResultSet
- Overrides:
wasNull
in classVTITemplate
-
getString
public java.lang.String getString(int columnIndex) throws java.sql.SQLException
- Specified by:
getString
in interfacejava.sql.ResultSet
- Overrides:
getString
in classVTITemplate
- Throws:
java.sql.SQLException
- if there is an error
-
getClob
public java.sql.Clob getClob(int columnIndex) throws java.sql.SQLException
Returnsjava.sql.Clob
type object that contains the column data from the import file.- Specified by:
getClob
in interfacejava.sql.ResultSet
- Overrides:
getClob
in 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.SQLException
Returnsjava.sql.Blob
type object that contains the column data from the import file.- Specified by:
getBlob
in interfacejava.sql.ResultSet
- Overrides:
getBlob
in 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.SQLException
Returns Object that contains the column data from the import file.- Specified by:
getObject
in interfacejava.sql.ResultSet
- Overrides:
getObject
in 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.Exception
Read 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.Exception
Read an object which was serialized to a string using StringUtil- Throws:
java.lang.Exception
-
getBytes
public byte[] getBytes(int columnIndex) throws java.sql.SQLException
Returns byte array that contains the column data from the import file.- Specified by:
getBytes
in interfacejava.sql.ResultSet
- Overrides:
getBytes
in 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
-
-