Quantum GIS API Documentation  1.7.5-Wroclaw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
QgsDataSourceURI Class Reference

Class for storing the component parts of a PostgreSQL/RDBMS datasource URI. More...

#include <qgsdatasourceuri.h>

Public Types

enum  SSLmode { SSLprefer, SSLdisable, SSLallow, SSLrequire }
 

Public Member Functions

 QgsDataSourceURI ()
 default constructor More...
 
 QgsDataSourceURI (QString uri)
 constructor which parses input URI More...
 
QString connectionInfo () const
 return connection part of URI More...
 
QString uri () const
 return complete uri More...
 
QString quotedTablename () const
 quoted table name More...
 
void setConnection (const QString &aHost, const QString &aPort, const QString &aDatabase, const QString &aUsername, const QString &aPassword, SSLmode sslmode=SSLprefer)
 Set all connection related members at once. More...
 
void setConnection (const QString &aService, const QString &aDatabase, const QString &aUsername, const QString &aPassword, SSLmode sslmode=SSLprefer)
 Set all connection related members at once (for the service case) More...
 
void setDatabase (const QString &database)
 Set database. More...
 
void setDataSource (const QString &aSchema, const QString &aTable, const QString &aGeometryColumn, const QString &aSql=QString(), const QString &aKeyColumn=QString())
 Set all data source related members at once. More...
 
void setUsername (QString username)
 set username More...
 
void setPassword (QString password)
 set password More...
 
QString username () const
 
QString schema () const
 
QString table () const
 
QString sql () const
 
QString geometryColumn () const
 
void setUseEstimatedMetadata (bool theFlag)
 set use Estimated Metadata More...
 
bool useEstimatedMetadata () const
 
void clearSchema ()
 
void setSql (QString sql)
 
QString host () const
 
QString database () const
 
QString port () const
 
QString password () const
 
enum SSLmode sslMode () const
 
QString service () const
 
QString keyColumn () const
 
void setKeyColumn (QString column)
 

Static Public Member Functions

static QString removePassword (const QString &aUri)
 Removes password element from uris. More...
 

Private Member Functions

void skipBlanks (const QString &uri, int &i)
 
QString getValue (const QString &uri, int &i)
 
QString escape (const QString &uri, QChar delim) const
 

Private Attributes

QString mHost
 host name More...
 
QString mPort
 port the database server listens on More...
 
QString mService
 service name More...
 
QString mDatabase
 database name More...
 
QString mSchema
 schema More...
 
QString mTable
 spatial table More...
 
QString mGeometryColumn
 geometry column More...
 
QString mSql
 SQL query or where clause used to limit features returned from the layer. More...
 
QString mUsername
 username More...
 
QString mPassword
 password More...
 
enum SSLmode mSSLmode
 ssl mode More...
 
QString mKeyColumn
 key column More...
 
bool mUseEstimatedMetadata
 

Detailed Description

Class for storing the component parts of a PostgreSQL/RDBMS datasource URI.

This structure stores the database connection information, including host, database, user name, password, schema, password, and sql where clause

Definition at line 30 of file qgsdatasourceuri.h.

Member Enumeration Documentation

Note
enumeration added in version 1.1
Enumerator
SSLprefer 
SSLdisable 
SSLallow 
SSLrequire 

Definition at line 34 of file qgsdatasourceuri.h.

Constructor & Destructor Documentation

QgsDataSourceURI::QgsDataSourceURI ( )

default constructor

Definition at line 26 of file qgsdatasourceuri.cpp.

QgsDataSourceURI::QgsDataSourceURI ( QString  uri)

Member Function Documentation

void QgsDataSourceURI::clearSchema ( )

Definition at line 318 of file qgsdatasourceuri.cpp.

References mSchema.

QString QgsDataSourceURI::connectionInfo ( ) const

return connection part of URI

Definition at line 407 of file qgsdatasourceuri.cpp.

References escape(), mDatabase, mHost, mPassword, mPort, mService, mSSLmode, mUsername, SSLallow, SSLdisable, SSLprefer, and SSLrequire.

Referenced by uri().

QString QgsDataSourceURI::database ( ) const

Definition at line 247 of file qgsdatasourceuri.cpp.

References mDatabase.

Referenced by QgsMapLayer::readXML(), setConnection(), setDatabase(), and QgsMapLayer::writeXML().

