Skip to content

Commit d546de1

Browse files
committedNov 3, 2014
QgsDataSourceURI: add parameters to uri
1 parent 9aa678b commit d546de1

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed
 

‎src/core/qgsdatasourceuri.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,8 @@ QgsDataSourceURI::QgsDataSourceURI( QString uri )
240240
}
241241
else
242242
{
243-
QgsDebugMsg( "invalid connection option \"" + pname + "\" ignored" );
243+
QgsDebugMsg( "parameter \"" + pname + "\":\"" + pval + "\" added" );
244+
setParam( pname, pval );
244245
}
245246
}
246247
}
@@ -590,6 +591,17 @@ QString QgsDataSourceURI::uri() const
590591
theUri += QString( " selectatid=false" );
591592
}
592593

594+
for ( QMap<QString, QString>::const_iterator it = mParams.begin(); it != mParams.end(); ++it )
595+
{
596+
if ( it.key().contains( "=" ) || it.key().contains( " " ) )
597+
{
598+
QgsDebugMsg( QString( "invalid uri parameter %1 skipped" ).arg( it.key() ) );
599+
continue;
600+
}
601+
602+
theUri += " " + it.key() + "='" + escape( it.value() ) + "'";
603+
}
604+
593605
QString columnName( mGeometryColumn );
594606
columnName.replace( "\\", "\\\\" );
595607
columnName.replace( ")", "\\)" );

0 commit comments

Comments
 (0)
Please sign in to comment.