Software / code / prosody
Comparison
plugins/mod_storage_sql.lua @ 13148:c6f46f33cecf
mod_storage_sql: Record all SQLite3 compile options for potential use
Knowing what features are available could be useful for future
experiments. For example, with the JSON module or full text search.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sat, 10 Jun 2023 14:01:56 +0200 |
| parent | 13144:033ea8b46d6a |
| child | 13149:0aaf67f70015 |
comparison
equal
deleted
inserted
replaced
| 13147:e560f7c691ce | 13148:c6f46f33cecf |
|---|---|
| 621 WHERE %s | 621 WHERE %s |
| 622 ORDER BY "sort_id" %s | 622 ORDER BY "sort_id" %s |
| 623 LIMIT %s OFFSET ? | 623 LIMIT %s OFFSET ? |
| 624 );]]; | 624 );]]; |
| 625 if engine.params.driver == "SQLite3" then | 625 if engine.params.driver == "SQLite3" then |
| 626 if engine._have_delete_limit then | 626 if engine.sqlite_compile_options.enable_update_delete_limit then |
| 627 sql_query = [[ | 627 sql_query = [[ |
| 628 DELETE FROM "prosodyarchive" | 628 DELETE FROM "prosodyarchive" |
| 629 WHERE %s | 629 WHERE %s |
| 630 ORDER BY "sort_id" %s | 630 ORDER BY "sort_id" %s |
| 631 LIMIT %s OFFSET ?; | 631 LIMIT %s OFFSET ?; |
| 901 module:log("error", "Old database format detected. Please run: prosodyctl mod_%s upgrade", module.name); | 901 module:log("error", "Old database format detected. Please run: prosodyctl mod_%s upgrade", module.name); |
| 902 return false, "database upgrade needed"; | 902 return false, "database upgrade needed"; |
| 903 end | 903 end |
| 904 end | 904 end |
| 905 if engine.params.driver == "SQLite3" then | 905 if engine.params.driver == "SQLite3" then |
| 906 local compile_options = {} | |
| 906 for row in engine:select("PRAGMA compile_options") do | 907 for row in engine:select("PRAGMA compile_options") do |
| 907 if row[1] == "ENABLE_UPDATE_DELETE_LIMIT" then | 908 local option = row[1]:lower(); |
| 908 engine._have_delete_limit = true; | 909 local opt, val = option:match("^([^=]+)=(.*)$"); |
| 909 end | 910 compile_options[opt or option] = tonumber(val) or val or true; |
| 910 end | 911 end |
| 912 engine.sqlite_compile_options = compile_options; | |
| 911 end | 913 end |
| 912 module:set_status("info", "Connected to " .. engine.params.driver); | 914 module:set_status("info", "Connected to " .. engine.params.driver); |
| 913 end, function (engine) -- luacheck: ignore 431/engine | 915 end, function (engine) -- luacheck: ignore 431/engine |
| 914 module:set_status("error", "Disconnected from " .. engine.params.driver); | 916 module:set_status("error", "Disconnected from " .. engine.params.driver); |
| 915 end); | 917 end); |