Skip to content

Commit

Permalink
use PQconnectionNeedsPassword only with PostgreSQL>=8.3
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9789 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Dec 13, 2008
1 parent 9b07359 commit d478ff2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/app/qgsdbsourceselect.cpp
Expand Up @@ -38,6 +38,8 @@ email : sherman at mrcc.com
#include <cassert>
#include <iostream>

#include <pg_config.h>

QgsDbSourceSelect::QgsDbSourceSelect( QWidget *parent, Qt::WFlags fl )
: QDialog( parent, fl ), mColumnTypeThread( NULL ), pd( 0 )
{
Expand Down Expand Up @@ -386,8 +388,13 @@ void QgsDbSourceSelect::on_btnConnect_clicked()

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;
Expand Down

0 comments on commit d478ff2

Please sign in to comment.