Quantum GIS API Documentation  1.8
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
QgsDataSourceURI Class Reference

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

#include <qgsdatasourceuri.h>

List of all members.

Public Types

enum  SSLmode { SSLprefer, SSLdisable, SSLallow, SSLrequire }

Public Member Functions

 QgsDataSourceURI ()
 default constructor
 QgsDataSourceURI (QString uri)
 constructor which parses input URI
QString connectionInfo () const
 return connection part of URI
QString uri () const
 return complete uri
QString quotedTablename () const
 quoted table name
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.
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)
void setDatabase (const QString &database)
 Set database.
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.
void setUsername (QString username)
 set username
void setPassword (QString password)
 set password
QString username () const
QString schema () const
QString table () const
QString sql () const
QString geometryColumn () const
void setUseEstimatedMetadata (bool theFlag)
 set use Estimated Metadata
bool useEstimatedMetadata () const
void disableSelectAtId (bool theFlag)
bool selectAtIdDisabled () 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)
QGis::WkbType wkbType () const
void setWkbType (QGis::WkbType type)
QString srid () const
void setSrid (QString srid)

Static Public Member Functions

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

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
QString mPort
 port the database server listens on
QString mService
 service name
QString mDatabase
 database name
QString mSchema
 schema
QString mTable
 spatial table
QString mGeometryColumn
 geometry column
QString mSql
 SQL query or where clause used to limit features returned from the layer.
QString mUsername
 username
QString mPassword
 password
enum SSLmode mSSLmode
 ssl mode
QString mKeyColumn
 key column
bool mUseEstimatedMetadata
 Use estimated metadata flag.
bool mSelectAtIdDisabled
 Disable SelectAtId capability (eg. to trigger the attribute table memory model for expensive views)
QGis::WkbType mWkbType
 geometry type (or QGis::WKBUnknown if not specified)
QString mSrid
 SRID or a null string if not specified.

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 29 of file qgsdatasourceuri.h.


Member Enumeration Documentation

Note:
enumeration added in version 1.1
Enumerator:
SSLprefer 
SSLdisable 
SSLallow 
SSLrequire 

Definition at line 33 of file qgsdatasourceuri.h.


Constructor & Destructor Documentation

default constructor

Definition at line 25 of file qgsdatasourceuri.cpp.


Member Function Documentation

Definition at line 377 of file qgsdatasourceuri.cpp.

References mSchema.

return connection part of URI

Definition at line 466 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 296 of file qgsdatasourceuri.cpp.

References mDatabase.

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

void QgsDataSourceURI::disableSelectAtId ( bool  theFlag)

Definition at line 362 of file qgsdatasourceuri.cpp.

References mSelectAtIdDisabled.

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

Definition at line 382 of file qgsdatasourceuri.cpp.

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

Definition at line 336 of file qgsdatasourceuri.cpp.

References mGeometryColumn.

Referenced by setDataSource().

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

Definition at line 399 of file qgsdatasourceuri.cpp.

References QgsDebugMsg, and skipBlanks().

Referenced by QgsDataSourceURI().

QString QgsDataSourceURI::host ( ) const

Definition at line 291 of file qgsdatasourceuri.cpp.

References mHost.

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

QString QgsDataSourceURI::keyColumn ( ) const

Definition at line 341 of file qgsdatasourceuri.cpp.

References mKeyColumn.

Referenced by setDataSource().

QString QgsDataSourceURI::password ( ) const

Definition at line 301 of file qgsdatasourceuri.cpp.

References mPassword.

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

QString QgsDataSourceURI::port ( ) const

Definition at line 311 of file qgsdatasourceuri.cpp.

References mPort.

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

quoted table name

Definition at line 590 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 242 of file qgsdatasourceuri.cpp.

Referenced by QgsMapLayer::publicSource().

QString QgsDataSourceURI::schema ( ) const

Definition at line 321 of file qgsdatasourceuri.cpp.

References mSchema.

Referenced by setDataSource().

Definition at line 367 of file qgsdatasourceuri.cpp.

References mSelectAtIdDisabled.

QString QgsDataSourceURI::service ( ) const

Definition at line 286 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 601 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 616 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 642 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 629 of file qgsdatasourceuri.cpp.

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

