17
15
* (at your option) any later version. *
19
17
***************************************************************************/
20
/* $Id: qgsdatasourceuri.h 5423 2006-05-07 05:29:25Z g_j_m $ */
22
\struct QgsDataSourceURI
23
\brief Structure for storing the component parts of a PostgreSQL/RDBMS datasource URI.
25
This structure stores the database connection information, including host, database,
26
user name, password, schema, password, and sql where clause
20
#ifndef QGSDATASOURCEURI_H
21
#define QGSDATASOURCEURI_H
26
* Class for storing the component parts of a PostgreSQL/RDBMS datasource URI.
27
* This structure stores the database connection information, including host, database,
28
* user name, password, schema, password, and sql where clause
29
class QgsDataSourceURI
30
class CORE_EXPORT QgsDataSourceURI
36
//! port the database server listens on
43
QString geometryColumn;
44
//! SQL where clause used to limit features returned from the layer
50
//! All in a single string
53
return QString("host=" + host +
54
" dbname=" + database +
57
" password=" + password +
58
" table=" + schema + '.' + table +
59
" (" + geometryColumn + ")" +
33
//! \note enumeration added in version 1.1
34
enum SSLmode { SSLprefer, SSLdisable, SSLallow, SSLrequire };
36
//! default constructor
39
//! constructor which parses input URI
40
QgsDataSourceURI( QString uri );
42
//! return connection part of URI
43
QString connectionInfo() const;
45
//! return complete uri
49
QString quotedTablename() const;
51
//! Set all connection related members at once
52
//! \note This optional sslmode parameter has been added in version 1.1
53
void setConnection( const QString& aHost,
55
const QString& aDatabase,
56
const QString& aUsername,
57
const QString& aPassword,
58
SSLmode sslmode = SSLprefer );
62
void setDatabase( const QString &database );
64
//! Set all data source related members at once
65
void setDataSource( const QString& aSchema,
66
const QString& aTable,
67
const QString& aGeometryColumn,
68
const QString& aSql = QString(),
69
const QString& aKeyColumn = QString() );
71
//! Removes password element from uris
72
static QString removePassword( const QString& aUri );
74
QString username() const;
75
QString schema() const;
76
QString table() const;
78
QString geometryColumn() const;
81
void setSql( QString sql );
83
// added in version 1.1
85
QString database() const;
87
QString password() const;
88
enum SSLmode sslMode() const;
90
// added in version 1.2
91
QString keyColumn() const;
92
void setKeyColumn( QString column );
95
void skipBlanks( const QString &uri, int &i );
96
QString getValue( const QString &uri, int &i );
97
QString escape( const QString &uri ) const;
105
//! port the database server listens on
112
QString mGeometryColumn;
113
//! SQL where clause used to limit features returned from the layer
120
enum SSLmode mSSLmode;
63
125
#endif //QGSDATASOURCEURI_H