This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

MySQL server
#1
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.
Reply
#2
It's only for MySQL client not server.
Reply
#3
(23.11.2021, 13:01)admin Wrote: It's only for MySQL client not server.

Thanks
Reply
#4
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
Reply
#5
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)
Reply
#6
(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
Reply


Forum Jump: