complete plugin installation (after plugin_add). That is, initialize it, and update mysql.plugin table */
| 2230 | That is, initialize it, and update mysql.plugin table |
| 2231 | */ |
| 2232 | static bool finalize_install(THD *thd, TABLE *table, const LEX_CSTRING *name, |
| 2233 | int *argc, char **argv) |
| 2234 | { |
| 2235 | struct st_plugin_int *tmp= plugin_find_internal(name, MYSQL_ANY_PLUGIN); |
| 2236 | int error; |
| 2237 | DBUG_ASSERT(tmp); |
| 2238 | mysql_mutex_assert_owner(&LOCK_plugin); // because of tmp->state |
| 2239 | |
| 2240 | if (tmp->state != PLUGIN_IS_UNINITIALIZED) |
| 2241 | { |
| 2242 | /* already installed */ |
| 2243 | return 0; |
| 2244 | } |
| 2245 | else |
| 2246 | { |
| 2247 | if (plugin_initialize(thd->mem_root, tmp, argc, argv, false)) |
| 2248 | { |
| 2249 | my_error(ER_CANT_INITIALIZE_UDF, MYF(0), name->str, |
| 2250 | "Plugin initialization function failed."); |
| 2251 | tmp->state= PLUGIN_IS_DELETED; |
| 2252 | return 1; |
| 2253 | } |
| 2254 | } |
| 2255 | if (tmp->state == PLUGIN_IS_DISABLED) |
| 2256 | { |
| 2257 | if (global_system_variables.log_warnings) |
| 2258 | push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, |
| 2259 | ER_CANT_INITIALIZE_UDF, |
| 2260 | ER_THD(thd, ER_CANT_INITIALIZE_UDF), |
| 2261 | name->str, "Plugin is disabled"); |
| 2262 | } |
| 2263 | |
| 2264 | /* |
| 2265 | We do not replicate the INSTALL PLUGIN statement. Disable binlogging |
| 2266 | of the insert into the plugin table, so that it is not replicated in |
| 2267 | row based mode. |
| 2268 | */ |
| 2269 | DBUG_ASSERT(!table->file->row_logging); |
| 2270 | table->use_all_columns(); |
| 2271 | restore_record(table, s->default_values); |
| 2272 | table->field[PLUGIN_NAME]->store(name->str, name->length, system_charset_info); |
| 2273 | table->field[PLUGIN_SONAME]->store(&tmp->plugin_dl->dl, files_charset_info); |
| 2274 | error= table->file->ha_write_row(table->record[0]); |
| 2275 | if (unlikely(error)) |
| 2276 | { |
| 2277 | table->file->print_error(error, MYF(0)); |
| 2278 | tmp->state= PLUGIN_IS_DELETED; |
| 2279 | return 1; |
| 2280 | } |
| 2281 | return 0; |
| 2282 | } |
| 2283 | |
| 2284 | bool mysql_install_plugin(THD *thd, const LEX_CSTRING *name, |
| 2285 | const LEX_CSTRING *dl_arg) |
no test coverage detected