Software / code / prosody
Comparison
util/sql.lua @ 13632:844e7bf7b48a
util.sql: SQLCipher support
This enables use of encrypted databases if LuaDBI or LuaSQLite3 has been
linked against SQLCipher. Using `LD_PRELOAD` may work as well.
Requires SQLCipher >= 4.0.0 due to the use of UPSERT
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Thu, 23 Jan 2025 16:38:56 +0100 |
| parent | 13240:a378937103cb |
| child | 13715:edd006093533 |
comparison
equal
deleted
inserted
replaced
| 13631:0fe27632a837 | 13632:844e7bf7b48a |
|---|---|
| 82 if not ok then return ok, dbh; end | 82 if not ok then return ok, dbh; end |
| 83 if not dbh then return nil, err; end | 83 if not dbh then return nil, err; end |
| 84 dbh:autocommit(false); -- don't commit automatically | 84 dbh:autocommit(false); -- don't commit automatically |
| 85 self.conn = dbh; | 85 self.conn = dbh; |
| 86 self.prepared = {}; | 86 self.prepared = {}; |
| 87 if params.password then | |
| 88 local ok, err = self:execute(("PRAGMA key='%s'"):format(dbh:quote(params.password))); | |
| 89 if not ok then | |
| 90 return ok, err; | |
| 91 end | |
| 92 end | |
| 87 local ok, err = self:set_encoding(); | 93 local ok, err = self:set_encoding(); |
| 88 if not ok then | 94 if not ok then |
| 89 return ok, err; | 95 return ok, err; |
| 90 end | 96 end |
| 91 local ok, err = self:onconnect(); | 97 local ok, err = self:onconnect(); |