Commit 6b30eed2 authored by Manuel Grizonnet's avatar Manuel Grizonnet

WRG: fix few warnings related to ogr transactions

parent 236ba713
......@@ -213,7 +213,14 @@ private:
goesOn2 = feature2.addr() != 0;
count++;
}
layer2.ogr().CommitTransaction();
const OGRErr err = layer2.ogr().CommitTransaction();
if (err != OGRERR_NONE)
{
itkExceptionMacro(<< "Unable to commit transaction for OGR layer " << layer2.ogr().GetName() << ".");
}
source2->SyncToDisk();
clock_t toc = clock();
......
......@@ -335,7 +335,12 @@ private:
firstFeature=nextFeature;
}
layer.ogr().CommitTransaction();
const OGRErr err = layer.ogr().CommitTransaction();
if (err != OGRERR_NONE)
{
itkExceptionMacro(<< "Unable to commit transaction for OGR layer " << layer.ogr().GetName() << ".");
}
if(extension==".shp"){
sqloss.str("");
......
......@@ -173,7 +173,14 @@ PersistentImageToOGRDataFilter<TImage>
//Copy features contained in the memory layer (srcLayer) in the output layer
itk::TimeProbe chrono;
chrono.Start();
dstLayer.ogr().StartTransaction();
OGRErr err = dstLayer.ogr().StartTransaction();
if (err != OGRERR_NONE)
{
itkExceptionMacro(<< "Unable to start transaction for OGR layer " << dstLayer.ogr().GetName() << ".");
}
OGRLayerType::const_iterator featIt = srcLayer.begin();
for(; featIt!=srcLayer.end(); ++featIt)
{
......@@ -182,10 +189,15 @@ PersistentImageToOGRDataFilter<TImage>
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() << ".");
}
chrono.Stop();
otbMsgDebugMacro(<< "write ogr tile took " << chrono.GetTotal() << " sec");
}
template<class TImage>
......
......@@ -144,16 +144,29 @@ PersistentImageToOGRLayerFilter<TImage>
//Copy features contained in the memory layer (srcLayer) in the output layer
itk::TimeProbe chrono;
chrono.Start();
m_OGRLayer.ogr().StartTransaction();
OGRErr err = m_OGRLayer.ogr().StartTransaction();
if (err != OGRERR_NONE)
{
itkExceptionMacro(<< "Unable to start transaction for OGR layer " << m_OGRLayer.ogr().GetName() << ".");
}
OGRLayerType::const_iterator featIt = srcLayer.begin();
for(; featIt!=srcLayer.end(); ++featIt)
{
OGRFeatureType dstFeature(m_OGRLayer.GetLayerDefn());
dstFeature.SetFrom( *featIt, TRUE );
m_OGRLayer.CreateFeature( dstFeature );
}
{
OGRFeatureType dstFeature(m_OGRLayer.GetLayerDefn());
dstFeature.SetFrom( *featIt, TRUE );
m_OGRLayer.CreateFeature( dstFeature );
}
err = m_OGRLayer.ogr().CommitTransaction();
if (err != OGRERR_NONE)
{
itkExceptionMacro(<< "Unable to commit transaction for OGR layer " << m_OGRLayer.ogr().GetName() << ".");
}
m_OGRLayer.ogr().CommitTransaction();
chrono.Stop();
otbMsgDebugMacro(<< "write ogr tile took " << chrono.GetTotal() << " sec");
......
......@@ -127,7 +127,13 @@ OGRLayerStreamStitchingFilter<TInputImage>
for(unsigned int x=1; x<=nbColStream; x++)
{
m_OGRLayer.ogr().StartTransaction();
OGRErr errStart = m_OGRLayer.ogr().StartTransaction();
if (errStart != OGRERR_NONE)
{
itkExceptionMacro(<< "Unable to start transaction for OGR layer " << m_OGRLayer.ogr().GetName() << ".");
}
for(unsigned int y=1; y<=nbRowStream; y++)
{
......@@ -351,11 +357,19 @@ OGRLayerStreamStitchingFilter<TInputImage>
progress.CompletedPixel();
} //end for x
m_OGRLayer.ogr().CommitTransaction();
OGRErr errCommitX = m_OGRLayer.ogr().CommitTransaction();
if (errCommitX != OGRERR_NONE)
{
itkExceptionMacro(<< "Unable to commit transaction for OGR layer " << m_OGRLayer.ogr().GetName() << ".");
}
} //end for y
m_OGRLayer.ogr().CommitTransaction();
const OGRErr errCommitY = m_OGRLayer.ogr().CommitTransaction();
if (errCommitY != OGRERR_NONE)
{
itkExceptionMacro(<< "Unable to commit transaction for OGR layer " << m_OGRLayer.ogr().GetName() << ".");
}
}
......
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