diff options
author | Kim Alvefur <zash@zash.se> | 2016-03-21 14:52:43 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2016-03-21 14:52:43 +0100 |
commit | 69b0605179de0b6ca719732d3d05e796816e0cad (patch) | |
tree | 85a3c7b4d4efadd9c68b69eac3178dca98372e19 /util/sql.lua | |
parent | 26f7bd10b05b0d95d6f8c588463e5c93382cdd75 (diff) | |
parent | c00adb21f49071216704b0c304da2fb4f52f81d4 (diff) | |
download | prosody-69b0605179de0b6ca719732d3d05e796816e0cad.tar.gz prosody-69b0605179de0b6ca719732d3d05e796816e0cad.zip |
Merge 0.10->trunk
Diffstat (limited to 'util/sql.lua')
-rw-r--r-- | util/sql.lua | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/util/sql.lua b/util/sql.lua index dcf665fb..f64e8e10 100644 --- a/util/sql.lua +++ b/util/sql.lua @@ -102,11 +102,12 @@ function engine:connect() local params = self.params; assert(params.driver, "no driver") log("debug", "Connecting to [%s] %s...", params.driver, params.database); - local dbh, err = DBI.Connect( + local ok, dbh, err = pcall(DBI.Connect, params.driver, params.database, params.username, params.password, params.host, params.port ); + if not ok then return ok, dbh; end if not dbh then return nil, err; end dbh:autocommit(false); -- don't commit automatically self.conn = dbh; |