Changeset

366:c2554fee5c21

Reconnect on DB disconnection.
author Tomasz Sterna <tomek@xiaoka.com>
date Wed, 13 Apr 2011 15:37:26 +0200
parents 365:1d95b69c2c81
children 367:a6dee73a11e7
files mod_auth_sql/mod_auth_sql.lua
diffstat 1 files changed, 1 insertions(+), 0 deletions(-) [+]
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