Software / code / prosody
Comparison
plugins/mod_storage_sql2.lua @ 6724:a8dbfa14e1a8
mod_storage_sql2: Include 'with' field from iterator like some 3rd party archive-capable storage modules
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Tue, 19 May 2015 18:21:23 +0200 |
| parent | 6532:a966efeb6cb3 |
| child | 6725:41725f3df3cc |
comparison
equal
deleted
inserted
replaced
| 6720:936cf2f7531f | 6724:a8dbfa14e1a8 |
|---|---|
| 279 function archive_store:find(username, query) | 279 function archive_store:find(username, query) |
| 280 query = query or {}; | 280 query = query or {}; |
| 281 local user,store = username,self.store; | 281 local user,store = username,self.store; |
| 282 local total; | 282 local total; |
| 283 local ok, result = engine:transaction(function() | 283 local ok, result = engine:transaction(function() |
| 284 local sql_query = "SELECT `key`, `type`, `value`, `when` FROM `prosodyarchive` WHERE %s ORDER BY `sort_id` %s%s;"; | 284 local sql_query = "SELECT `key`, `type`, `value`, `when`, `with` FROM `prosodyarchive` WHERE %s ORDER BY `sort_id` %s%s;"; |
| 285 local args = { host, user or "", store, }; | 285 local args = { host, user or "", store, }; |
| 286 local where = { "`host` = ?", "`user` = ?", "`store` = ?", }; | 286 local where = { "`host` = ?", "`user` = ?", "`store` = ?", }; |
| 287 | 287 |
| 288 archive_where(query, args, where); | 288 archive_where(query, args, where); |
| 289 | 289 |
| 311 end); | 311 end); |
| 312 if not ok then return ok, result end | 312 if not ok then return ok, result end |
| 313 return function() | 313 return function() |
| 314 local row = result(); | 314 local row = result(); |
| 315 if row ~= nil then | 315 if row ~= nil then |
| 316 return row[1], deserialize(row[2], row[3]), row[4]; | 316 return row[1], deserialize(row[2], row[3]), row[4], row[5]; |
| 317 end | 317 end |
| 318 end, total; | 318 end, total; |
| 319 end | 319 end |
| 320 | 320 |
| 321 function archive_store:delete(username, query) | 321 function archive_store:delete(username, query) |