Logic Machine Forum
MySQL server - 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: MySQL server (/showthread.php?tid=3703)



MySQL server - sashhun - 23.11.2021

Good afternoon. Please tell me who knows. After installing the MySQL packages, LM5 has its own MySQL server or only allows working with third party MySQL databases.


RE: MySQL server - admin - 23.11.2021

It's only for MySQL client not server.


RE: MySQL server - sashhun - 23.11.2021

(23.11.2021, 13:01)admin Wrote: It's only for MySQL client not server.

Thanks


RE: MySQL result - sashhun - 03.12.2021

Hello. Please tell me. How can I get the result of a query as a chill, so that a condition can be made to check the result. The query displays the result in tabular form
Code:
count = dbcon:execute('SELECT COUNT(period) FROM total_energy WHERE period = "day"')
row = count:fetch({}, 'a')
log(row)
Query Result
Code:
* table:
["COUNT(period)"]
  * string: 9



RE: MySQL server - admin - 03.12.2021

Try this:
Code:
cur = dbcon:execute('SELECT COUNT(period) AS cnt FROM total_energy WHERE period = "day"')
row = cur:fetch({}, 'a')
cur:close()

count = tonumber(row.cnt)
log(count)



RE: MySQL server - sashhun - 03.12.2021

(03.12.2021, 08:06)admin Wrote: Try this:
Code:
cur = dbcon:execute('SELECT COUNT(period) AS cnt FROM total_energy WHERE period = "day"')
row = cur:fetch({}, 'a')
cur:close()

count = tonumber(row.cnt)
log(count)
Many thanks