46 columns <<
"t.rowid AS " + uid;
62 columns << joinName +
"." + f +
" AS " + prefix + f;
68 for (
int i = 0; i < joinedFields.
count(); i++ )
71 columns << joinName +
"." + f.
name() +
" AS " + prefix + f.
name();
76 QString query =
"SELECT " + columns.
join(
", " ) +
" FROM " + layer->
id() +
" AS t " + leftJoins.
join(
" " );
QString joinFieldName
Join field in the source layer.
QString targetFieldName
Join field in the target layer.
Container of fields for a vector layer.
QString join(const QString &separator) const
virtual QgsAttributeList pkAttributeIndexes()
Return list of indexes of fields that make up the primary key.
const QList< QgsVectorJoinInfo > vectorJoins() const
int count() const
Return number of items.
QString name() const
Gets the name of the field.
QString prefix
An optional prefix.
QString id() const
Get this layer's unique ID, this ID is used to access this layer from map layer registry.
void setQuery(const QString &query)
Set the SQL query.
static QgsVirtualLayerDefinition fromJoinedLayer(QgsVectorLayer *joinedLayer)
Get a virtual layer definition from a vector layer where vector joins are replaced by SQL LEFT JOINs...
Encapsulate a field in an attribute table or data source.
int fieldNameIndex(const QString &fieldName) const
Look up field's index from name also looks up case-insensitive if there is no match otherwise...
QString name() const
Get the display name of the layer.
virtual const QgsFields & fields() const =0
Return a map of indexes with field names for this layer.
void setUid(const QString &uid)
Set the name of the field with unique identifiers.
const QgsField & field(int fieldIdx) const
Get field at particular index (must be in range 0..N-1)
QgsVectorDataProvider * dataProvider()
Returns the data provider.
Represents a vector layer which manages a vector based data sets.
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
QString joinLayerId
Source layer.
QStringList * joinFieldNamesSubset() const
Get subset of fields to be used from joined layer.
Class to manipulate the definition of a virtual layer.