Making improvement in reading: trying to identify cache block numbers
Ensure tiles are fetched in asceding pixel order. Minor bug fixed, when calculating pixel and line from tiles upperleft corner. Line length adjusted to 80 characters.
It should work, but I'm getting segmentation fault. No cache yet.
gdalinfo works. But I think I'm in a dead-end. The in-memory datasets must have something that identifies them. And we should check for existing in-memory datasets before raising the query. So far, so good. Now the problem: the datasets may come from overview tables. And they'd have the same reference (upper left corner) than the datasets from non-overview tables
Clean start again. Just try to fetch blocks from cache in band. If not found, raise a query. Then, execute RasterIO over the VRT band. Missing part: copy ALL the cache blocks from VRT band to PostGIS Raster band after finishing. Hard part is to create a query based on just the missing blocks
Block size is now calculated in the band constructor. Dataset has nothing to say about it. Apart from that, I found a big problem: the cached data is in the MEM datasets, not in the VRT. We must use all the cache blocks of the MEM objects. I didn't figure out how to do it yet
LOTS of changes. The approach now is to inherit from VRT driver. Currently, the dataset is properly opened, and all the tiles are read as tiledatasets. Next steps will be to use a CPLQuadTree to allow in-memory intersections and the IRasterIO part (big challenge)
All the st_ calls to fetch dataset metadata replaced by one call: st_metadata. It's 8 times faster, because you just need to detoast postgresql data one time. The tokenize operation is made in memory using CLSTokenike2 function.
Cleaning and ordering things
Now all the sources are created and their limits correctly set
Added QuadTree support. There is a Segmentation Fault in the PostGISRasterDataset destructor call. Need to test it.
Added missing files
Avoid looking for overviews in each band creation. They're previously calculated. Still a segmentation fault during dataset deletion
Added some basic structure in PostGISRasterRasterBand::IRasterIO. Still needs to get rid of the rest
Fixed bug in SetRasterProperties (you can't check the raster_columns view if a 'where' clause is specified). Implemented simplest case of reading: when the result is only 1 tile, you don't need to read from sources, just call IReadBlock
Checked one more possible error case in SetRasterProperties. Deleted some commented code.
Whooops. Missing semi-colon added.
Basic structure of PostGISRasterRasterBand::IRasterIO. GetOverview had a bug. Corrected.
More stuff in PostGISRasterRasterBand::IRasterIO method. The improvement when the number of tiles is 1 it not working. Commented.
Some security changes.