Skip to content
Permalink
Browse files
use PQconnectionNeedsPassword only with PostgreSQL>=8.3
git-svn-id: http://svn.osgeo.org/qgis/trunk@9789 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Dec 13, 2008
1 parent f8ab8b1 commit 0bd13f0e33d77f73bfc28e1c7edd78d3a49f47d6
Showing with 7 additions and 0 deletions.
  1. +7 −0 src/app/qgsdbsourceselect.cpp
@@ -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 )
{
@@ -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;

0 comments on commit 0bd13f0

Please sign in to comment.