| 105 | **************************************************************************/ |
| 106 | |
| 107 | Trigger_creation_ctx * |
| 108 | Trigger_creation_ctx::create(THD *thd, |
| 109 | const char *db_name, |
| 110 | const char *table_name, |
| 111 | const LEX_CSTRING *client_cs_name, |
| 112 | const LEX_CSTRING *connection_cl_name, |
| 113 | const LEX_CSTRING *db_cl_name) |
| 114 | { |
| 115 | CHARSET_INFO *client_cs; |
| 116 | CHARSET_INFO *connection_cl; |
| 117 | CHARSET_INFO *db_cl; |
| 118 | |
| 119 | bool invalid_creation_ctx= FALSE; |
| 120 | myf utf8_flag= thd->get_utf8_flag(); |
| 121 | |
| 122 | if (resolve_charset(safe_str(client_cs_name), |
| 123 | thd->variables.character_set_client, |
| 124 | &client_cs, MYF(utf8_flag))) |
| 125 | { |
| 126 | sql_print_warning("Trigger for table '%s'.'%s': " |
| 127 | "invalid character_set_client value (%s).", |
| 128 | db_name, table_name, safe_str(client_cs_name)); |
| 129 | |
| 130 | invalid_creation_ctx= TRUE; |
| 131 | } |
| 132 | |
| 133 | if (resolve_collation(safe_str(connection_cl_name), |
| 134 | thd->variables.collation_connection, |
| 135 | &connection_cl,MYF(utf8_flag))) |
| 136 | { |
| 137 | sql_print_warning("Trigger for table '%s'.'%s': " |
| 138 | "invalid collation_connection value (%s).", |
| 139 | db_name, table_name, safe_str(connection_cl_name)); |
| 140 | |
| 141 | invalid_creation_ctx= TRUE; |
| 142 | } |
| 143 | |
| 144 | if (resolve_collation(safe_str(db_cl_name), NULL, &db_cl, MYF(utf8_flag))) |
| 145 | { |
| 146 | sql_print_warning("Trigger for table '%s'.'%s': " |
| 147 | "invalid database_collation value (%s).", |
| 148 | db_name, table_name, safe_str(db_cl_name)); |
| 149 | |
| 150 | invalid_creation_ctx= TRUE; |
| 151 | } |
| 152 | |
| 153 | if (invalid_creation_ctx) |
| 154 | { |
| 155 | push_warning_printf(thd, |
| 156 | Sql_condition::WARN_LEVEL_WARN, |
| 157 | ER_TRG_INVALID_CREATION_CTX, |
| 158 | ER_THD(thd, ER_TRG_INVALID_CREATION_CTX), |
| 159 | db_name, table_name); |
| 160 | } |
| 161 | |
| 162 | /* |
| 163 | If we failed to resolve the database collation, load the default one |
| 164 | from the disk. |
nothing calls this directly
no test coverage detected