File: testSQL.lua

package info (click to toggle)
lua-logging 1.1.4-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 244 kB
  • ctags: 45
  • sloc: makefile: 10
file content (22 lines) | stat: -rw-r--r-- 667 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require"logging.sql"
require"luasql.sqlite3"

if not luasql or not luasql.sqlite3 then
    print("Missing LuaSQL SQLite 3 driver!")
else
    local env, err = luasql.sqlite3()

    local logger = logging.sql{
                                connectionfactory = function()
                                  local con, err = env:connect("test.db")
                                  assert(con, err)
                                  return con
                                end,
                                keepalive = true,
    }

    logger:info("logging.sql test")
    logger:debug("debugging...")
    logger:error("error!")
    print("SQLite 3 Logging OK")
end