diff options
author | Steven Barth <steven@midlink.org> | 2009-02-22 23:19:25 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2009-02-22 23:19:25 +0000 |
commit | d730c1263328c5990ce46cdf6394ce6e36cc3609 (patch) | |
tree | 8dc37350e69dcbd0ca82570cfa62a4c710defc93 /libs/nixio/axTLS/www/lua/test_sql2.lua | |
parent | d2b11117f26285186b711271d24733d35e0444a1 (diff) |
Add axTLS sourcecode
Diffstat (limited to 'libs/nixio/axTLS/www/lua/test_sql2.lua')
-rw-r--r-- | libs/nixio/axTLS/www/lua/test_sql2.lua | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/libs/nixio/axTLS/www/lua/test_sql2.lua b/libs/nixio/axTLS/www/lua/test_sql2.lua new file mode 100644 index 0000000000..a2f6ee12dc --- /dev/null +++ b/libs/nixio/axTLS/www/lua/test_sql2.lua @@ -0,0 +1,24 @@ +require"postgres" + +local env = assert (luasql.postgres ()) +local conn = assert (env:connect ("luasql-test", "tomas")) +local cur = assert (conn:execute ("select count(*) from t1")) +local total = tonumber (cur:fetch()) +cur:close() +local aleatorio = math.random(total) +local cur = assert (conn:execute ("select * from t1, t2 where b = d and a != "..2*aleatorio)) + +cgilua.htmlheader() +cgilua.put ("Aleatorio = "..aleatorio.."<br>\n") + +local a,b,c,d = cur:fetch() +cgilua.put ("<table>\n") +while a do +-- cgilua.put ("<tr><td>",a,"<td>",b,"<td>",c,"<td>",d,"</tr>") + a,b,c,d = cur:fetch() +end +cgilua.put ("</table>\n") + +cur:close() +conn:close() +env:close() |