QGIS API Documentation  2.5.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Types | Public Member Functions | Static Public Member Functions | 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...
 
 QgsDataSourceURI (const QByteArray &uri)
 constructor which parses input encoded URI (generic mode) More...
 
QString connectionInfo () const
 return connection part of URI More...
 
QString uri () const
 return complete uri More...
 
QByteArray encodedUri () const
 return complete encoded uri (generic mode) More...
 
void setEncodedUri (const QByteArray &uri)
 set complete encoded uri (generic mode) More...
 
void setEncodedUri (const QString &uri)
 set complete encoded uri (generic mode) More...
 
QString quotedTablename () const
 quoted table name More...
 
void setParam (const QString &key, const QString &value)
 Set generic param (generic mode) More...
 
void setParam (const QString &key, const QStringList &value)
 
int removeParam (const QString &key)
 Remove generic param (generic mode) More...
 
QString param (const QString &key) const
 Get generic param (generic mode) More...
 
QStringList params (const QString &key) const
 Get multiple generic param (generic mode) More...
 
bool hasParam (const QString &key) const
 Test if param exists (generic mode) 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 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. More...
 

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

Extended to support generic params so that it may be used by any provider. The 2 modes (the old - RDMS specific and the new generic) may not yet be mixed. (Radim Blazek 4/2012)

Constructor & Destructor Documentation

QgsDataSourceURI::QgsDataSourceURI ( )

default constructor

QgsDataSourceURI::QgsDataSourceURI ( QString  uri)

constructor which parses input URI

QgsDataSourceURI::QgsDataSourceURI ( const QByteArray &  uri)

constructor which parses input encoded URI (generic mode)

Member Function Documentation

void QgsDataSourceURI::clearSchema ( )
QString QgsDataSourceURI::connectionInfo ( ) const

return connection part of URI

QString QgsDataSourceURI::database ( ) const
void QgsDataSourceURI::disableSelectAtId ( bool  theFlag)
QByteArray QgsDataSourceURI::encodedUri ( ) const

return complete encoded uri (generic mode)

QString QgsDataSourceURI::geometryColumn ( ) const
bool QgsDataSourceURI::hasParam ( const QString &  key) const

Test if param exists (generic mode)

QString QgsDataSourceURI::host ( ) const
QString QgsDataSourceURI::keyColumn ( ) const
QString QgsDataSourceURI::param ( const QString &  key) const

Get generic param (generic mode)

QStringList QgsDataSourceURI::params ( const QString &  key) const

Get multiple generic param (generic mode)

QString QgsDataSourceURI::password ( ) const
QString QgsDataSourceURI::port ( ) const
QString QgsDataSourceURI::quotedTablename ( ) const

quoted table name

int QgsDataSourceURI::removeParam ( const QString &  key)

Remove generic param (generic mode)

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

Removes password element from uris.

QString QgsDataSourceURI::schema ( ) const
bool QgsDataSourceURI::selectAtIdDisabled ( ) const
QString QgsDataSourceURI::service ( ) const
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
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
void QgsDataSourceURI::setDatabase ( const QString &  database)

Set database.

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.

void QgsDataSourceURI::setEncodedUri ( const QByteArray &  uri)

set complete encoded uri (generic mode)

void QgsDataSourceURI::setEncodedUri ( const QString &  uri)

set complete encoded uri (generic mode)

void QgsDataSourceURI::setKeyColumn ( QString  column)
void QgsDataSourceURI::setParam ( const QString &  key,
const QString &  value 
)

Set generic param (generic mode)

void QgsDataSourceURI::setParam ( const QString &  key,
const QStringList &  value 
)
void QgsDataSourceURI::setPassword ( QString  password)

set password

void QgsDataSourceURI::setSql ( QString  sql)
void QgsDataSourceURI::setSrid ( QString  srid)
void QgsDataSourceURI::setUseEstimatedMetadata ( bool  theFlag)

set use Estimated Metadata

void QgsDataSourceURI::setUsername ( QString  username)

set username

void QgsDataSourceURI::setWkbType ( QGis::WkbType  type)
QString QgsDataSourceURI::sql ( ) const
QString QgsDataSourceURI::srid ( ) const
QgsDataSourceURI::SSLmode QgsDataSourceURI::sslMode ( ) const
QString QgsDataSourceURI::table ( ) const
QString QgsDataSourceURI::uri ( ) const

return complete uri

bool QgsDataSourceURI::useEstimatedMetadata ( ) const
QString QgsDataSourceURI::username ( ) const
QGis::WkbType QgsDataSourceURI::wkbType ( ) const

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