Diff

util/sql.lua @ 6762:ea43a5af31ca

util.sql: Return failure if set_encoding() fails
author Matthew Wild <mwild1@gmail.com>
date Wed, 08 Jul 2015 15:10:25 +0100
parent 6760:e45a58c72609
child 6763:e961ac4efbb3
line wrap: on
line diff
--- a/util/sql.lua	Wed Jul 08 15:07:23 2015 +0100
+++ b/util/sql.lua	Wed Jul 08 15:10:25 2015 +0100
@@ -110,7 +110,10 @@
 	dbh:autocommit(false); -- don't commit automatically
 	self.conn = dbh;
 	self.prepared = {};
-	self:set_encoding();
+	local ok, err = self:set_encoding();
+	if not ok then
+		return ok, err;
+	end
 	local ok, err = self:onconnect();
 	if ok == false then
 		return ok, err;