Skip to content
Permalink
Browse files

fix #3137

git-svn-id: http://svn.osgeo.org/qgis/trunk@15238 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Feb 21, 2011
1 parent 47fa1ce commit b642e8093dcd7effe9c4b1794b1f6b7b296966e9
Showing with 7 additions and 0 deletions.
  1. +7 −0 src/core/qgsvectorfilewriter.cpp
@@ -90,6 +90,7 @@ QgsVectorFileWriter::QgsVectorFileWriter(
vectorFileName += ".shp";
}

#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM < 1700
// check for unique fieldnames
QSet<QString> fieldNames;
QgsFieldMap::const_iterator fldIt;
@@ -105,6 +106,7 @@ QgsVectorFileWriter::QgsVectorFileWriter(
}
fieldNames << name;
}
#endif

deleteShapeFile( vectorFileName );
}
@@ -329,6 +331,7 @@ QgsVectorFileWriter::QgsVectorFileWriter(
int ogrIdx = OGR_FD_GetFieldIndex( defn, mCodec->fromUnicode( attrField.name() ) );
if ( ogrIdx < 0 )
{
#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM < 1700
// if we didn't find our new column, assume it's name was truncated and
// it was the last one added (like for shape files)
int fieldCount = OGR_FD_GetFieldCount( defn );
@@ -343,6 +346,10 @@ QgsVectorFileWriter::QgsVectorFileWriter(
ogrIdx = fieldCount - 1;
}
}
#else
// GDAL 1.7 not just truncates, but launders more aggressivly.
ogrIdx = OGR_FD_GetFieldCount( defn ) - 1;
#endif

if ( ogrIdx < 0 )
{

0 comments on commit b642e80

Please sign in to comment.
You can’t perform that action at this time.