Skip to content

Commit 0bd13f0

Browse files
author
jef
committed
use PQconnectionNeedsPassword only with PostgreSQL>=8.3
git-svn-id: http://svn.osgeo.org/qgis/trunk@9789 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent f8ab8b1 commit 0bd13f0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/app/qgsdbsourceselect.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ email : sherman at mrcc.com
3838
#include <cassert>
3939
#include <iostream>
4040

41+
#include <pg_config.h>
42+
4143
QgsDbSourceSelect::QgsDbSourceSelect( QWidget *parent, Qt::WFlags fl )
4244
: QDialog( parent, fl ), mColumnTypeThread( NULL ), pd( 0 )
4345
{
@@ -386,8 +388,13 @@ void QgsDbSourceSelect::on_btnConnect_clicked()
386388

387389
pd = PQconnectdb( m_connectionInfo.toLocal8Bit() ); // use what is set based on locale; after connecting, use Utf8
388390

391+
#if defined(PG_VERSION_NUM) && PG_VERSION_NUM >= 80300
389392
// if the connection needs a password ask for one
390393
if ( PQstatus( pd ) == CONNECTION_BAD && PQconnectionNeedsPassword( pd ) )
394+
#else
395+
// if the connection failed and we didn't have a password, ask for one and retry
396+
if ( PQstatus( pd ) == CONNECTION_BAD && password.isEmpty() )
397+
#endif
391398
{
392399
// get password from user
393400
bool makeConnection = false;

0 commit comments

Comments
 (0)