Logic Machine Forum
guidance on databases in logic machine - 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: guidance on databases in logic machine (/showthread.php?tid=980)



guidance on databases in logic machine - Carlos Padilla - 06.09.2017

Hello, Sorry for asking a lot, but you do not find many
things about the logical machine, like on this site


When working with MySQL database in logic machine, what user,
database name, server, and password should I connect to? A logic machine? How
do I know what it is?

After

When I want to select a table like I know the name of the table that I have to select? With their respective fields or columns, a serious example would be: select the database the group address with its data type, current value, and date on which current value update of that group address
 

Then I could send that data obtained from outside the logic machine,
from the application of the logic machine and take it to my application to read
those data from the database of the logic machine?

 
 


RE: guidance on databases in logic machine - admin - 07.09.2017

In most cases you don't need to access internal database directly but use provided functions instead. To get all objects you can use grp.all(): http://openrb.com/docs/lua.htm#grp.all

Here's an example that logs group address, name and current value for first 5 objects:
Code:
objects = grp.all()

for i, object in ipairs(objects) do
  log(object.address, object.name, object.value)
  if i == 5 then
    break
  end
end



RE: guidance on databases in logic machine - Carlos Padilla - 07.09.2017

(07.09.2017, 06:04)admin Wrote: In most cases you don't need to access internal database directly but use provided functions instead. To get all objects you can use grp.all(): http://openrb.com/docs/lua.htm#grp.all

Here's an example that logs group address, name and current value for first 5 objects:
Code:
objects = grp.all()

for i, object in ipairs(objects) do
 log(object.address, object.name, object.value)
 if i == 5 then
   break
 end
end
Hi,thank you very much if it works for me