id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc 5278,mbtiles - MBTilesGetBandCount - second SELECT Query never called when needed,mj10777,warmerdam,"In mbtilesdataset.cpp Function: MBTilesGetBandCount a second SELECT Query should be called when the first Query brings no results. Condition for this is 'if (hSQLLyr == NULL)' - when the first Query fails, hSQLLyr is not set to NULL and therefore never NULL {{{ if (fpCURLOGR) { if (nBands != -1) { // ... when hSQLLyr is no longer needed, set to NULL } else { if (CPLGetLastErrorType() == CE_Failure) { hSQLLyr = NULL; // this is needed, the message is not CPLError(CE_Failure, CPLGetLastErrorNo(), ""%s"", ... } } } else { hSQLLyr = OGR_DS_ExecuteSQL(hDS, pszSQL, NULL, NULL); // the following is needed if (CPLGetLastErrorType() == CE_Failure) { hSQLLyr = NULL; } } if (hSQLLyr == NULL) { // this will now be called pszSQL = CPLSPrintf(""SELECT tile_data FROM tiles WHERE zoom_level = %d LIMIT 1"", nMaxLevel); ... } }}} This is needed for mbtiles files, where the zooms levels have not been completely filled. This, otherwise correct, mbtiles file will fail: {{{ gdalinfo /vsicurl/http://www.mj10777.de/public/download/mbtiles/1867.Berlin_Liebenow.mbtiles }}} With the above correction, it will show correctly. Mark Johnson, Berlin Germany ",defect,closed,high,1.10.2,GDAL_Raster,,critical,fixed,mbtiles,