@@ -862,8 +862,6 @@ Sp_handler::db_load_routine(THD *thd, const Database_qualified_name *name,
862
862
863
863
thd->lex = &newlex;
864
864
newlex.current_select = NULL ;
865
- // Resetting REPLACE and EXIST flags in create_info, for show_create_sp()
866
- newlex.create_info .DDL_options_st ::init ();
867
865
868
866
defstr.set_charset (creation_ctx->get_client_cs ());
869
867
@@ -873,10 +871,10 @@ Sp_handler::db_load_routine(THD *thd, const Database_qualified_name *name,
873
871
definition for SHOW CREATE PROCEDURE later.
874
872
*/
875
873
876
- if (! show_create_sp (thd, &defstr,
877
- null_clex_str, name->m_name ,
878
- params, returns, body,
879
- chistics, definer, sql_mode))
874
+ if (show_create_sp (thd, &defstr,
875
+ null_clex_str, name->m_name ,
876
+ params, returns, body,
877
+ chistics, definer, DDL_options () , sql_mode))
880
878
{
881
879
ret= SP_INTERNAL_ERROR;
882
880
goto end;
@@ -1303,12 +1301,14 @@ Sp_handler::sp_create_routine(THD *thd, const sp_head *sp) const
1303
1301
String log_query;
1304
1302
log_query.set_charset (system_charset_info);
1305
1303
1306
- if (!show_create_sp (thd, &log_query,
1307
- sp->m_explicit_name ? sp->m_db : null_clex_str,
1308
- sp->m_name ,
1309
- sp->m_params , returns, sp->m_body ,
1310
- sp->chistics (), thd->lex ->definer [0 ],
1311
- saved_mode))
1304
+ if (show_create_sp (thd, &log_query,
1305
+ sp->m_explicit_name ? sp->m_db : null_clex_str,
1306
+ sp->m_name ,
1307
+ sp->m_params , returns, sp->m_body ,
1308
+ sp->chistics (),
1309
+ thd->lex ->definer [0 ],
1310
+ thd->lex ->create_info ,
1311
+ saved_mode))
1312
1312
{
1313
1313
my_error (ER_OUT_OF_RESOURCES, MYF (0 ));
1314
1314
goto done;
@@ -2176,7 +2176,7 @@ int Sp_handler::sp_cache_routine(THD *thd,
2176
2176
Generates the CREATE... string from the table information.
2177
2177
2178
2178
@return
2179
- Returns TRUE on success, FALSE on (alloc) failure.
2179
+ Returns false on success, true on (alloc) failure.
2180
2180
*/
2181
2181
bool
2182
2182
Sp_handler::show_create_sp (THD *thd, String *buf,
@@ -2187,6 +2187,7 @@ Sp_handler::show_create_sp(THD *thd, String *buf,
2187
2187
const LEX_CSTRING &body,
2188
2188
const st_sp_chistics &chistics,
2189
2189
const AUTHID &definer,
2190
+ const DDL_options_st ddl_options,
2190
2191
sql_mode_t sql_mode) const
2191
2192
{
2192
2193
sql_mode_t old_sql_mode= thd->variables .sql_mode ;
@@ -2195,16 +2196,16 @@ Sp_handler::show_create_sp(THD *thd, String *buf,
2195
2196
params.length + returns.length +
2196
2197
chistics.comment .length + 10 /* length of " DEFINER= "*/ +
2197
2198
USER_HOST_BUFF_SIZE))
2198
- return FALSE ;
2199
+ return true ;
2199
2200
2200
2201
thd->variables .sql_mode = sql_mode;
2201
2202
buf->append (STRING_WITH_LEN (" CREATE " ));
2202
- if (thd-> lex -> create_info .or_replace ())
2203
+ if (ddl_options .or_replace ())
2203
2204
buf->append (STRING_WITH_LEN (" OR REPLACE " ));
2204
2205
append_definer (thd, buf, &definer.user , &definer.host );
2205
2206
buf->append (type_lex_cstring ());
2206
2207
buf->append (STRING_WITH_LEN (" " ));
2207
- if (thd-> lex -> create_info .if_not_exists ())
2208
+ if (ddl_options .if_not_exists ())
2208
2209
buf->append (STRING_WITH_LEN (" IF NOT EXISTS " ));
2209
2210
2210
2211
if (db.length > 0 )
@@ -2252,7 +2253,7 @@ Sp_handler::show_create_sp(THD *thd, String *buf,
2252
2253
}
2253
2254
buf->append (body);
2254
2255
thd->variables .sql_mode = old_sql_mode;
2255
- return TRUE ;
2256
+ return false ;
2256
2257
}
2257
2258
2258
2259
@@ -2300,10 +2301,10 @@ Sp_handler::sp_load_for_information_schema(THD *thd, TABLE *proc_table,
2300
2301
Stored_program_creation_ctx *creation_ctx=
2301
2302
Stored_routine_creation_ctx::load_from_db (thd, &sp_name_obj, proc_table);
2302
2303
defstr.set_charset (creation_ctx->get_client_cs ());
2303
- if (! show_create_sp (thd, &defstr,
2304
- sp_name_obj.m_db , sp_name_obj.m_name ,
2305
- params, returns, empty_body_lex_cstring (),
2306
- Sp_chistics (), definer, sql_mode))
2304
+ if (show_create_sp (thd, &defstr,
2305
+ sp_name_obj.m_db , sp_name_obj.m_name ,
2306
+ params, returns, empty_body_lex_cstring (),
2307
+ Sp_chistics (), definer, DDL_options () , sql_mode))
2307
2308
return 0 ;
2308
2309
2309
2310
thd->lex = &newlex;
0 commit comments