Annotation of embedaddon/axTLS/www/lua/test_sql2.lua, revision 1.1

1.1     ! misho       1: require"postgres"
        !             2: 
        !             3: local env = assert (luasql.postgres ())
        !             4: local conn = assert (env:connect ("luasql-test", "tomas"))
        !             5: local cur = assert (conn:execute ("select count(*) from t1"))
        !             6: local total = tonumber (cur:fetch())
        !             7: cur:close()
        !             8: local aleatorio = math.random(total)
        !             9: local cur = assert (conn:execute ("select * from t1, t2 where b = d and a != "..2*aleatorio))
        !            10: 
        !            11: cgilua.htmlheader()
        !            12: cgilua.put ("Aleatorio = "..aleatorio.."<br>\n")
        !            13: 
        !            14: local a,b,c,d = cur:fetch()
        !            15: cgilua.put ("<table>\n")
        !            16: while a do
        !            17: --     cgilua.put ("<tr><td>",a,"<td>",b,"<td>",c,"<td>",d,"</tr>")
        !            18:        a,b,c,d = cur:fetch()
        !            19: end
        !            20: cgilua.put ("</table>\n")
        !            21: 
        !            22: cur:close()
        !            23: conn:close()
        !            24: env:close()

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>