QString QgsDataSourceURI::escape ( const QString &  uri,
QChar  delim = '\'' 
) const
private

Definition at line 323 of file qgsdatasourceuri.cpp.

Referenced by connectionInfo(), quotedTablename(), and uri().

QString QgsDataSourceURI::geometryColumn ( ) const

Definition at line 287 of file qgsdatasourceuri.cpp.

References mGeometryColumn.

Referenced by setDataSource().

QString QgsDataSourceURI::getValue ( const QString &  uri,
int &  i 
)
private

Definition at line 340 of file qgsdatasourceuri.cpp.

References QgsDebugMsg, and skipBlanks().

Referenced by QgsDataSourceURI().

QString QgsDataSourceURI::host ( ) const

Definition at line 242 of file qgsdatasourceuri.cpp.

References mHost.

Referenced by setConnection(), and QgsMapLayer::writeXML().

QString QgsDataSourceURI::keyColumn ( ) const

Definition at line 292 of file qgsdatasourceuri.cpp.

References mKeyColumn.

Referenced by setDataSource().

QString QgsDataSourceURI::password ( ) const

Definition at line 252 of file qgsdatasourceuri.cpp.

References mPassword.

Referenced by setConnection(), setPassword(), and QgsMapLayer::writeXML().

QString QgsDataSourceURI::port ( ) const

Definition at line 262 of file qgsdatasourceuri.cpp.

References mPort.

Referenced by setConnection(), and QgsMapLayer::writeXML().

QString QgsDataSourceURI::quotedTablename ( ) const

quoted table name

Definition at line 473 of file qgsdatasourceuri.cpp.

References escape(), mSchema, and mTable.

Referenced by uri().

QString QgsDataSourceURI::removePassword ( const QString &  aUri)
static

Removes password element from uris.

Definition at line 193 of file qgsdatasourceuri.cpp.

Referenced by QgsMapLayer::publicSource().

QString QgsDataSourceURI::schema ( ) const

Definition at line 272 of file qgsdatasourceuri.cpp.

References mSchema.

Referenced by setDataSource().

QString QgsDataSourceURI::service ( ) const

Definition at line 237 of file qgsdatasourceuri.cpp.

References mService.

Referenced by setConnection().

void QgsDataSourceURI::setConnection ( const QString &  aHost,
const QString &  aPort,
const QString &  aDatabase,
const QString &  aUsername,
const QString &  aPassword,
SSLmode  sslmode = SSLprefer 
)

Set all connection related members at once.

Note
This optional sslmode parameter has been added in version 1.1

Definition at line 484 of file qgsdatasourceuri.cpp.

References database(), host(), mDatabase, mHost, mPassword, mPort, mSSLmode, mUsername, password(), port(), and username().

Referenced by QgsMapLayer::writeXML().

void QgsDataSourceURI::setConnection ( const QString &  aService,
const QString &  aDatabase,
const QString &  aUsername,
const QString &  aPassword,
SSLmode  sslmode = SSLprefer 
)

Set all connection related members at once (for the service case)

Note
This optional sslmode parameter has been added in version 1.7

Definition at line 499 of file qgsdatasourceuri.cpp.

References database(), mDatabase, mPassword, mService, mSSLmode, mUsername, password(), service(), and username().

void QgsDataSourceURI::setDatabase ( const QString &  database)

Set database.

Definition at line 525 of file qgsdatasourceuri.cpp.

References database(), and mDatabase.

Referenced by QgsMapLayer::readXML().

void QgsDataSourceURI::setDataSource ( const QString &  aSchema,
const QString &  aTable,
const QString &  aGeometryColumn,
const QString &  aSql = QString(),
const QString &  aKeyColumn = QString() 
)

Set all data source related members at once.

Definition at line 512 of file qgsdatasourceuri.cpp.

References geometryColumn(), keyColumn(), mGeometryColumn, mKeyColumn, mSchema, mSql, mTable, schema(), sql(), and table().

void QgsDataSourceURI::setKeyColumn ( QString  column)

Definition at line 297 of file qgsdatasourceuri.cpp.

References mKeyColumn.

void QgsDataSourceURI::setPassword ( QString  password)

set password

Definition at line 257 of file qgsdatasourceuri.cpp.

References mPassword, and password().

void QgsDataSourceURI::setSql ( QString  sql)

Definition at line 313 of file qgsdatasourceuri.cpp.

References mSql, and sql().

