Tom, yes you need to call ReleaseResultSet after every ExecuteSQL, otherwise you'll have memory leaks
Ideally you should have been able to call GetFID() after CreateFeature(), but this is currently not implemented in the postgresql driver. I have a patch to solve the issue, but it raises some potential backward compatibility issue, so I'd like hearing from other people before applying. Patch and potential issues discussed here : http://trac.osgeo.org/gdal/ticket/3744 Best regards, Even Le mercredi 08 septembre 2010 17:36:30, Tom van der Putte a écrit : > In reply to my own question, I've created something that works: > Layer tempLayer = ds2.ExecuteSQL("SELECT > currval(pg_get_serial_sequence('wells', 'well_id')) as seqval;", null, > null); > Feature seqFeat = tempLayer.GetNextFeature(); //always only 1 row in > the resultset, so no *while* > tempFID = seqFeat.GetFieldAsInteger("seqval"); > ds2.ReleaseResultSet(tempLayer); > Is it necessary to call ReleaseResultSet after every ExecuteSQL? Or > only after the last one? > Cheers, > Tom > On Wed 08/09/10 16:03 , Tom van der Putte [email protected] sent: > Hi All, > I'm adding several new features to a PostGIS table using OGR (in > C#). After each CreateFeature I'd like to somehow get the FID of the > created feature. Is there any possible way to do this? If not elegant, > any hack is also welcome :D > Cheers, > Tom _______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
