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