public List < SourceCount > getSources ( ) { final SQLiteDatabase db = getDb ( ) ; List < SourceCount > ret = new ArrayList <> ( ) ; if ( db == null ) { return ret ; } Cursor cur = null ; try { cur = db . rawQuery ( "select " + COLUMN_PROVIDER + ",count(*) " + ",min(length(" + COLUMN_TILE + ")) " + ",max(length(" + COLUMN_TILE + ")) " + ",sum(length(" + COLUMN_TILE + ")) " + "from " + TABLE + " " + "group by " + COLUMN_PROVIDER , null ) ; while ( cur . moveToNext ( ) ) { final SourceCount c = new SourceCount ( ) ; c . source = cur . getString ( 0 ) ; c . rowCount = cur . getLong ( 1 ) ; c . sizeMin = cur . getLong ( 2 ) ; c . sizeMax = cur . getLong ( 3 ) ; c . sizeTotal = cur . getLong ( 4 ) ; c . sizeAvg = c . sizeTotal / c . rowCount ; ret . add ( c ) ; } } catch ( Exception e ) { catchException ( e ) ; } finally { if ( cur != null ) { cur . close ( ) ; } } return ret ; }
gets all the tiles sources that we have tiles for in the cache database and their counts