diff mod_auth_sql/mod_auth_sql.lua @ 366:c2554fee5c21

Reconnect on DB disconnection.
author Tomasz Sterna <tomek@xiaoka.com>
date Wed, 13 Apr 2011 15:37:26 +0200
parents f24998ec7f8d
children a6dee73a11e7
line wrap: on
line diff
--- a/mod_auth_sql/mod_auth_sql.lua	Tue Apr 12 22:57:34 2011 +0000
+++ b/mod_auth_sql/mod_auth_sql.lua	Wed Apr 13 15:37:26 2011 +0200
@@ -60,6 +60,7 @@
 	if params.driver == "PostgreSQL" then
 		sql = sql:gsub("`", "\"");
 	end
+	if not test_connection() then connect() end
 	-- do prepared statement stuff
 	local stmt, err = connection:prepare(sql);
 	if not stmt and not test_connection() then error("connection failed"); end