Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Try to reopen broken postgres connection
  • Loading branch information
mhugent committed Aug 3, 2011
1 parent 9db4f98 commit 684398e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/providers/postgres/qgspostgresprovider.cpp
Expand Up @@ -439,9 +439,14 @@ bool QgsPostgresProvider::declareCursor(

if ( !connectionRO->openCursor( cursorName, query ) )
{
// reloading the fields might help next time around
rewind();
return false;
//try to re-etablish broken connection
::PQreset( connectionRO->pgConnection() );
if ( !connectionRO->openCursor( cursorName, query ) )
{
// reloading the fields might help next time around
rewind();
return false;
}
}
}
catch ( PGFieldNotFound )
Expand Down

0 comments on commit 684398e

Please sign in to comment.