aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_storage_sql.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-04-13 01:29:35 +0200
committerKim Alvefur <zash@zash.se>2017-04-13 01:29:35 +0200
commit6670a5b17909e755e132a1d211d8e4a1524dac19 (patch)
tree836f0e76f9472d563d77d6c4464fb3905853b840 /plugins/mod_storage_sql.lua
parent4c698e988d04a12ce1901671989d74e6f06d68a2 (diff)
downloadprosody-6670a5b17909e755e132a1d211d8e4a1524dac19.tar.gz
prosody-6670a5b17909e755e132a1d211d8e4a1524dac19.zip
mod_storage_sql: Limit encoding check to current database
Diffstat (limited to 'plugins/mod_storage_sql.lua')
-rw-r--r--plugins/mod_storage_sql.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/plugins/mod_storage_sql.lua b/plugins/mod_storage_sql.lua
index 9f2933a0..aab43d1f 100644
--- a/plugins/mod_storage_sql.lua
+++ b/plugins/mod_storage_sql.lua
@@ -485,11 +485,12 @@ local function upgrade_table(engine, params, apply_changes) -- luacheck: ignore
SELECT "COLUMN_NAME","COLUMN_TYPE","TABLE_NAME"
FROM "information_schema"."columns"
WHERE "TABLE_NAME" LIKE 'prosody%%'
+ AND "TABLE_SCHEMA" = ?
AND ( "CHARACTER_SET_NAME"!=? OR "COLLATION_NAME"!=?);
]];
-- FIXME Is it ok to ignore the return values from this?
engine:transaction(function()
- local result = assert(engine:execute(check_encoding_query, engine.charset, engine.charset.."_bin"));
+ local result = assert(engine:execute(check_encoding_query, params.database, engine.charset, engine.charset.."_bin"));
local n_bad_columns = result:rowcount();
if n_bad_columns > 0 then
changes = true;
@@ -508,7 +509,8 @@ local function upgrade_table(engine, params, apply_changes) -- luacheck: ignore
end
end);
success,err = engine:transaction(function()
- return engine:execute(check_encoding_query, engine.charset, engine.charset.."_bin");
+ return engine:execute(check_encoding_query, params.database,
+ engine.charset, engine.charset.."_bin");
end);
if not success then
module:log("error", "Failed to check/upgrade database encoding: %s", err or "unknown error");