void QgsDataSourceURI::setUseEstimatedMetadata ( bool  theFlag)

set use Estimated Metadata

Definition at line 303 of file qgsdatasourceuri.cpp.

References mUseEstimatedMetadata.

void QgsDataSourceURI::setUsername ( QString  username)

set username

Definition at line 232 of file qgsdatasourceuri.cpp.

References mUsername, and username().

void QgsDataSourceURI::skipBlanks ( const QString &  uri,
int &  i 
)
private

Definition at line 333 of file qgsdatasourceuri.cpp.

Referenced by getValue(), and QgsDataSourceURI().

QString QgsDataSourceURI::sql ( ) const

Definition at line 282 of file qgsdatasourceuri.cpp.

References mSql.

Referenced by setDataSource(), and setSql().

QgsDataSourceURI::SSLmode QgsDataSourceURI::sslMode ( ) const

Definition at line 267 of file qgsdatasourceuri.cpp.

References mSSLmode.

QString QgsDataSourceURI::table ( ) const

Definition at line 277 of file qgsdatasourceuri.cpp.

References mTable.

Referenced by setDataSource().

QString QgsDataSourceURI::uri ( ) const
bool QgsDataSourceURI::useEstimatedMetadata ( ) const

Definition at line 308 of file qgsdatasourceuri.cpp.

References mUseEstimatedMetadata.

QString QgsDataSourceURI::username ( ) const

Definition at line 227 of file qgsdatasourceuri.cpp.

References mUsername.

Referenced by setConnection(), setUsername(), and QgsMapLayer::writeXML().

Member Data Documentation

QString QgsDataSourceURI::mDatabase
private

database name

Definition at line 132 of file qgsdatasourceuri.h.

Referenced by connectionInfo(), database(), QgsDataSourceURI(), setConnection(), and setDatabase().

QString QgsDataSourceURI::mGeometryColumn
private

geometry column

Definition at line 138 of file qgsdatasourceuri.h.

Referenced by geometryColumn(), QgsDataSourceURI(), setDataSource(), and uri().

QString QgsDataSourceURI::mHost
private

host name

Definition at line 126 of file qgsdatasourceuri.h.

Referenced by connectionInfo(), host(), QgsDataSourceURI(), and setConnection().

QString QgsDataSourceURI::mKeyColumn
private

key column

Definition at line 148 of file qgsdatasourceuri.h.

Referenced by keyColumn(), QgsDataSourceURI(), setDataSource(), setKeyColumn(), and uri().

QString QgsDataSourceURI::mPassword
private

password

Definition at line 144 of file qgsdatasourceuri.h.

Referenced by connectionInfo(), password(), QgsDataSourceURI(), setConnection(), and setPassword().

QString QgsDataSourceURI::mPort
private

port the database server listens on

Definition at line 128 of file qgsdatasourceuri.h.

Referenced by connectionInfo(), port(), QgsDataSourceURI(), and setConnection().

QString QgsDataSourceURI::mSchema
private

schema

Definition at line 134 of file qgsdatasourceuri.h.

Referenced by clearSchema(), QgsDataSourceURI(), quotedTablename(), schema(), and setDataSource().

QString QgsDataSourceURI::mService
private

service name

Definition at line 130 of file qgsdatasourceuri.h.

Referenced by connectionInfo(), QgsDataSourceURI(), service(), and setConnection().

QString QgsDataSourceURI::mSql
private

SQL query or where clause used to limit features returned from the layer.

Definition at line 140 of file qgsdatasourceuri.h.

Referenced by QgsDataSourceURI(), setDataSource(), setSql(), sql(), and uri().

enum SSLmode QgsDataSourceURI::mSSLmode
private

ssl mode

Definition at line 146 of file qgsdatasourceuri.h.

Referenced by connectionInfo(), QgsDataSourceURI(), setConnection(), and sslMode().

QString QgsDataSourceURI::mTable
private

spatial table

Definition at line 136 of file qgsdatasourceuri.h.

Referenced by QgsDataSourceURI(), quotedTablename(), setDataSource(), and table().

bool QgsDataSourceURI::mUseEstimatedMetadata
private
QString QgsDataSourceURI::mUsername
private

username

Definition at line 142 of file qgsdatasourceuri.h.

Referenced by connectionInfo(), QgsDataSourceURI(), setConnection(), setUsername(), and username().


The documentation for this class was generated from the following files: