mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
Fix for ticket #406 (problems with copying selected attributes from a postgres
layer). Has the side-effect of eliminating the postgresql server 'no transaction in progress warnings'. git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@6171 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
6e8f5d9b98
commit
453b88f955
@ -443,7 +443,8 @@ QgsFeature *QgsPostgresProvider::getNextFeature(bool fetchAttributes)
|
||||
// std::cerr << "Error: " << PQerrorMessage(connection) << std::endl;
|
||||
// std::cerr << "Fetched " << PQntuples(queryResult) << "rows" << std::endl;
|
||||
if(PQntuples(queryResult) == 0){
|
||||
PQexec(connection, "end work");
|
||||
if (ready)
|
||||
PQexec(connection, "end work");
|
||||
ready = false;
|
||||
return 0;
|
||||
}
|
||||
@ -525,7 +526,8 @@ QgsFeature* QgsPostgresProvider::getNextFeature(std::list<int> const & attlist,
|
||||
if (rows == 0)
|
||||
{
|
||||
QgsDebugMsg("End of features.");
|
||||
PQexec(connection, "end work");
|
||||
if (ready)
|
||||
PQexec(connection, "end work");
|
||||
ready = false;
|
||||
return 0;
|
||||
}
|
||||
@ -644,6 +646,7 @@ void QgsPostgresProvider::select(QgsRect * rect, bool useIntersect)
|
||||
PQexec(connection, "end work");
|
||||
}
|
||||
PQexec(connection,"begin work");
|
||||
ready = true;
|
||||
PQexec(connection, (const char *)(declare.utf8()));
|
||||
|
||||
// TODO - see if this deallocates member features
|
||||
@ -791,7 +794,10 @@ void QgsPostgresProvider::getFeatureGeometry(int key, QgsFeature *f)
|
||||
|
||||
QgsDebugMsg("QgsPostgresProvider::getFeatureGeometry using: " + cursor);
|
||||
|
||||
if (ready)
|
||||
PQexec(connection, "end work");
|
||||
PQexec(connection, "begin work");
|
||||
ready = true;
|
||||
PQexec(connection, (const char *)(cursor.utf8()));
|
||||
|
||||
QString fetch = "fetch forward 1 from qgisf";
|
||||
@ -801,6 +807,7 @@ void QgsPostgresProvider::getFeatureGeometry(int key, QgsFeature *f)
|
||||
{
|
||||
// Nothing found - therefore nothing to change
|
||||
PQexec(connection,"end work");
|
||||
ready = false;
|
||||
PQclear(geomResult);
|
||||
return;
|
||||
}
|
||||
@ -822,8 +829,9 @@ void QgsPostgresProvider::getFeatureGeometry(int key, QgsFeature *f)
|
||||
|
||||
PQclear(geomResult);
|
||||
|
||||
PQexec(connection,"end work");
|
||||
|
||||
if (ready)
|
||||
PQexec(connection,"end work");
|
||||
ready = false;
|
||||
}
|
||||
|
||||
|
||||
@ -848,16 +856,17 @@ void QgsPostgresProvider::reset()
|
||||
QgsDebugMsg("Setting up binary cursor: " + declare);
|
||||
|
||||
// set up the cursor
|
||||
PQexec(connection,"end work");
|
||||
if (ready)
|
||||
PQexec(connection,"end work");
|
||||
|
||||
PQexec(connection,"begin work");
|
||||
ready = true;
|
||||
PQexec(connection, (const char *)(declare.utf8()));
|
||||
//QgsDebugMsg("Error: " + PQerrorMessage(connection));
|
||||
|
||||
// TODO - see if this deallocates member features
|
||||
mFeatureQueue.empty();
|
||||
|
||||
ready = true;
|
||||
}
|
||||
/* QString QgsPostgresProvider::getFieldTypeName(PGconn * pd, int oid)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user