14.01.2016, 10:03
Install packages:
https://dl.openrb.com/pkg/zlib_1.2.7-1_mxs.ipk
https://dl.openrb.com/pkg/libmysqlclient...-1_mxs.ipk
https://dl.openrb.com/pkg/liblua-mysql_2.2.0-2_mxs.ipk
Docs:
http://keplerproject.github.io/luasql/do...anual.html
Short example, don't use db as a variable name or you will mess up LM internal database connection
https://dl.openrb.com/pkg/zlib_1.2.7-1_mxs.ipk
https://dl.openrb.com/pkg/libmysqlclient...-1_mxs.ipk
https://dl.openrb.com/pkg/liblua-mysql_2.2.0-2_mxs.ipk
Docs:
http://keplerproject.github.io/luasql/do...anual.html
Short example, don't use db as a variable name or you will mess up LM internal database connection
Code:
require('luasql.mysql')
env = luasql.mysql()
dbcon = env:connect(DB_NAME, USERNAME, PASSWORD, MYSQL_SERVER_IP, MYSQL_SERVER_PORT)
cursor = dbcon:execute('SELECT * FROM mytable')
while true do
row = cursor:fetch({}, 'a')
if row then
log(row)
else
break
end
end
cursor:close()
dbcon:close()
env:close()