Software / code / prosody
Comparison
plugins/mod_storage_sql.lua @ 8075:a4dd08fd64cf
mod_storage_sql: Raise error if encoding check query fails
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Wed, 12 Apr 2017 17:26:13 +0200 |
| parent | 8073:7361412a9664 |
| child | 8078:60207251863c |
| child | 8079:b058fc4a4243 |
comparison
equal
deleted
inserted
replaced
| 8073:7361412a9664 | 8075:a4dd08fd64cf |
|---|---|
| 487 WHERE "TABLE_NAME" LIKE 'prosody%%' AND ( "CHARACTER_SET_NAME"!='%s' OR "COLLATION_NAME"!='%s_bin' ); | 487 WHERE "TABLE_NAME" LIKE 'prosody%%' AND ( "CHARACTER_SET_NAME"!='%s' OR "COLLATION_NAME"!='%s_bin' ); |
| 488 ]]; | 488 ]]; |
| 489 check_encoding_query = check_encoding_query:format(engine.charset, engine.charset); | 489 check_encoding_query = check_encoding_query:format(engine.charset, engine.charset); |
| 490 -- FIXME Is it ok to ignore the return values from this? | 490 -- FIXME Is it ok to ignore the return values from this? |
| 491 engine:transaction(function() | 491 engine:transaction(function() |
| 492 local result = engine:execute(check_encoding_query); | 492 local result = assert(engine:execute(check_encoding_query)); |
| 493 local n_bad_columns = result:rowcount(); | 493 local n_bad_columns = result:rowcount(); |
| 494 if n_bad_columns > 0 then | 494 if n_bad_columns > 0 then |
| 495 changes = true; | 495 changes = true; |
| 496 if apply_changes then | 496 if apply_changes then |
| 497 module:log("warn", "Found %d columns in prosody table requiring encoding change, updating now...", n_bad_columns); | 497 module:log("warn", "Found %d columns in prosody table requiring encoding change, updating now...", n_bad_columns); |