Software / code / prosody-modules
Comparison
mod_auth_phpbb3/mod_auth_phpbb3.lua @ 1343:7dbde05b48a9
all the things: Remove trailing whitespace
| author | Florian Zeitz <florob@babelmonkeys.de> |
|---|---|
| date | Tue, 11 Mar 2014 18:44:01 +0100 |
| parent | 814:881ec9919144 |
| child | 2168:28d99ffa3c06 |
comparison
equal
deleted
inserted
replaced
| 1342:0ae065453dc9 | 1343:7dbde05b48a9 |
|---|---|
| 45 end | 45 end |
| 46 end | 46 end |
| 47 | 47 |
| 48 do -- process options to get a db connection | 48 do -- process options to get a db connection |
| 49 params = params or { driver = "SQLite3" }; | 49 params = params or { driver = "SQLite3" }; |
| 50 | 50 |
| 51 if params.driver == "SQLite3" then | 51 if params.driver == "SQLite3" then |
| 52 params.database = resolve_relative_path(prosody.paths.data or ".", params.database or "prosody.sqlite"); | 52 params.database = resolve_relative_path(prosody.paths.data or ".", params.database or "prosody.sqlite"); |
| 53 end | 53 end |
| 54 | 54 |
| 55 assert(params.driver and params.database, "Both the SQL driver and the database need to be specified"); | 55 assert(params.driver and params.database, "Both the SQL driver and the database need to be specified"); |
| 56 | 56 |
| 57 assert(connect()); | 57 assert(connect()); |
| 58 end | 58 end |
| 59 | 59 |
| 60 local function getsql(sql, ...) | 60 local function getsql(sql, ...) |
| 61 if params.driver == "PostgreSQL" then | 61 if params.driver == "PostgreSQL" then |
| 68 if not stmt then module:log("error", "QUERY FAILED: %s %s", err, debug.traceback()); return nil, err; end | 68 if not stmt then module:log("error", "QUERY FAILED: %s %s", err, debug.traceback()); return nil, err; end |
| 69 -- run query | 69 -- run query |
| 70 local ok, err = stmt:execute(...); | 70 local ok, err = stmt:execute(...); |
| 71 if not ok and not test_connection() then error("connection failed"); end | 71 if not ok and not test_connection() then error("connection failed"); end |
| 72 if not ok then return nil, err; end | 72 if not ok then return nil, err; end |
| 73 | 73 |
| 74 return stmt; | 74 return stmt; |
| 75 end | 75 end |
| 76 local function setsql(sql, ...) | 76 local function setsql(sql, ...) |
| 77 local stmt, err = getsql(sql, ...); | 77 local stmt, err = getsql(sql, ...); |
| 78 if not stmt then return stmt, err; end | 78 if not stmt then return stmt, err; end |