Skip to content

Commit

Permalink
QgsDataSourceURI: add parameters to uri
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Nov 3, 2014
1 parent 9aa678b commit d546de1
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/core/qgsdatasourceuri.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@ QgsDataSourceURI::QgsDataSourceURI( QString uri )
}
else
{
QgsDebugMsg( "invalid connection option \"" + pname + "\" ignored" );
QgsDebugMsg( "parameter \"" + pname + "\":\"" + pval + "\" added" );
setParam( pname, pval );
}
}
}
Expand Down Expand Up @@ -590,6 +591,17 @@ QString QgsDataSourceURI::uri() const
theUri += QString( " selectatid=false" );
}

for ( QMap<QString, QString>::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( ")", "\\)" );
Expand Down

0 comments on commit d546de1

Please sign in to comment.