Page 1 of 1

Using SQLite3 with LUA script

Posted: Saturday 30 November 2019 18:06
by Froggy
Hello,

I'm trying to use an external SQLite3 DB with a lua script running under domoticz. Maybe i forget something but most of function seems to not work.

Code: Select all

db:execute("INSERT INTO temperature (date, heure, temperature) VALUES (date('now', 'localtime'), time('now', 'localtime'), '0.1')")
Work, but :

Code: Select all

db:exec("INSERT INTO temperature (date, heure, temperature) VALUES (date('now', 'localtime'), time('now', 'localtime'), '0.1')")
Don't work.

it's same for :
db:nrows
db:rows

and more. Is it a limitation of domoticz or did i miss something ?

Thanks in advance,

Re: Using SQLite3 with LUA script

Posted: Sunday 01 December 2019 10:23
by aleph0
I've had many problems trying to access the dB that way including, when things seems to work, memory leaks crashing domoticz every once and then.

I use now the quick'n dirty workaround os.execute('sqlite3 domoticz.db "SQL statement"') or os.capture if I need some result back. This has been working like a charm for years

I made this choice a few years ago and I didn't try again the other ways, so things may have improved since then...

Envoyé de mon moto g(6) en utilisant Tapatalk


Re: Using SQLite3 with LUA script

Posted: Monday 02 December 2019 14:08
by Froggy
Hi !

Will take a look on it, it's crappy

Thanks :)