void QgsDataSourceURI::setKeyColumn ( QString  column)

Definition at line 346 of file qgsdatasourceuri.cpp.

References mKeyColumn.

void QgsDataSourceURI::setPassword ( QString  password)

set password

Definition at line 306 of file qgsdatasourceuri.cpp.

References mPassword, and password().

void QgsDataSourceURI::setSql ( QString  sql)

Definition at line 372 of file qgsdatasourceuri.cpp.

References mSql, and sql().

void QgsDataSourceURI::setSrid ( QString  srid)

Definition at line 662 of file qgsdatasourceuri.cpp.

References mSrid, and srid().

set use Estimated Metadata

Definition at line 352 of file qgsdatasourceuri.cpp.

References mUseEstimatedMetadata.

void QgsDataSourceURI::setUsername ( QString  username)

set username

Definition at line 281 of file qgsdatasourceuri.cpp.

References mUsername, and username().

Definition at line 652 of file qgsdatasourceuri.cpp.

References mWkbType, and wkbType().

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

Definition at line 392 of file qgsdatasourceuri.cpp.

Referenced by getValue(), and QgsDataSourceURI().

QString QgsDataSourceURI::sql ( ) const

Definition at line 331 of file qgsdatasourceuri.cpp.

References mSql.

Referenced by setDataSource(), and setSql().

QString QgsDataSourceURI::srid ( ) const

Definition at line 657 of file qgsdatasourceuri.cpp.

References mSrid.

Referenced by setSrid().

Definition at line 316 of file qgsdatasourceuri.cpp.

References mSSLmode.

QString QgsDataSourceURI::table ( ) const

Definition at line 326 of file qgsdatasourceuri.cpp.

References mTable.

Referenced by setDataSource().

QString QgsDataSourceURI::uri ( ) const

Definition at line 357 of file qgsdatasourceuri.cpp.

References mUseEstimatedMetadata.

QString QgsDataSourceURI::username ( ) const

Definition at line 276 of file qgsdatasourceuri.cpp.

References mUsername.

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

Definition at line 647 of file qgsdatasourceuri.cpp.

References mWkbType.

Referenced by setWkbType().


Member Data Documentation

QString QgsDataSourceURI::mDatabase [private]

database name

Definition at line 141 of file qgsdatasourceuri.h.

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

geometry column

Definition at line 147 of file qgsdatasourceuri.h.

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

QString QgsDataSourceURI::mHost [private]

host name

Definition at line 135 of file qgsdatasourceuri.h.

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

QString QgsDataSourceURI::mKeyColumn [private]

key column

Definition at line 157 of file qgsdatasourceuri.h.

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

QString QgsDataSourceURI::mPassword [private]

password

Definition at line 153 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 137 of file qgsdatasourceuri.h.

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

QString QgsDataSourceURI::mSchema [private]

schema

Definition at line 143 of file qgsdatasourceuri.h.

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

Disable SelectAtId capability (eg. to trigger the attribute table memory model for expensive views)

Definition at line 161 of file qgsdatasourceuri.h.

Referenced by disableSelectAtId(), QgsDataSourceURI(), selectAtIdDisabled(), and uri().

QString QgsDataSourceURI::mService [private]

service name

Definition at line 139 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 149 of file qgsdatasourceuri.h.

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

QString QgsDataSourceURI::mSrid [private]

SRID or a null string if not specified.

Definition at line 165 of file qgsdatasourceuri.h.

Referenced by QgsDataSourceURI(), setSrid(), srid(), and uri().

ssl mode

Definition at line 155 of file qgsdatasourceuri.h.

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

QString QgsDataSourceURI::mTable [private]

spatial table

Definition at line 145 of file qgsdatasourceuri.h.

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

Use estimated metadata flag.

Definition at line 159 of file qgsdatasourceuri.h.

Referenced by QgsDataSourceURI(), setUseEstimatedMetadata(), uri(), and useEstimatedMetadata().

QString QgsDataSourceURI::mUsername [private]

username

Definition at line 151 of file qgsdatasourceuri.h.

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

geometry type (or QGis::WKBUnknown if not specified)

Definition at line 163 of file qgsdatasourceuri.h.

Referenced by QgsDataSourceURI(), setWkbType(), uri(), and wkbType().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines