File: test.lua

package info (click to toggle)
lua-dbi 0.7.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 400 kB
  • sloc: ansic: 3,376; sql: 220; makefile: 114
file content (12 lines) | stat: -rw-r--r-- 338 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
local DBI = require('DBI')

local h = assert(DBI.Connect(...))
DBI.Do(h,'DROP TABLE foo')
assert(DBI.Do(h,'CREATE TABLE foo (n int)'))
assert(DBI.Do(h,'INSERT INTO foo VALUES (3)'))
local s = h:prepare('SELECT * FROM foo where n > ?')
assert(s:execute(3))
assert(s:fetch() == nil)
assert(s:execute(2))
assert(#(s:fetch()) == 1)
h:close()