Rework LuCI build system
[project/luci.git] / libs / luci-lib-nixio / axTLS / www / lua / test_sql.lua
diff --git a/libs/luci-lib-nixio/axTLS/www/lua/test_sql.lua b/libs/luci-lib-nixio/axTLS/www/lua/test_sql.lua
new file mode 100644 (file)
index 0000000..085ce97
--- /dev/null
@@ -0,0 +1,13 @@
+local s = require"luasql.postgres"
+
+local env = assert (luasql.postgres ())
+local conn = assert (env:connect ("luasql-test", "tomas"))
+local cur = assert (conn:execute ("select count(*) from fetch_test"))
+
+cgilua.htmlheader()
+cgilua.put ("Total lines at table fetch_test is "..cur:fetch())
+cgilua.put (string.format ("<br>\n%s == %s<br>\n", tostring(s), tostring(luasql)))
+
+cur:close()
+conn:close()
+env:close()