DatabaseEventTable¶
Description¶
The DatabaseEventTable object is a special DatabaseTable which can stores Event objects. The additional properties correspond to each property of Event.
› Inherits: | DatabaseTable |
---|
Properties¶
category¶
This property holds a DataObject for the category property of Event.
› Type: | DataObject |
---|---|
› Signal: | categoryChanged() |
› Attributes: | Readonly |
data¶
This property holds a DataObject for the data property of Event.
› Type: | DataObject |
---|---|
› Signal: | dataChanged() |
› Attributes: | Readonly |
description¶
This property holds a DataObject for the description property of Event.
› Type: | DataObject |
---|---|
› Signal: | descriptionChanged() |
› Attributes: | Readonly |
errorCode¶
This property holds a DataObject for the errorCode property of Event.
› Type: | DataObject |
---|---|
› Signal: | errorCodeChanged() |
› Attributes: | Readonly |
eventId¶
This property holds a DataObject for the id property of Event.
› Type: | DataObject |
---|---|
› Signal: | eventIdChanged() |
› Attributes: | Readonly |
severity¶
This property holds a DataObject for the severity property of Event.
› Type: | DataObject |
---|---|
› Signal: | severityChanged() |
› Attributes: | Readonly |
timestamp¶
This property holds a DataObject for the timestamp property of Event.
› Type: | DataObject |
---|---|
› Signal: | timestampChanged() |
› Attributes: | Readonly |
uuid¶
This property holds a DataObject for the uuid property of Event.
› Type: | DataObject |
---|---|
› Signal: | uuidChanged() |
› Attributes: | Readonly |
Example¶
import InCore.Foundation 2.5
import InCore.Database 2.5
Application {
name: "EventDemo"
description: "Event Demo"
property alias evntTbl: eventWriter.eventTable
DatabaseQuery {
id: eventQuery
table: evntTbl
objects: [ evntTbl.data, evntTbl.timestamp, evntTbl.eventId ]
filters: [
DatabaseQueryFilter {
DatabaseQueryWhere { key: evntTbl.severity; operation: DatabaseQueryWhere.GreaterOrEquals; value: Event.Warning }
}
]
onResultsChanged: {
console.log("data, timestamp, id")
for(var i = 0; i < results.length; i++) {
console.log(results[i].data, results[i].timestamp, results[i].eventId)
}
}
onCompleted: eventQuery.execute()
}
EventLog {
outputs: [
DatabaseEventWriter { id: eventWriter }
]
// categories allow filtering events for outputs based on OR (instead of severity which filters by number)
EventCategory { id: ioErrorCategory }
EventGroup {
severity: Event.Information // Info Warning Debug Fatal
Event {
id: generalErrorEvent
severity: Event.Error
uuid: "7f160be3-4ba9-42f0-a524-5359057c034b"
description: "General error"
}
Event {
id: fileOpenErrorEvent
category: ioErrorCategory
errorCode: 42
description: "Could not open file %1"
}
Event {
id: deviceStartedEvent
description: "Database error: %1"
}
}
onCompleted: deviceStartedEvent.trigger()
}
}