Skip to content

Commit 55a4530

Browse files
author
jef
committed
pass password on to geometry type detection thread
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@12795 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 886e591 commit 55a4530

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

src/app/postgres/qgspgsourceselect.cpp

+11-8
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ QString QgsPgSourceSelect::layerURI( const QModelIndex &index )
321321
}
322322
}
323323

324-
QString uri = m_connectionInfo;
324+
QString uri = m_connInfo;
325325

326326
if ( !pkColumnName.isEmpty() )
327327
{
@@ -400,13 +400,15 @@ void QgsPgSourceSelect::on_btnConnect_clicked()
400400

401401
QgsDebugMsg( "Connection info: " + uri.connectionInfo() );
402402

403-
m_connectionInfo = uri.connectionInfo();
404-
//qDebug(m_connectionInfo);
403+
m_connInfo = uri.connectionInfo();
404+
405405
// Tidy up an existing connection if one exists.
406406
if ( pd != 0 )
407407
PQfinish( pd );
408408

409-
pd = PQconnectdb( uri.connectionInfo().toLocal8Bit() ); // use what is set based on locale; after connecting, use Utf8
409+
m_privConnInfo = m_connInfo;
410+
411+
pd = PQconnectdb( m_privConnInfo.toLocal8Bit() ); // use what is set based on locale; after connecting, use Utf8
410412
// check the connection status
411413
if ( PQstatus( pd ) != CONNECTION_OK && QString::fromUtf8( PQerrorMessage( pd ) ) == PQnoPasswordSupplied )
412414
{
@@ -419,7 +421,7 @@ void QgsPgSourceSelect::on_btnConnect_clicked()
419421
tr( "Enter password" ),
420422
tr( "Error: %1Enter password for %2" )
421423
.arg( QString::fromUtf8( PQerrorMessage( pd ) ) )
422-
.arg( uri.connectionInfo() ),
424+
.arg( m_connInfo ),
423425
QLineEdit::Password,
424426
password,
425427
&ok );
@@ -429,7 +431,8 @@ void QgsPgSourceSelect::on_btnConnect_clicked()
429431
if ( !ok )
430432
break;
431433

432-
pd = PQconnectdb( QString( "%1 password='%2'" ).arg( uri.connectionInfo() ).arg( password ).toLocal8Bit() );
434+
m_privConnInfo = QString( "%1 password='%2'" ).arg( m_connInfo ).arg( password );
435+
pd = PQconnectdb( m_privConnInfo.toLocal8Bit() );
433436
}
434437
}
435438

@@ -497,7 +500,7 @@ QStringList QgsPgSourceSelect::selectedTables()
497500

498501
QString QgsPgSourceSelect::connectionInfo()
499502
{
500-
return m_connectionInfo;
503+
return m_connInfo;
501504
}
502505

503506
void QgsPgSourceSelect::setSql( const QModelIndex &index )
@@ -533,7 +536,7 @@ void QgsPgSourceSelect::addSearchGeometryColumn( const QString &schema, const QS
533536
if ( mColumnTypeThread == NULL )
534537
{
535538
mColumnTypeThread = new QgsGeomColumnTypeThread();
536-
mColumnTypeThread->setConnInfo( m_connectionInfo );
539+
mColumnTypeThread->setConnInfo( m_privConnInfo );
537540
}
538541
mColumnTypeThread->addGeometryColumn( schema, table, column );
539542
}

src/app/postgres/qgspgsourceselect.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ class QgsPgSourceSelect : public QDialog, private Ui::QgsPgSourceSelectBase
175175
QStringList mColumnLabels;
176176
// Our thread for doing long running queries
177177
QgsGeomColumnTypeThread* mColumnTypeThread;
178-
QString m_connectionInfo;
178+
QString m_connInfo;
179+
QString m_privConnInfo;
179180
QStringList m_selectedTables;
180181
// Storage for the range of layer type icons
181182
QMap<QString, QPair<QString, QIcon> > mLayerIcons;

0 commit comments

Comments
 (0)