Skip to content
Permalink
Browse files
Remove abbreviation of connectionInfo
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9502 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Oct 20, 2008
1 parent b352b85 commit dfca9702120190903e2b2df224ca3f450ca87e9a
@@ -20,7 +20,7 @@ public:
QgsDataSourceURI(QString uri);

//! connection info
QString connInfo() const;
QString connectionInfo() const;

//! complete uri
QString uri() const;
@@ -2308,17 +2308,17 @@ void QgisApp::addDatabaseLayer()

QApplication::setOverrideCursor( Qt::WaitCursor );

QString connInfo = dbs->connInfo();
QString connectionInfo = dbs->connectionInfo();
// for each selected table, connect to the database, parse the Wkt geometry,
// and build a canvasitem for it
// readWKB(connInfo,tables);
// readWKB(connectionInfo,tables);
QStringList::Iterator it = tables.begin();
while ( it != tables.end() )
{

// create the layer
//qWarning("creating layer");
QgsVectorLayer *layer = new QgsVectorLayer( connInfo + " table=" + *it, *it, "postgres" );
QgsVectorLayer *layer = new QgsVectorLayer( connectionInfo + " table=" + *it, *it, "postgres" );
if ( layer->isValid() )
{
// register this layer with the central layers registry
@@ -2371,7 +2371,7 @@ void QgisApp::addWmsLayer()
if ( wmss->exec() )
{

addRasterLayer( wmss->connInfo(),
addRasterLayer( wmss->connectionInfo(),
wmss->connName(),
"wms",
wmss->selectedLayers(),
@@ -386,17 +386,17 @@ void QgsDbSourceSelect::on_btnConnect_clicked()

// Need to escape the password to allow for single quotes and backslashes

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

if ( makeConnection )
{
m_connInfo = uri.connInfo();
//qDebug(m_connInfo);
m_connectionInfo = uri.connectionInfo();
//qDebug(m_connectionInfo);
// Tidy up an existing connection if one exists.
if ( pd != 0 )
PQfinish( pd );

pd = PQconnectdb( m_connInfo.toLocal8Bit() ); // use what is set based on locale; after connecting, use Utf8
pd = PQconnectdb( m_connectionInfo.toLocal8Bit() ); // use what is set based on locale; after connecting, use Utf8
if ( PQstatus( pd ) == CONNECTION_OK )
{
//qDebug("Connection succeeded");
@@ -458,9 +458,9 @@ QStringList QgsDbSourceSelect::selectedTables()
return m_selectedTables;
}

QString QgsDbSourceSelect::connInfo()
QString QgsDbSourceSelect::connectionInfo()
{
return m_connInfo;
return m_connectionInfo;
}

void QgsDbSourceSelect::setSql( const QModelIndex& index )
@@ -516,7 +516,7 @@ void QgsDbSourceSelect::addSearchGeometryColumn( const QString &schema, const QS
if ( mColumnTypeThread == NULL )
{
mColumnTypeThread = new QgsGeomColumnTypeThread();
mColumnTypeThread->setConnInfo( m_connInfo );
mColumnTypeThread->setConnInfo( m_connectionInfo );
}
mColumnTypeThread->addGeometryColumn( schema, table, column );
}
@@ -70,7 +70,7 @@ class QgsDbSourceSelect : public QDialog, private Ui::QgsDbSourceSelectBase
//! String list containing the selected tables
QStringList selectedTables();
//! Connection info (database, host, user, password)
QString connInfo();
QString connectionInfo();
// Store the selected database
void dbChanged();
// Utility function to construct the query for finding out the
@@ -133,7 +133,7 @@ class QgsDbSourceSelect : public QDialog, private Ui::QgsDbSourceSelectBase
QStringList mColumnLabels;
// Our thread for doing long running queries
QgsGeomColumnTypeThread* mColumnTypeThread;
QString m_connInfo;
QString m_connectionInfo;
QStringList m_selectedTables;
// Storage for the range of layer type icons
QMap<QString, QPair<QString, QIcon> > mLayerIcons;
@@ -110,9 +110,9 @@ void QgsNewConnection::testConnection()
QgsDataSourceURI uri;
uri.setConnection( txtHost->text(), txtPort->text(), txtDatabase->text(), txtUsername->text(), txtPassword->text() );

QgsLogger::debug( "PQconnectdb(" + uri.connInfo() + ");" );
QgsLogger::debug( "PQconnectdb(" + uri.connectionInfo() + ");" );

PGconn *pd = PQconnectdb( uri.connInfo().toLocal8Bit().data() );
PGconn *pd = PQconnectdb( uri.connectionInfo().toLocal8Bit().data() );
if ( PQstatus( pd ) == CONNECTION_OK )
{
// Database successfully opened; we can now issue SQL commands.
@@ -42,11 +42,11 @@ QgsPgQueryBuilder::QgsPgQueryBuilder( QgsDataSourceURI *uri,
setupGuiViews();
// The query builder must make its own connection to the database when
// using this constructor
QString connInfo = mUri->connInfo();
QString connectionInfo = mUri->connectionInfo();

QgsDebugMsg( "Attempting connect using: " + connInfo );
QgsDebugMsg( "Attempting connect using: " + connectionInfo );

mPgConnection = PQconnectdb( connInfo.toLocal8Bit().data() ); // use what is set based on locale; after connecting, use Utf8
mPgConnection = PQconnectdb( connectionInfo.toLocal8Bit().data() ); // use what is set based on locale; after connecting, use Utf8
// check the connection status
if ( PQstatus( mPgConnection ) == CONNECTION_OK )
{
@@ -319,9 +319,9 @@ void QgsServerSourceSelect::on_btnConnect_clicked()
connStringParts += settings.value( key + "/url" ).toString();

m_connName = cmbConnections->currentText();
m_connInfo = connStringParts.join( " " );
m_connectionInfo = connStringParts.join( " " );

QgsDebugMsg( QString( "Connection info: '%1'." ).arg( m_connInfo ) );
QgsDebugMsg( QString( "Connection info: '%1'." ).arg( m_connectionInfo ) );


// TODO: Create and bind to data provider
@@ -330,7 +330,7 @@ void QgsServerSourceSelect::on_btnConnect_clicked()
QgsProviderRegistry * pReg = QgsProviderRegistry::instance();

mWmsProvider =
( QgsWmsProvider* ) pReg->getProvider( "wms", m_connInfo );
( QgsWmsProvider* ) pReg->getProvider( "wms", m_connectionInfo );

if ( mWmsProvider )
{
@@ -528,9 +528,9 @@ QString QgsServerSourceSelect::connName()
return m_connName;
}

QString QgsServerSourceSelect::connInfo()
QString QgsServerSourceSelect::connectionInfo()
{
return m_connInfo;
return m_connectionInfo;
}

QStringList QgsServerSourceSelect::selectedLayers()
@@ -54,7 +54,7 @@ class QgsServerSourceSelect : public QDialog, private Ui::QgsServerSourceSelectB
QString connName();

//! Connection info (uri)
QString connInfo();
QString connectionInfo();

//! Connection Proxy Host
QString connProxyHost();
@@ -147,7 +147,7 @@ class QgsServerSourceSelect : public QDialog, private Ui::QgsServerSourceSelectB
QString m_connName;

//! URI for selected connection
QString m_connInfo;
QString m_connectionInfo;

//! Proxy Host for selected connection
QString m_connProxyHost;
@@ -269,36 +269,36 @@ QString QgsDataSourceURI::getValue( const QString &uri, int &i )
return pval;
}

QString QgsDataSourceURI::connInfo() const
QString QgsDataSourceURI::connectionInfo() const
{
QString connInfo = "dbname='" + mDatabase + "'";
QString connectionInfo = "dbname='" + mDatabase + "'";

if ( mHost != "" )
{
connInfo += " host=" + mHost;
connectionInfo += " host=" + mHost;
if ( mPort != "" )
connInfo += " port=" + mPort;
connectionInfo += " port=" + mPort;
}

if ( mUsername != "" )
{
connInfo += " user='" + mUsername + "'"; //needs to be escaped
connectionInfo += " user='" + mUsername + "'"; //needs to be escaped

if ( mPassword != "" )
{
QString p = mPassword;
p.replace( '\\', "\\\\" );
p.replace( '\'', "\\'" );
connInfo += " password='" + p + "'";
connectionInfo += " password='" + p + "'";
}
}

return connInfo;
return connectionInfo;
}

QString QgsDataSourceURI::uri() const
{
return connInfo()
return connectionInfo()
+ QString( " table=%1 (%2) sql=%3" )
.arg( quotedTablename() )
.arg( mGeometryColumn )
@@ -39,7 +39,7 @@ class CORE_EXPORT QgsDataSourceURI
QgsDataSourceURI( QString uri );

//! return connection part of URI
QString connInfo() const;
QString connectionInfo() const;

//! return complete uri
QString uri() const;
@@ -100,10 +100,10 @@ void QgsPgGeoprocessing::buffer()

QgsDataSourceURI uri( lyr->source() );

QgsDebugMsg( "data source = " + uri.connInfo() );
QgsDebugMsg( "data source = " + uri.connectionInfo() );

// connect to the database and check the capabilities
PGconn *capTest = PQconnectdb( uri.connInfo().toUtf8() );
PGconn *capTest = PQconnectdb( uri.connectionInfo().toUtf8() );
if ( PQstatus( capTest ) == CONNECTION_OK )
{
postgisVersion( capTest );
@@ -135,7 +135,7 @@ void QgsPgGeoprocessing::buffer()
}
}
// connect to the database
PGconn *conn = PQconnectdb( uri.connInfo().toUtf8() );
PGconn *conn = PQconnectdb( uri.connectionInfo().toUtf8() );
if ( PQstatus( conn ) == CONNECTION_OK )
{
// populate the schema drop-down
@@ -305,7 +305,7 @@ void QgsPgGeoprocessing::buffer()
if ( bb->addLayerToMap() )
{
// create the connection string
QString newLayerSource = uri.connInfo();
QString newLayerSource = uri.connectionInfo();
QgsDebugMsg( "newLayerSource: " + newLayerSource );

// add the schema.table and geometry column
@@ -2688,7 +2688,7 @@ void QgsGrassModuleGdalInput::updateQgisLayers()
{
// Construct OGR DSN
QgsDataSourceURI dsUri( provider->dataSourceUri() );
uri = "PG:" + dsUri.connInfo();
uri = "PG:" + dsUri.connectionInfo();

if ( dsUri.schema() != "" )
{
@@ -420,7 +420,7 @@ void QgsSpit::dbConnect()
settings.value( key + "/username" ).toString(),
password );

conn = PQconnectdb( uri.connInfo().toUtf8() );
conn = PQconnectdb( uri.connectionInfo().toUtf8() );
}

if ( conn == NULL || PQstatus( conn ) != CONNECTION_OK )
@@ -48,7 +48,7 @@ class QgsSpit : public QDialog, private Ui::QgsSpitBase
//! Return a list of selected tables
QStringList selectedTables();
//! Return the connection info
QString connInfo();
QString connectionInfo();
//! Create a new PostgreSQL connection
void newConnection();
//! Edit a PostgreSQL connection
@@ -47,7 +47,7 @@ QgsPostgresCountThread::~QgsPostgresCountThread()

void QgsPostgresCountThread::setConnInfo( QString s )
{
connInfo = s;
connectionInfo = s;
}

void QgsPostgresCountThread::setTableName( QString s )
@@ -74,12 +74,12 @@ void QgsPostgresCountThread::setGeometryColumn( QString s )
void QgsPostgresCountThread::run()
{
// // placeholders for now.
// QString connInfo;
// QString connectionInfo;

QgsDebugMsg( "QgsPostgresCountThread: Started running." );

// Open another connection to the database
PGconn *connection = PQconnectdb( connInfo.toUtf8() );
PGconn *connection = PQconnectdb( connectionInfo.toUtf8() );

// get the extents

@@ -92,7 +92,7 @@ class QgsPostgresCountThread : public QThread
/**
*
*/
QString connInfo;
QString connectionInfo;

/**
* Name of the table with no schema
@@ -50,7 +50,7 @@ QgsPostgresExtentThread::~QgsPostgresExtentThread()

void QgsPostgresExtentThread::setConnInfo( QString s )
{
connInfo = s;
connectionInfo = s;
}

void QgsPostgresExtentThread::setTableName( QString s )
@@ -77,12 +77,12 @@ void QgsPostgresExtentThread::setGeometryColumn( QString s )
void QgsPostgresExtentThread::run()
{
// // placeholders for now.
// QString connInfo;
// QString connectionInfo;

QgsDebugMsg( "Started running." );

// Open another connection to the database
PGconn *connection = PQconnectdb( connInfo.toUtf8() );
PGconn *connection = PQconnectdb( connectionInfo.toUtf8() );

// get the extents

@@ -111,7 +111,7 @@ class QgsPostgresExtentThread : public QThread
/**
*
*/
QString connInfo;
QString connectionInfo;

/**
* Name of the table with no schema
@@ -81,14 +81,14 @@ QgsPostgresProvider::QgsPostgresProvider( QString const & uri )

QgsDebugMsg( "Table name is " + mTableName );
QgsDebugMsg( "SQL is " + sqlWhereClause );
QgsDebugMsg( "Connection info is " + mUri.connInfo() );
QgsDebugMsg( "Connection info is " + mUri.connectionInfo() );

QgsDebugMsg( "Geometry column is: " + geometryColumn );
QgsDebugMsg( "Schema is: " + mSchemaName );
QgsDebugMsg( "Table name is: " + mTableName );

connectionRW = NULL;
connectionRO = Conn::connectDb( mUri.connInfo(), true );
connectionRO = Conn::connectDb( mUri.connectionInfo(), true );
if ( connectionRO == NULL )
{
valid = false;
@@ -205,7 +205,7 @@ QgsPostgresProvider::QgsPostgresProvider( QString const & uri )

#ifdef POSTGRESQL_THREADS
QgsDebugMsg( "About to touch mExtentThread" );
mExtentThread.setConnInfo( mUri.connInfo );
mExtentThread.setConnInfo( mUri.connectionInfo );
mExtentThread.setTableName( mTableName );
mExtentThread.setSqlWhereClause( sqlWhereClause );
mExtentThread.setGeometryColumn( geometryColumn );
@@ -215,7 +215,7 @@ QgsPostgresProvider::QgsPostgresProvider( QString const & uri )
QgsDebugMsg( "Main thread just dispatched mExtentThread" );

QgsDebugMsg( "About to touch mCountThread" );
mCountThread.setConnInfo( mUri.connInfo );
mCountThread.setConnInfo( mUri.connectionInfo );
mCountThread.setTableName( mTableName );
mCountThread.setSqlWhereClause( sqlWhereClause );
mCountThread.setGeometryColumn( geometryColumn );
@@ -666,7 +666,7 @@ class QgsPostgresProvider : public QgsVectorDataProvider
if ( connectionRW )
return connectionRW;

connectionRW = Conn::connectDb( mUri.connInfo(), false );
connectionRW = Conn::connectDb( mUri.connectionInfo(), false );

return connectionRW;
}

0 comments on commit dfca970

Please sign in to comment.