Class ColumnInfo

java.lang.Object
org.apache.derby.impl.load.ColumnInfo

class ColumnInfo extends Object
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 Details

    • vtiColumnNames

      private ArrayList<String> vtiColumnNames
    • insertColumnNames

      private ArrayList<String> insertColumnNames
    • columnTypes

      private ArrayList<String> columnTypes
    • jdbcColumnTypes

      private ArrayList<Integer> jdbcColumnTypes
    • noOfColumns

      private int noOfColumns
    • columnPositions

      private ArrayList columnPositions
    • createolumnNames

      private boolean createolumnNames
    • expectedNumberOfCols

      private int expectedNumberOfCols
    • conn

      private Connection conn
    • tableName

      private String tableName
    • schemaName

      private String schemaName
    • headerColumnNames

      private String[] headerColumnNames
    • udtClassNames

      private HashMap<String,String> 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 queries
      sName - - table's schema
      tName - - table Name
      insertColumnList - - comma seperared insert statement column list
      vtiColumnIndexes - - Indexes in the file
      vtiColumnPrefix - - Prefix to use to generate column names to select from VTI
      Throws:
      Exception - on error
      SQLException
  • Method Details

    • readHeaders

      private int readHeaders(String columnPattern) throws SQLException
      Throws:
      SQLException
    • initializeColumnInfo

      private boolean initializeColumnInfo(String columnPattern) throws SQLException
      Throws:
      SQLException
    • getUDTClassName

      private String getUDTClassName(DatabaseMetaData dmd, String sqlTypeName) throws SQLException
      Throws:
      SQLException
    • importExportSupportedType

      public static final boolean importExportSupportedType(int type)
    • getTypeOption

      private String getTypeOption(String type, int length, int precision, int scale)
    • getColumnTypeNames

      public String getColumnTypeNames() throws Exception
      Get the column type names.
      Throws:
      Exception
    • getUDTClassNames

      public String getUDTClassNames() throws Exception
      Get the class names of udt columns as a string.
      Throws:
      Exception
    • getColumnNamesWithCasts

      public String getColumnNamesWithCasts()
    • getInsertColumnNames

      public String getInsertColumnNames()
    • getExpectedNumberOfColumnsInFile

      public int getExpectedNumberOfColumnsInFile()
    • tableExists

      private boolean tableExists() throws SQLException
      Throws:
      SQLException
    • getExpectedVtiColumnTypesAsString

      public String getExpectedVtiColumnTypesAsString()
    • getExpectedVtiColumnTypes

      public static int[] getExpectedVtiColumnTypes(String columnTypesStr, int noOfColumns)
    • getExpectedColumnTypeNames

      public static String[] getExpectedColumnTypeNames(String columnTypeNamesString, int noOfColumns) throws Exception
      Throws:
      Exception
    • getExpectedUDTClasses

      public static HashMap getExpectedUDTClasses(String stringVersion) throws Exception
      Throws:
      Exception
    • deserializeHashMap

      public static HashMap deserializeHashMap(String stringVersion) throws Exception
      Throws:
      Exception