DatabaseQueryFilter
Description
The DatabaseQueryFilter object represents a query filter used in DatabaseQuery objects. Each filter consists of a set of DatabaseQueryWhere objects which are combined using logical OR. This means that one of the defined WHERE conditions have to match to make the whole filter match for a particular row.
- › Inherits:
Overview
Properties
Methods
Signals
Properties
where
This property holds one or multiple DatabaseQueryWhere instances or references to them used to create an SQL query for this filter.
- › Type:
- › Signal:
whereChanged()
- › Attributes:
Readonly
Signals
whereDataChanged(SignedInteger index)
This signal is emitted whenever the List.dataChanged() signal is emitted, i.e. the item at index in the where list itself emitted the dataChanged() signal.
Example
import InCore.Foundation 2.5
import InCore.Database 2.5
Application {
LocalDatabase {
id: exampleDatabase
DatabaseTable {
id: exampleTable
DateTime { id: date }
Measurement { id: temperature1 }
Measurement { id: temperature2 }
queries: [
DatabaseQuery {
id: exampleQuery
DatabaseQueryFilter {
DatabaseQueryWhere { key: temperature1; operation: DatabaseQueryWhere.GreaterThan; value: 20 }
DatabaseQueryWhere { key: temperature2; operation: DatabaseQueryWhere.LessThan; value: 30 }
}
onResultsChanged: console.log(toJson(results))
}
]
}
}
Timer {
onTriggered: {
temperature1.data = 25 - Math.random() * 20
temperature2.data = 25 + Math.random() * 20
exampleTable.submit()
exampleQuery.execute()
}
}
onCompleted: exampleTable.drop()
}