public SortedMap < String , Column > getColumnMap ( ) throws SQLException { synchronized ( getColumnMapLock ) { if ( getColumnMapCache == null ) { SortedMap < String , Column > newColumnMap = new TreeMap <> ( DatabaseMetaData . getCollator ( ) ) ; try ( ResultSet results = schema . getCatalog ( ) . getMetaData ( ) . getMetaData ( ) . getColumns ( schema . getCatalog ( ) . getName ( ) , schema . getName ( ) , name , null ) ) { while ( results . next ( ) ) { Column newColumn = new Column ( this , results . getString ( "COLUMN_NAME" ) , results . getInt ( "DATA_TYPE" ) , results . getString ( "TYPE_NAME" ) , getInteger ( results , "COLUMN_SIZE" ) , getInteger ( results , "DECIMAL_DIGITS" ) , results . getInt ( "NULLABLE" ) , results . getString ( "COLUMN_DEF" ) , getInteger ( results , "CHAR_OCTET_LENGTH" ) , results . getInt ( "ORDINAL_POSITION" ) , results . getString ( "IS_NULLABLE" ) , results . getString ( "IS_AUTOINCREMENT" ) ) ; if ( newColumnMap . put ( newColumn . getName ( ) , newColumn ) != null ) throw new AssertionError ( "Duplicate column: " + newColumn ) ; } } getColumnMapCache = AoCollections . optimalUnmodifiableSortedMap ( newColumnMap ) ; } return getColumnMapCache ; } }
Gets all columns for this schema keyed by unique name .