Skip to content
Permalink
Browse files

vector join: fix quoting in subset string

  • Loading branch information
jef-n committed Jul 16, 2013
1 parent a132bc9 commit af8479e72ff23940a48f80fb649190d4c15e6667
Showing with 25 additions and 1 deletion.
  1. +25 −1 src/core/qgsvectorlayerfeatureiterator.cpp
@@ -407,7 +407,31 @@ void QgsVectorLayerFeatureIterator::FetchJoinInfo::addJoinedAttributesDirect( Qg
else
joinFieldName = joinInfo->joinFieldName;

subsetString.append( "\"" + joinFieldName + "\"" + " = " + "\"" + joinValue.toString() + "\"" );
subsetString.append( QString( "\"%1\"" ).arg( joinFieldName ) );

if ( joinValue.isNull() )
{
subsetString += " IS NULL";
}
else
{
QString v = joinValue.toString();
switch ( joinValue.type() )
{
case QVariant::Int:
case QVariant::LongLong:
case QVariant::Double:
break;

default:
case QVariant::String:
v.replace( "'", "''" );
v.prepend( "'" ).append( "'" );
break;
}
subsetString += "=" + v;
}

joinLayer->dataProvider()->setSubsetString( subsetString, false );

// select (no geometry)

0 comments on commit af8479e

Please sign in to comment.
You can’t perform that action at this time.