Commit 2ec2f938 authored by Rashad Kanavath's avatar Rashad Kanavath
Browse files

COMP: check return result from OGR *Transaction

parent a906d697
......@@ -129,7 +129,12 @@ int otbImageSampleExtractorFilterUpdate(int argc, char* argv[])
otb::ogr::Layer dstLayer = output->GetLayer(0);
OGRFieldDefn labelField(classFieldName.c_str(),OFTString);
dstLayer.CreateField(labelField, true);
dstLayer.ogr().StartTransaction();
OGRErr err = dstLayer.ogr().StartTransaction();
if (err != OGRERR_NONE) {
itkExceptionMacro(<< "Unable to start transaction for OGR layer " << dstLayer.ogr().GetName() << ".");
}
otb::ogr::Layer::const_iterator featIt = inLayer.begin();
for(; featIt!=inLayer.end(); ++featIt)
{
......@@ -137,7 +142,13 @@ int otbImageSampleExtractorFilterUpdate(int argc, char* argv[])
dstFeature.SetFrom( *featIt, TRUE );
dstLayer.CreateFeature( dstFeature );
}
dstLayer.ogr().CommitTransaction();
err = dstLayer.ogr().CommitTransaction();
if (err != OGRERR_NONE)
{
itkExceptionMacro(<< "Unable to commit transaction for OGR layer " << dstLayer.ogr().GetName() << ".");
}
output->Clear();
otb::ogr::DataSource::Pointer outputUpdate =
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment