[gdal-dev] Re: Questions about SQL cursors in GDAL driver

Jorge Arévalo jorge.arevalo at gmail.com
Fri Jul 10 13:30:29 EDT 2009


Answering myself...

2009/7/10 Jorge Arévalo <jorge.arevalo at gmail.com>:
> Hello,
>
> Context: GDAL WKTRaster Driver. When creating Dataset, I declare a
> cursor to read all the rows (tiles) of a table with a raster column
> (DECLARE cursor CURSOR FOR SELECT * FROM TABLE). The RasterBand should
> read one of the rows' band
>
> Question 1: The cursor is created during the Dataset creation, and
> stored in it. Should I start a transaction before? If yes, when should
> I close the cursor and end the transaction? When calling to Dataset's
> destructor?
Answer: Of course, I should create a transaction to declare a cursor
(stupid question). This question remains: when should I close the
cursor and end transaction?


> Question 2: What approach is better?
>     a) The Dataset fetchs all the rows (tiles) of the table just
> after declaring the cursor, and the RasterBand moves over the
> resultset using PQgetvalue and read one band of the read raster
>     b) The Dataset declare the cursor and the RasterBand fetchs the
> row that needs to read one of its bands
>
> Thanks in advance.
>
> Best regards
> Jorge
>


More information about the gdal-dev mailing list