File: __driver__.lua

package info (click to toggle)
monotone 1.0-6
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 20,708 kB
  • sloc: cpp: 84,765; sh: 6,787; perl: 837; makefile: 833; python: 517; lisp: 379; sql: 118; exp: 88; ansic: 52
file content (32 lines) | stat: -rw-r--r-- 866 bytes parent folder | download | duplicates (5)
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(...)), 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"))