04.04.2020, 09:26
Thanks so much. This syntax document was extremely helpful.
Posting the resulting SELECT statement for inspiration
Example: Read all entries from the object log occurring after a certain logtime and only for all objects having a certain tag
This did the trick:
*********** START CODE ****************
query = [[
SELECT objectlog.src, objectlog.address, objectlog.datahex, objectlog.logtime, objectlog.eventtype
FROM objectlog
JOIN objects ON objectlog.address=objects.address
JOIN objecttags ON objects.address=objecttags.object
WHERE objecttags.tag=? AND objectlog.logtime>?
ORDER BY objectlog.id ASC
]]
-- Remember to have initiated the sCurrTag and iLastTime variables with the specific values
for _, row in ipairs(db:getall(query,sCurrTag, iLastTime)) do
...do stuff with row....
end
*********** END CODE ****************
Posting the resulting SELECT statement for inspiration
Example: Read all entries from the object log occurring after a certain logtime and only for all objects having a certain tag
This did the trick:
*********** START CODE ****************
query = [[
SELECT objectlog.src, objectlog.address, objectlog.datahex, objectlog.logtime, objectlog.eventtype
FROM objectlog
JOIN objects ON objectlog.address=objects.address
JOIN objecttags ON objects.address=objecttags.object
WHERE objecttags.tag=? AND objectlog.logtime>?
ORDER BY objectlog.id ASC
]]
-- Remember to have initiated the sCurrTag and iLastTime variables with the specific values
for _, row in ipairs(db:getall(query,sCurrTag, iLastTime)) do
...do stuff with row....
end
*********** END CODE ****************