[QGIS Commit] r14844 -
branches/threading-branch/src/providers/postgres
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Sun Dec 5 15:38:44 EST 2010
Author: wonder
Date: 2010-12-05 12:38:44 -0800 (Sun, 05 Dec 2010)
New Revision: 14844
Modified:
branches/threading-branch/src/providers/postgres/qgspostgresprovider.cpp
Log:
Fixed postgres provider - but had to disable sharing of database connections.
A better (though slightly more complex) solution would be usage of connection pool.
Modified: branches/threading-branch/src/providers/postgres/qgspostgresprovider.cpp
===================================================================
--- branches/threading-branch/src/providers/postgres/qgspostgresprovider.cpp 2010-12-05 20:00:30 UTC (rev 14843)
+++ branches/threading-branch/src/providers/postgres/qgspostgresprovider.cpp 2010-12-05 20:38:44 UTC (rev 14844)
@@ -281,7 +281,13 @@
return NULL;
}
- connections.insert( conninfo, conn );
+ // do not insert the newly created connection to the list of shared connections
+ // because they can't be used together with threading: if one thread calls SendQuery
+ // when iterating over the layer, no other SendQuery shall be issued for another
+ // layer. A solution would be to have a pool of connections: when a connection
+ // is used, it is temporarily removed from the pool, when finished it returns back.
+ // If there are no unused connections, new connection would be started. [MD]
+ //connections.insert( conninfo, conn );
/* Check to see if we have GEOS support and if not, warn the user about
the problems they will see :) */
@@ -328,6 +334,7 @@
void QgsPostgresProvider::Conn::disconnect( QMap<QString, Conn *>& connections, Conn *&conn )
{
+ /*
QMap<QString, Conn *>::iterator i;
for ( i = connections.begin(); i != connections.end() && i.value() != conn; i++ )
;
@@ -341,7 +348,9 @@
delete i.value();
connections.remove( i.key() );
}
+ */
+ delete conn;
conn = NULL;
}
@@ -3159,10 +3168,11 @@
void QgsPostgresProvider::showMessageBox( const QString& title, const QString& text )
{
- QgsMessageOutput* message = QgsMessageOutput::createMessageOutput();
+ QgsDebugMsg("ERROR:"+text);
+/* QgsMessageOutput* message = QgsMessageOutput::createMessageOutput();
message->setTitle( title );
message->setMessage( text, QgsMessageOutput::MessageText );
- message->showMessage();
+ message->showMessage();*/
}
void QgsPostgresProvider::showMessageBox( const QString& title, const QStringList& text )
More information about the QGIS-commit
mailing list