@@ -321,7 +321,7 @@ QString QgsPgSourceSelect::layerURI( const QModelIndex &index )
321
321
}
322
322
}
323
323
324
- QString uri = m_connectionInfo ;
324
+ QString uri = m_connInfo ;
325
325
326
326
if ( !pkColumnName.isEmpty () )
327
327
{
@@ -400,13 +400,15 @@ void QgsPgSourceSelect::on_btnConnect_clicked()
400
400
401
401
QgsDebugMsg ( " Connection info: " + uri.connectionInfo () );
402
402
403
- m_connectionInfo = uri.connectionInfo ();
404
- // qDebug(m_connectionInfo);
403
+ m_connInfo = uri.connectionInfo ();
404
+
405
405
// Tidy up an existing connection if one exists.
406
406
if ( pd != 0 )
407
407
PQfinish ( pd );
408
408
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
410
412
// check the connection status
411
413
if ( PQstatus ( pd ) != CONNECTION_OK && QString::fromUtf8 ( PQerrorMessage ( pd ) ) == PQnoPasswordSupplied )
412
414
{
@@ -419,7 +421,7 @@ void QgsPgSourceSelect::on_btnConnect_clicked()
419
421
tr ( " Enter password" ),
420
422
tr ( " Error: %1Enter password for %2" )
421
423
.arg ( QString::fromUtf8 ( PQerrorMessage ( pd ) ) )
422
- .arg ( uri. connectionInfo () ),
424
+ .arg ( m_connInfo ),
423
425
QLineEdit::Password,
424
426
password,
425
427
&ok );
@@ -429,7 +431,8 @@ void QgsPgSourceSelect::on_btnConnect_clicked()
429
431
if ( !ok )
430
432
break ;
431
433
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 () );
433
436
}
434
437
}
435
438
@@ -497,7 +500,7 @@ QStringList QgsPgSourceSelect::selectedTables()
497
500
498
501
QString QgsPgSourceSelect::connectionInfo ()
499
502
{
500
- return m_connectionInfo ;
503
+ return m_connInfo ;
501
504
}
502
505
503
506
void QgsPgSourceSelect::setSql ( const QModelIndex &index )
@@ -533,7 +536,7 @@ void QgsPgSourceSelect::addSearchGeometryColumn( const QString &schema, const QS
533
536
if ( mColumnTypeThread == NULL )
534
537
{
535
538
mColumnTypeThread = new QgsGeomColumnTypeThread ();
536
- mColumnTypeThread ->setConnInfo ( m_connectionInfo );
539
+ mColumnTypeThread ->setConnInfo ( m_privConnInfo );
537
540
}
538
541
mColumnTypeThread ->addGeometryColumn ( schema, table, column );
539
542
}
0 commit comments