File: test_sql.lua

package info (click to toggle)
lua-cgi 6.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 956 kB
  • sloc: javascript: 2,216; makefile: 25
file content (14 lines) | stat: -rwxr-xr-x 437 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/env cgilua.cgi
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()