From d546de1a4c2d383f66ab5b89d8fbca0beb8ab85f Mon Sep 17 00:00:00 2001 From: "Juergen E. Fischer" Date: Mon, 3 Nov 2014 23:28:35 +0100 Subject: [PATCH] QgsDataSourceURI: add parameters to uri --- src/core/qgsdatasourceuri.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/core/qgsdatasourceuri.cpp b/src/core/qgsdatasourceuri.cpp index 274f6c8752d..3fc26bccd67 100644 --- a/src/core/qgsdatasourceuri.cpp +++ b/src/core/qgsdatasourceuri.cpp @@ -240,7 +240,8 @@ QgsDataSourceURI::QgsDataSourceURI( QString uri ) } else { - QgsDebugMsg( "invalid connection option \"" + pname + "\" ignored" ); + QgsDebugMsg( "parameter \"" + pname + "\":\"" + pval + "\" added" ); + setParam( pname, pval ); } } } @@ -590,6 +591,17 @@ QString QgsDataSourceURI::uri() const theUri += QString( " selectatid=false" ); } + for ( QMap::const_iterator it = mParams.begin(); it != mParams.end(); ++it ) + { + if ( it.key().contains( "=" ) || it.key().contains( " " ) ) + { + QgsDebugMsg( QString( "invalid uri parameter %1 skipped" ).arg( it.key() ) ); + continue; + } + + theUri += " " + it.key() + "='" + escape( it.value() ) + "'"; + } + QString columnName( mGeometryColumn ); columnName.replace( "\\", "\\\\" ); columnName.replace( ")", "\\)" );