Using SQLite3 with LUA script

Moderator: leecollings

Post Reply
Froggy
Posts: 4
Joined: Sunday 26 November 2017 17:12
Target OS: -
Domoticz version:
Contact:

Using SQLite3 with LUA script

Post 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,
aleph0
Posts: 85
Joined: Thursday 12 May 2016 15:47
Target OS: Linux
Domoticz version: 11838
Location: South of France
Contact:

Re: Using SQLite3 with LUA script

Post 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

Froggy
Posts: 4
Joined: Sunday 26 November 2017 17:12
Target OS: -
Domoticz version:
Contact:

Re: Using SQLite3 with LUA script

Post by Froggy »

Hi !

Will take a look on it, it's crappy

Thanks :)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest