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(
" " );
const QgsField & field(int fieldIdx) const
Get field at particular index (must be in range 0..N-1)
const QList< QgsVectorJoinInfo > vectorJoins() const
QString joinFieldName
Join field in the source layer.
QString targetFieldName
Join field in the target layer.
QString name() const
Get the display name of the layer.
int fieldNameIndex(const QString &fieldName) const
Look up field's index from name also looks up case-insensitive if there is no match otherwise...
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.
QString prefix
An optional prefix.
void setQuery(const QString &query)
Set the SQL query.
QString name() const
Gets the name of the field.
QString id() const
Get this layer's unique ID, this ID is used to access this layer from map layer registry.
static QgsVirtualLayerDefinition fromJoinedLayer(QgsVectorLayer *joinedLayer)
Get a virtual layer definition from a vector layer where vector joins are replaced by SQL LEFT JOINs...
int count() const
Return number of items.
Encapsulate a field in an attribute table or data source.
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.
QStringList * joinFieldNamesSubset() const
Get subset of fields to be used from joined layer.
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.
Class to manipulate the definition of a virtual layer.