Annotation of embedaddon/axTLS/www/lua/prepara_sql2.lua, revision 1.1.1.1
1.1 misho 1: #!/usr/local/bin/lua
2:
3: MAX_ROWS = arg[1] or 10
4:
5: require"postgres"
6:
7: local env = assert (luasql.postgres ())
8: local conn = assert (env:connect ("luasql-test", "tomas"))
9:
10: -- Apaga restos de outros testes.
11: conn:execute "drop table t2"
12: conn:execute "drop table t1"
13:
14: -- Criando as tabelas.
15: assert (conn:execute [[create table t1 (
16: a int,
17: b int
18: )]])
19: assert (conn:execute [[create table t2 (
20: c int,
21: d int
22: )]])
23:
24: -- Preenchedo as tabelas.
25: for i = 1, MAX_ROWS do
26: local ii = 2*i
27: assert (conn:execute (string.format ([[
28: insert into t1 values (%d, %d);
29: insert into t2 values (%d, %d);]],
30: ii, i, ii, i)))
31: end
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>