Skip to content
Permalink
Browse files
quote closing parens within column names (fixes #7159)
  • Loading branch information
jef-n committed Feb 15, 2013
1 parent c036e7e commit b630692c747bb102ae8e1cc549b4aaa92a0c7447
Showing with 11 additions and 1 deletion.
  1. +11 −1 src/core/qgsdatasourceuri.cpp
@@ -102,14 +102,20 @@ QgsDataSourceURI::QgsDataSourceURI( QString uri )
int start = i;
QString col;
while ( i < uri.length() && uri[i] != ')' )
{
if ( uri[i] == '\\' )
i++;
i++;
}

if ( i == uri.length() )
{
QgsDebugMsg( "closing parenthesis missing" );
}

mGeometryColumn = uri.mid( start, i - start );
mGeometryColumn.replace( "\\)", ")" );
mGeometryColumn.replace( "\\\\", "\\" );

i++;
}
@@ -584,9 +590,13 @@ QString QgsDataSourceURI::uri() const
theUri += QString( " selectatid=false" );
}

QString columnName( mGeometryColumn );
columnName.replace( "\\", "\\\\" );
columnName.replace( ")", "\\)" );

theUri += QString( " table=%1%2 sql=%3" )
.arg( quotedTablename() )
.arg( mGeometryColumn.isNull() ? QString() : QString( " (%1)" ).arg( mGeometryColumn ) )
.arg( mGeometryColumn.isNull() ? QString() : QString( " (%1)" ).arg( columnName ) )
.arg( mSql );

return theUri;

0 comments on commit b630692

Please sign in to comment.