id summary reporter owner description type status priority milestone component version severity resolution keywords cc 3044 create index sql execute problem yminpark warmerdam "Hello. I am using GDAL 1.6.1 and I think I met a bug about sql command(""create index""). I want to create attribute index on a shapefile in VS2005, so I programmed as follows : -------------------------- ''OGRDataSource* dataSource = _dataSources[index];''[[BR]] ''OGRLayer *resultSet = NULL;''[[BR]] ''string sql;''[[BR]] ''_fileNames[index] = ""LP_PA_CBND"" // shapefile name''[[BR]] ''_indexFields[index] = ""JIBUN"" // field in LP_PA_CBND.dbf''[[BR]] ''sql = ""CREATE INDEX ON "" + _fileNames[index] + "" USING "" + _indexFields[index];''[[BR]] ''resultSet = dataSource->ExecuteSQL(sql.c_str(), NULL, NULL);''[[BR]] ''if (resultSet != NULL) dataSource->ReleaseResultSet(resultSet)''[[BR]] -------------------------- SQL seems to be executed successfully - After executing the SQL, LP_PA_CBND.ind & LP_PA_CBND.idm is created. But OGR produced errors, too. -------------------------- ''ERROR 3: Invalid number of indexes (0) in file C:\GMSIIS\Data\Spatial\22\LP_PA_CBND.ind'' [[BR]] ''ERROR 4: Failed to open index file C:\GMSIIS\Data\Spatial\22\LP_PA_CBND.ind.'' [[BR]] -------------------------- So, I tested above SQL using ogr2ogr command again. Then, no error has occurred and index file is generated in valid. -------------------------- ''ogr2ogr -sql ""create index on lp_pa_cbnd using jibun"" -f ""ESRI Shapefile"" blahblah LP_PA_CBND.shp'' [[BR]] -------------------------- I examined LP_PA_CBND.ind file with hexa viewer, then I found some difference. (please see the attached image.) '''ogr2ogr : 00 02 00 00 00 1A 00 04 0F (in 000030h)'''[[BR]] '''ExecuteSQL() : 00 00 00 00 00 00 00 00 00 (in 000030h)'''[[BR]] Using sql command in ogr2ogr is different with dataSource.ExecuteSQL()? Thank you for reading my poor english. Regards. " defect closed normal 1.6.2 default 1.6.1 normal invalid create, index, executeSQL