Skip to content
Permalink
Browse files
Added setConnection() and setDataSource() utility functions to QgsDat…
…aSourceURI

git-svn-id: http://svn.osgeo.org/qgis/trunk@6891 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Apr 17, 2007
1 parent 6114f06 commit 0dc4a3b23a367ab90354e1ab84de352a7204c592
Showing with 66 additions and 3 deletions.
  1. +29 −3 python/core/qgsdatasourceuri.sip
  2. +24 −0 src/core/qgsdatasourceuri.cpp
  3. +13 −0 src/core/qgsdatasourceuri.h
@@ -11,7 +11,32 @@ class QgsDataSourceURI
#include <qgsdatasourceuri.h>
%End

public:
public:

//! default constructor
QgsDataSourceURI();

//! constructor which parses input URI
QgsDataSourceURI(QString uri);

//! All in a single string
QString text() const;

//! Set all connection related members at once
void setConnection(const QString& aHost,
const QString& aPort,
const QString& aDatabase,
const QString& aUsername,
const QString& aPassword);

//! Set all data source related members at once
void setDataSource(const QString& aSchema,
const QString& aTable,
const QString& aGeometryColumn,
const QString& aSql = QString());

/* data */

//! host name
QString host;
//! database name
@@ -30,7 +55,8 @@ class QgsDataSourceURI
QString username;
//! password
QString password;
//! All in a single string
QString text();

//! whole connection info (host, db, port, name, pass)
QString connInfo;
};

@@ -152,3 +152,27 @@ QString QgsDataSourceURI::text() const
" (" + geometryColumn + ")" +
" sql=" + sql);
}

void QgsDataSourceURI::setConnection(const QString& aHost,
const QString& aPort,
const QString& aDatabase,
const QString& aUsername,
const QString& aPassword)
{
host = aHost;
database = aDatabase;
port = aPort;
username = aUsername;
password = aPassword;
}

void QgsDataSourceURI::setDataSource(const QString& aSchema,
const QString& aTable,
const QString& aGeometryColumn,
const QString& aSql)
{
schema = aSchema;
table = aTable;
geometryColumn = aGeometryColumn;
sql = aSql;
}
@@ -43,6 +43,19 @@ class CORE_EXPORT QgsDataSourceURI
//! All in a single string
QString text() const;

//! Set all connection related members at once
void setConnection(const QString& aHost,
const QString& aPort,
const QString& aDatabase,
const QString& aUsername,
const QString& aPassword);

//! Set all data source related members at once
void setDataSource(const QString& aSchema,
const QString& aTable,
const QString& aGeometryColumn,
const QString& aSql = QString());

/* data */

//! host name

0 comments on commit 0dc4a3b

Please sign in to comment.