[QGIS Commit] r9789 - trunk/qgis/src/app
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Sat Dec 13 17:30:08 EST 2008
Author: jef
Date: 2008-12-13 17:30:08 -0500 (Sat, 13 Dec 2008)
New Revision: 9789
Modified:
trunk/qgis/src/app/qgsdbsourceselect.cpp
Log:
use PQconnectionNeedsPassword only with PostgreSQL>=8.3
Modified: trunk/qgis/src/app/qgsdbsourceselect.cpp
===================================================================
--- trunk/qgis/src/app/qgsdbsourceselect.cpp 2008-12-13 20:55:26 UTC (rev 9788)
+++ trunk/qgis/src/app/qgsdbsourceselect.cpp 2008-12-13 22:30:08 UTC (rev 9789)
@@ -38,6 +38,8 @@
#include <cassert>
#include <iostream>
+#include <pg_config.h>
+
QgsDbSourceSelect::QgsDbSourceSelect( QWidget *parent, Qt::WFlags fl )
: QDialog( parent, fl ), mColumnTypeThread( NULL ), pd( 0 )
{
@@ -386,8 +388,13 @@
pd = PQconnectdb( m_connectionInfo.toLocal8Bit() ); // use what is set based on locale; after connecting, use Utf8
+#if defined(PG_VERSION_NUM) && PG_VERSION_NUM >= 80300
// if the connection needs a password ask for one
if ( PQstatus( pd ) == CONNECTION_BAD && PQconnectionNeedsPassword( pd ) )
+#else
+ // if the connection failed and we didn't have a password, ask for one and retry
+ if ( PQstatus( pd ) == CONNECTION_BAD && password.isEmpty() )
+#endif
{
// get password from user
bool makeConnection = false;
More information about the QGIS-commit
mailing list