File: __driver__.lua

package info (click to toggle)
monotone 0.31-6
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 20,680 kB
  • ctags: 14,801
  • sloc: cpp: 87,711; ansic: 64,862; sh: 5,691; lisp: 954; perl: 783; makefile: 509; python: 265; sql: 98; sed: 16
file content (32 lines) | stat: -rw-r--r-- 874 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
23
24
25
26
27
28
29
30
31
32

mtn_setup()

two_col_table = "files"
col1 = "id"

function dbex(...)
  check(mtn("db", "execute", string.format(unpack(arg))), 0, true, false)
end

dbex("INSERT INTO %s VALUES ('key1', 'value1')", two_col_table)

dbex("SELECT * FROM %s", two_col_table)
check(qgrep("key1", "stdout"))
check(qgrep("value1", "stdout"))

dbex("SELECT * FROM %s WHERE %s = 'nonsense'", two_col_table, col1)
check(not qgrep("key1", "stdout"))

dbex("SELECT * FROM %s WHERE %s LIKE 'k%%'", two_col_table, col1)
check(qgrep("key1", "stdout"))

dbex("DELETE FROM %s", two_col_table)

dbex("SELECT * FROM %s", two_col_table)
check(not qgrep("key1", "stdout"))

-- We used to have weird quoting bugs around "%"
-- string is split into two so the grep doesn't trigger on monotone's
-- chatter about what command it's going to execute...
dbex("SELECT '%%s' || 'tuff'")
check(qgrep('%stuff', "stdout"))