Logic Machine Forum
Internal database structure - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Visualization (https://forum.logicmachine.net/forumdisplay.php?fid=9)
+--- Thread: Internal database structure (/showthread.php?tid=620)



Internal database structure - Thomas - 16.02.2017

Hi
Do you have a documentation to LM internal object database?
I need to do a few bulk changes like change of icons, classes etc.

Thank you


RE: Internal database structure - admin - 16.02.2017

It's not documented because most users don't need to change anything there directly and there's no guarantee that there are no breaking changes between firmware releases. Smile


RE: Internal database structure - Thomas - 16.02.2017

I've > 100 visualisation windows and I need to do some changes in every of these 100 windows and I don't want to spend 3 days by monkey work. In case the structure is not accessible. Could you please send me commands which:
1. Change every custom name from "lignt - grightness" to "light"
2. Change every default icon from "weather-night-A0F007-010101.svg" to "my_weather_icon.svg"
2. Change every Additional icon from "bulb-A0F007-010101.svg" to "my_lights_on_icon.svg"

Thank you


RE: Internal database structure - admin - 17.02.2017

Try this, just make sure to make a backup beforehand Smile
Code:
oldname = 'lignt - grightness'
newname = 'light'
db:query('UPDATE visobjects SET name=? WHERE name=?', newname, oldname)

oldicon = 'weather-night-A0F007-010101.svg'
newicon = 'my_weather_icon.svg'
db:query('UPDATE visobjects SET params=replace(params,?,?)', oldicon, newicon)

oldicon = 'bulb-A0F007-010101.svg'
newicon = 'my_lights_on_icon.svg'
db:query('UPDATE visobjects SET params=replace(params,?,?)', oldicon, newicon)



RE: Internal database structure - Thomas - 22.02.2017

Thank you. It works perfectly!
It would be great to know a complete database structure but I understand reasons why you don't want to make it public.


RE: Internal database structure - admin - 23.02.2017

Database is in SQLite format, you can extract it from the backup archive and view the whole structure and data.


RE: Internal database structure - buuuudzik - 23.02.2017

Do you know admin or other user if there is a command for showing main structure(to check it without using other program)?

I know such programs but checking the structure with LUA would be very useful


RE: Internal database structure - admin - 23.02.2017

Code:
log(db:getlist('SELECT sql FROM sqlite_master'))



RE: Internal database structure - Thomas - 23.02.2017

Perfect, thank you