[gdal-dev] ogr2ogr fails on second call with sql select

Paul Higgins phigginsca at yahoo.com
Thu Sep 24 12:36:42 PDT 2020


I have created a dll of C++ GDAL functions callable from a REX (OOREXX). It has functions like  gdal_translate, gdalinfo, Rgb2Pct and a few others. 
Recently I got into using shapefiles so I added a ogr2ogr  function modeled on the C:\release-1911-gdal-2-4-1-mapserver-7-2-2-src\gdal\apps\ogr2ogr_bin.cpp  program
This new function works fine except if I make two calls that have a select statement in it like:
sql = "SELECT * FROM My_Points point" options = ' -f "ESRI Shapefile" -dialect sqlite -sql ""'sql'""' rc = ogr2ogr(input_file,output_file,options,0,diagmsgs)  -- <<  first call worksrc = ogr2ogr(input_file,output_file,options,0,diagmsgs)  -- << second call causes a crash

The first call works but the second call fails when the function calls  GDALVectorTranslate.  it never returns and the program crashes.  It doesn't matter what output driver I use or if the input_file and output_file are different.
Does anyone have any idea why the second call would fail or have an example of an ogr2ogr cpp program that works.
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20200924/0c60a20e/attachment.html>


More information about the gdal-dev mailing list