Package org.apache.derby.impl.load
Class ColumnInfo
java.lang.Object
org.apache.derby.impl.load.ColumnInfo
This class provides supportto create casting/conversions required to
perform import. Import VTI gives all the data in VARCHAR type becuase data
in the files is in CHAR format. There is no implicit cast availabile from
VARCHAR to some of the types. In cases where explicit casting is allowed,
columns are casted with explict cast to the type of table column; in case of
double/real explicit casting is also not allowd , scalar fuction DOUBLE is
used in those cases.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ArrayList
private Connection
private boolean
private int
private String[]
private int
private String
private String
-
Constructor Summary
ConstructorsConstructorDescriptionColumnInfo
(Connection conn, String sName, String tName, String insertColumnList, String vtiColumnIndexes, String vtiColumnPrefix, String[] headerColumnNames) Initialize the column type and name information -
Method Summary
Modifier and TypeMethodDescriptionstatic HashMap
deserializeHashMap
(String stringVersion) Get the column type names.static String[]
getExpectedColumnTypeNames
(String columnTypeNamesString, int noOfColumns) int
static HashMap
getExpectedUDTClasses
(String stringVersion) static int[]
getExpectedVtiColumnTypes
(String columnTypesStr, int noOfColumns) private String
getTypeOption
(String type, int length, int precision, int scale) private String
getUDTClassName
(DatabaseMetaData dmd, String sqlTypeName) Get the class names of udt columns as a string.static final boolean
importExportSupportedType
(int type) private boolean
initializeColumnInfo
(String columnPattern) private int
readHeaders
(String columnPattern) private boolean
-
Field Details
-
vtiColumnNames
-
insertColumnNames
-
columnTypes
-
jdbcColumnTypes
-
noOfColumns
private int noOfColumns -
columnPositions
-
createolumnNames
private boolean createolumnNames -
expectedNumberOfCols
private int expectedNumberOfCols -
conn
-
tableName
-
schemaName
-
headerColumnNames
-
udtClassNames
-
-
Constructor Details
-
ColumnInfo
public ColumnInfo(Connection conn, String sName, String tName, String insertColumnList, String vtiColumnIndexes, String vtiColumnPrefix, String[] headerColumnNames) throws SQLException Initialize the column type and name information- Parameters:
conn
- - connection to use for metadata queriessName
- - table's schematName
- - table NameinsertColumnList
- - comma seperared insert statement column listvtiColumnIndexes
- - Indexes in the filevtiColumnPrefix
- - Prefix to use to generate column names to select from VTI- Throws:
Exception
- on errorSQLException
-
-
Method Details
-
readHeaders
- Throws:
SQLException
-
initializeColumnInfo
- Throws:
SQLException
-
getUDTClassName
- Throws:
SQLException
-
importExportSupportedType
public static final boolean importExportSupportedType(int type) -
getTypeOption
-
getColumnTypeNames
Get the column type names.- Throws:
Exception
-
getUDTClassNames
Get the class names of udt columns as a string.- Throws:
Exception
-
getColumnNamesWithCasts
-
getInsertColumnNames
-
getExpectedNumberOfColumnsInFile
public int getExpectedNumberOfColumnsInFile() -
tableExists
- Throws:
SQLException
-
getExpectedVtiColumnTypesAsString
-
getExpectedVtiColumnTypes
-
getExpectedColumnTypeNames
public static String[] getExpectedColumnTypeNames(String columnTypeNamesString, int noOfColumns) throws Exception - Throws:
Exception
-
getExpectedUDTClasses
- Throws:
Exception
-
deserializeHashMap
- Throws:
Exception
-