Logic Machine Forum
Run query - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Run query (/showthread.php?tid=2728)



Run query - buuuudzik - 19.07.2020

Hi,

how can I successfully run such query on LM? I don't have any visfloors yet, and I don't have also no error after executing this command but it not works.

Code:
res = db:execute([[
INSERT INTO visfloors (`id`, `building`, `layout`, `type`, `sortorder`, `name`, `background`, `background_add`, `bgcolor`, `touch_bgcolor`, `bgrepeat`, `bgfixed`, `usermode_param`, `touch_param`, `width`, `height`, `locx`, `locy`, `pincode`) VALUES
(`1`, `1`, `8`, ``, `1`, `0.00_Witaj`, ``, `0_00_Witaj.svg`, ``, ``, `0`, `0`, ``, ``, `1024`, `748`, ``, ``, ``),
(`2`, `1`, `424`, ``, `56`, `1.01_Klatka schodowa`, ``, `1_01_Klatkaschodowa.svg`, ``, ``, `1`, `0`, ``, ``, `1024`, `748`, ``, ``, ``)
]])

-- res: nil

I know that probably I can use db:insert() but as I checked yesterday it only works for one row not many.

SOLVED: I've changed `` with "" and used integers where it is possible


RE: Run query - buuuudzik - 19.07.2020

But now I have such situation:

I've imported visfloors and then visobjects (all by insert sql).

I have these floors and objects in db but only Layouts and Widgets are visible in UI. I've tried to refresh web browser and reboot LM but without any progress.

What is necessary to create in script new plan and objects?


RE: Run query - admin - 20.07.2020

You plan must reference an existing level (building field in visfloors table -> id field in visbuildings table).


RE: Run query - buuuudzik - 20.07.2020

(20.07.2020, 06:16)admin Wrote: You plan must reference an existing level (building field in visfloors table -> id field in visbuildings table).

In visbuildings I have 2 buildings:
id: 1, name: "Main",
id: 2, name: "Floors"

In visfloors I have first plan:
id: 1, building: 1, layout: 8, type: "", name: "0.00_Witaj" ...

And this plan has at least one below object:
id: 6301, floor: 1, type: 0, object: 3174, statusobject: 3174

So it should be visible in plans but I don't have it, I have only Layouts and Widgets.

And when I click on Main->Export then I have big backup including above plan with id 1.


RE: Run query - admin - 20.07.2020

type must be NULL not an empty string


RE: Run query - buuuudzik - 20.07.2020

ExactlyWink

Thank you very muchWink