public SortedMap < String , Catalog > getCatalogs ( ) throws SQLException { synchronized ( getCatalogsLock ) { if ( getCatalogsCache == null ) { SortedMap < String , Catalog > newCatalogs = new TreeMap <> ( englishCollator ) ; try ( ResultSet results = metaData . getCatalogs ( ) ) { while ( results . next ( ) ) { Catalog newCatalog = new Catalog ( this , results . getString ( 1 ) ) ; if ( newCatalogs . put ( newCatalog . getName ( ) , newCatalog ) != null ) throw new AssertionError ( "Duplicate catalog: " + newCatalog ) ; } } getCatalogsCache = AoCollections . optimalUnmodifiableSortedMap ( newCatalogs ) ; } return getCatalogsCache ; } }
Gets all catalogs for this database keyed by unique name .