Top Description Fields Constructors Methods
org.apache.derby.impl.load

pack-priv Class ColumnInfo

extends Object
Class Inheritance
Imports
org.apache.derby.iapi.util.IdUtil, java.sql.ResultSet, .SQLException, .Connection, .DatabaseMetaData, .Types, java.util.*, org.apache.derby.iapi.jdbc.EngineConnection, org.apache.derby.shared.common.reference.SQLState, org.apache.derby.shared.common.error.StandardException, .PublicAPI

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

Modifier and TypeField and Description
private ArrayList<E>
private ArrayList<String>
private Connection
private boolean
private int
private String[]
private ArrayList<String>
private ArrayList<Integer>
private int
private String
private String
private HashMap<String, String>
private ArrayList<String>

Constructor Summary

AccessConstructor and Description
public
ColumnInfo(Connection
- connection to use for metadata queries
conn
,
String
- table's schema
sName
,
String
- table Name
tName
,
String
- comma seperared insert statement column list
insertColumnList
,
String
- Indexes in the file
vtiColumnIndexes
,
String
- Prefix to use to generate column names to select from VTI
vtiColumnPrefix
,
String[] headerColumnNames)

Initialize the column type and name information

Method Summary

Modifier and TypeMethod and Description
public static HashMap<K, V>
deserializeHashMap(String stringVersion)

public String
public String
getColumnTypeNames()

Get the column type names.

public static String[]
getExpectedColumnTypeNames(String columnTypeNamesString, int noOfColumns)

public int
public static HashMap<K, V>
public static int[]
getExpectedVtiColumnTypes(String columnTypesStr, int noOfColumns)

public String
public String
private String
getTypeOption(String type, int length, int precision, int scale)

private String
public String
getUDTClassNames()

Get the class names of udt columns as a string.

public static final boolean
private boolean
private int
readHeaders(String columnPattern)

private boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

columnPositionsback to summary
private ArrayList<E> columnPositions
columnTypesback to summary
private ArrayList<String> columnTypes
connback to summary
private Connection conn
createolumnNamesback to summary
private boolean createolumnNames
expectedNumberOfColsback to summary
private int expectedNumberOfCols
headerColumnNamesback to summary
private String[] headerColumnNames
insertColumnNamesback to summary
private ArrayList<String> insertColumnNames
jdbcColumnTypesback to summary
private ArrayList<Integer> jdbcColumnTypes
noOfColumnsback to summary
private int noOfColumns
schemaNameback to summary
private String schemaName
tableNameback to summary
private String tableName
udtClassNamesback to summary
private HashMap<String, String> udtClassNames
vtiColumnNamesback to summary
private ArrayList<String> vtiColumnNames

Constructor Detail

ColumnInfoback to summary
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

- connection to use for metadata queries

sName:String

- table's schema

tName:String

- table Name

insertColumnList:String

- comma seperared insert statement column list

vtiColumnIndexes:String

- Indexes in the file

vtiColumnPrefix:String

- Prefix to use to generate column names to select from VTI

Exceptions
Exception:
on error

Method Detail

deserializeHashMapback to summary
public static HashMap<K, V> deserializeHashMap(String stringVersion) throws Exception
getColumnNamesWithCastsback to summary
public String getColumnNamesWithCasts()
getColumnTypeNamesback to summary
public String getColumnTypeNames() throws Exception

Get the column type names.

getExpectedColumnTypeNamesback to summary
public static String[] getExpectedColumnTypeNames(String columnTypeNamesString, int noOfColumns) throws Exception
getExpectedNumberOfColumnsInFileback to summary
public int getExpectedNumberOfColumnsInFile()
getExpectedUDTClassesback to summary
public static HashMap<K, V> getExpectedUDTClasses(String stringVersion) throws Exception
getExpectedVtiColumnTypesback to summary
public static int[] getExpectedVtiColumnTypes(String columnTypesStr, int noOfColumns)
getExpectedVtiColumnTypesAsStringback to summary
public String getExpectedVtiColumnTypesAsString()
getInsertColumnNamesback to summary
public String getInsertColumnNames()
getTypeOptionback to summary
private String getTypeOption(String type, int length, int precision, int scale)
getUDTClassNameback to summary
private String getUDTClassName(DatabaseMetaData dmd, String sqlTypeName) throws SQLException
getUDTClassNamesback to summary
public String getUDTClassNames() throws Exception

Get the class names of udt columns as a string.

importExportSupportedTypeback to summary
public static final boolean importExportSupportedType(int type)
initializeColumnInfoback to summary
private boolean initializeColumnInfo(String columnPattern) throws SQLException
readHeadersback to summary
private int readHeaders(String columnPattern) throws SQLException
tableExistsback to summary
private boolean tableExists() throws SQLException