@@ -487,9 +487,8 @@ db_find_routine_aux(THD *thd, stored_procedure_type type, const sp_name *name,
487
487
*/
488
488
if (name->m_name .length > table->field [1 ]->field_length )
489
489
DBUG_RETURN (SP_KEY_NOT_FOUND);
490
- table->field [0 ]->store (name->m_db .str , name->m_db .length , &my_charset_bin);
491
- table->field [1 ]->store (name->m_name .str , name->m_name .length ,
492
- &my_charset_bin);
490
+ table->field [0 ]->store (name->m_db , &my_charset_bin);
491
+ table->field [1 ]->store (name->m_name , &my_charset_bin);
493
492
table->field [2 ]->store ((longlong) type, TRUE );
494
493
key_copy (key, table->record [0 ], table->key_info ,
495
494
table->key_info ->key_length );
@@ -533,7 +532,7 @@ db_find_routine(THD *thd, stored_procedure_type type, const sp_name *name,
533
532
const char *definer;
534
533
longlong created;
535
534
longlong modified;
536
- st_sp_chistics chistics;
535
+ Sp_chistics chistics;
537
536
char *ptr;
538
537
uint length;
539
538
char buff[65 ];
@@ -567,7 +566,6 @@ db_find_routine(THD *thd, stored_procedure_type type, const sp_name *name,
567
566
goto done;
568
567
}
569
568
570
- bzero ((char *)&chistics, sizeof (chistics));
571
569
if ((ptr= get_field (thd->mem_root ,
572
570
table->field [MYSQL_PROC_FIELD_ACCESS])) == NULL )
573
571
{
@@ -849,7 +847,7 @@ db_load_routine(THD *thd, stored_procedure_type type,
849
847
params, strlen (params),
850
848
returns, strlen (returns),
851
849
body, strlen (body),
852
- & chistics, definer_user_name, definer_host_name,
850
+ chistics, definer_user_name, definer_host_name,
853
851
sql_mode))
854
852
{
855
853
ret= SP_INTERNAL_ERROR;
@@ -902,7 +900,7 @@ db_load_routine(THD *thd, stored_procedure_type type,
902
900
}
903
901
904
902
(*sphp)->set_definer (definer_user_name, definer_host_name);
905
- (*sphp)->set_info (created, modified, & chistics, sql_mode);
903
+ (*sphp)->set_info (created, modified, chistics, sql_mode);
906
904
(*sphp)->set_creation_ctx (creation_ctx);
907
905
(*sphp)->optimize ();
908
906
/*
@@ -1139,41 +1137,41 @@ sp_create_routine(THD *thd, stored_procedure_type type, sp_head *sp)
1139
1137
1140
1138
store_failed=
1141
1139
table->field [MYSQL_PROC_FIELD_DB]->
1142
- store (sp->m_db . str , sp-> m_db . length , system_charset_info);
1140
+ store (sp->m_db , system_charset_info);
1143
1141
1144
1142
store_failed= store_failed ||
1145
1143
table->field [MYSQL_PROC_FIELD_NAME]->
1146
- store (sp->m_name . str , sp-> m_name . length , system_charset_info);
1144
+ store (sp->m_name , system_charset_info);
1147
1145
1148
1146
store_failed= store_failed ||
1149
1147
table->field [MYSQL_PROC_MYSQL_TYPE]->
1150
1148
store ((longlong)type, TRUE );
1151
1149
1152
1150
store_failed= store_failed ||
1153
1151
table->field [MYSQL_PROC_FIELD_SPECIFIC_NAME]->
1154
- store (sp->m_name . str , sp-> m_name . length , system_charset_info);
1152
+ store (sp->m_name , system_charset_info);
1155
1153
1156
- if (sp->m_chistics -> daccess != SP_DEFAULT_ACCESS)
1154
+ if (sp->daccess () != SP_DEFAULT_ACCESS)
1157
1155
{
1158
1156
store_failed= store_failed ||
1159
1157
table->field [MYSQL_PROC_FIELD_ACCESS]->
1160
- store ((longlong)sp->m_chistics -> daccess , TRUE );
1158
+ store ((longlong)sp->daccess () , TRUE );
1161
1159
}
1162
1160
1163
1161
store_failed= store_failed ||
1164
1162
table->field [MYSQL_PROC_FIELD_DETERMINISTIC]->
1165
- store ((longlong)(sp->m_chistics -> detistic ? 1 : 2 ), TRUE );
1163
+ store ((longlong)(sp->detistic () ? 1 : 2 ), TRUE );
1166
1164
1167
- if (sp->m_chistics -> suid != SP_IS_DEFAULT_SUID)
1165
+ if (sp->suid () != SP_IS_DEFAULT_SUID)
1168
1166
{
1169
1167
store_failed= store_failed ||
1170
1168
table->field [MYSQL_PROC_FIELD_SECURITY_TYPE]->
1171
- store ((longlong)sp->m_chistics -> suid , TRUE );
1169
+ store ((longlong)sp->suid () , TRUE );
1172
1170
}
1173
1171
1174
1172
store_failed= store_failed ||
1175
1173
table->field [MYSQL_PROC_FIELD_PARAM_LIST]->
1176
- store (sp->m_params . str , sp-> m_params . length , system_charset_info);
1174
+ store (sp->m_params , system_charset_info);
1177
1175
1178
1176
if (sp->m_type == TYPE_ENUM_FUNCTION)
1179
1177
{
@@ -1186,11 +1184,11 @@ sp_create_routine(THD *thd, stored_procedure_type type, sp_head *sp)
1186
1184
1187
1185
store_failed= store_failed ||
1188
1186
table->field [MYSQL_PROC_FIELD_BODY]->
1189
- store (sp->m_body . str , sp-> m_body . length , system_charset_info);
1187
+ store (sp->m_body , system_charset_info);
1190
1188
1191
1189
store_failed= store_failed ||
1192
1190
table->field [MYSQL_PROC_FIELD_DEFINER]->
1193
- store (definer. str , definer. length , system_charset_info);
1191
+ store (definer, system_charset_info);
1194
1192
1195
1193
((Field_timestamp *)table->field [MYSQL_PROC_FIELD_CREATED])->set_time ();
1196
1194
((Field_timestamp *)table->field [MYSQL_PROC_FIELD_MODIFIED])->set_time ();
@@ -1199,26 +1197,25 @@ sp_create_routine(THD *thd, stored_procedure_type type, sp_head *sp)
1199
1197
table->field [MYSQL_PROC_FIELD_SQL_MODE]->
1200
1198
store ((longlong)saved_mode, TRUE );
1201
1199
1202
- if (sp->m_chistics -> comment .str )
1200
+ if (sp->comment () .str )
1203
1201
{
1204
1202
store_failed= store_failed ||
1205
1203
table->field [MYSQL_PROC_FIELD_COMMENT]->
1206
- store (sp->m_chistics ->comment .str , sp->m_chistics ->comment .length ,
1207
- system_charset_info);
1204
+ store (sp->comment (), system_charset_info);
1208
1205
}
1209
1206
1210
1207
if ((sp->m_type == TYPE_ENUM_FUNCTION) &&
1211
1208
!trust_function_creators && mysql_bin_log.is_open ())
1212
1209
{
1213
- if (!sp->m_chistics -> detistic )
1210
+ if (!sp->detistic () )
1214
1211
{
1215
1212
/*
1216
1213
Note that this test is not perfect; one could use
1217
1214
a non-deterministic read-only function in an update statement.
1218
1215
*/
1219
1216
enum enum_sp_data_access access=
1220
- (sp->m_chistics -> daccess == SP_DEFAULT_ACCESS) ?
1221
- SP_DEFAULT_ACCESS_MAPPING : sp->m_chistics -> daccess ;
1217
+ (sp->daccess () == SP_DEFAULT_ACCESS) ?
1218
+ SP_DEFAULT_ACCESS_MAPPING : sp->daccess () ;
1222
1219
if (access == SP_CONTAINS_SQL ||
1223
1220
access == SP_MODIFIES_SQL_DATA)
1224
1221
{
@@ -1255,7 +1252,7 @@ sp_create_routine(THD *thd, stored_procedure_type type, sp_head *sp)
1255
1252
table->field [MYSQL_PROC_FIELD_BODY_UTF8]->set_notnull ();
1256
1253
store_failed= store_failed ||
1257
1254
table->field [MYSQL_PROC_FIELD_BODY_UTF8]->store (
1258
- sp->m_body_utf8 . str , sp-> m_body_utf8 . length , system_charset_info);
1255
+ sp->m_body_utf8 , system_charset_info);
1259
1256
1260
1257
if (store_failed)
1261
1258
{
@@ -1291,7 +1288,7 @@ sp_create_routine(THD *thd, stored_procedure_type type, sp_head *sp)
1291
1288
sp->m_params .str , sp->m_params .length ,
1292
1289
retstr.ptr (), retstr.length (),
1293
1290
sp->m_body .str , sp->m_body .length ,
1294
- sp->m_chistics , &(thd->lex ->definer ->user ),
1291
+ sp->chistics () , &(thd->lex ->definer ->user ),
1295
1292
&(thd->lex ->definer ->host ),
1296
1293
saved_mode))
1297
1294
{
@@ -1448,8 +1445,7 @@ sp_update_routine(THD *thd, stored_procedure_type type, const sp_name *name,
1448
1445
table->field [MYSQL_PROC_FIELD_ACCESS]->
1449
1446
store ((longlong)chistics->daccess , TRUE );
1450
1447
if (chistics->comment .str )
1451
- table->field [MYSQL_PROC_FIELD_COMMENT]->store (chistics->comment .str ,
1452
- chistics->comment .length ,
1448
+ table->field [MYSQL_PROC_FIELD_COMMENT]->store (chistics->comment ,
1453
1449
system_charset_info);
1454
1450
if ((ret= table->file ->ha_update_row (table->record [1 ],table->record [0 ])) &&
1455
1451
ret != HA_ERR_RECORD_IS_THE_SAME)
@@ -1792,7 +1788,7 @@ sp_find_routine(THD *thd, stored_procedure_type type, const sp_name *name,
1792
1788
}
1793
1789
if (db_load_routine (thd, type, name, &new_sp,
1794
1790
sp->m_sql_mode , sp->m_params .str , returns,
1795
- sp->m_body .str , * sp->m_chistics ,
1791
+ sp->m_body .str , sp->chistics () ,
1796
1792
&sp->m_definer .user , &sp->m_definer .host ,
1797
1793
sp->m_created , sp->m_modified ,
1798
1794
sp->get_creation_ctx ()) == SP_OK)
@@ -2201,15 +2197,15 @@ show_create_sp(THD *thd, String *buf,
2201
2197
const char *params, ulong paramslen,
2202
2198
const char *returns, ulong returnslen,
2203
2199
const char *body, ulong bodylen,
2204
- const st_sp_chistics * chistics,
2200
+ const st_sp_chistics & chistics,
2205
2201
const LEX_CSTRING *definer_user,
2206
2202
const LEX_CSTRING *definer_host,
2207
2203
sql_mode_t sql_mode)
2208
2204
{
2209
2205
sql_mode_t old_sql_mode= thd->variables .sql_mode ;
2210
2206
/* Make some room to begin with */
2211
2207
if (buf->alloc (100 + dblen + 1 + namelen + paramslen + returnslen + bodylen +
2212
- chistics-> comment .length + 10 /* length of " DEFINER= "*/ +
2208
+ chistics. comment .length + 10 /* length of " DEFINER= "*/ +
2213
2209
USER_HOST_BUFF_SIZE))
2214
2210
return FALSE ;
2215
2211
@@ -2243,7 +2239,7 @@ show_create_sp(THD *thd, String *buf,
2243
2239
buf->append (returns, returnslen);
2244
2240
}
2245
2241
buf->append (' \n ' );
2246
- switch (chistics-> daccess ) {
2242
+ switch (chistics. daccess ) {
2247
2243
case SP_NO_SQL:
2248
2244
buf->append (STRING_WITH_LEN (" NO SQL\n " ));
2249
2245
break ;
@@ -2258,14 +2254,14 @@ show_create_sp(THD *thd, String *buf,
2258
2254
/* Do nothing */
2259
2255
break ;
2260
2256
}
2261
- if (chistics-> detistic )
2257
+ if (chistics. detistic )
2262
2258
buf->append (STRING_WITH_LEN (" DETERMINISTIC\n " ));
2263
- if (chistics-> suid == SP_IS_NOT_SUID)
2259
+ if (chistics. suid == SP_IS_NOT_SUID)
2264
2260
buf->append (STRING_WITH_LEN (" SQL SECURITY INVOKER\n " ));
2265
- if (chistics-> comment .length )
2261
+ if (chistics. comment .length )
2266
2262
{
2267
2263
buf->append (STRING_WITH_LEN (" COMMENT " ));
2268
- append_unescaped (buf, chistics-> comment .str , chistics-> comment .length );
2264
+ append_unescaped (buf, chistics. comment .str , chistics. comment .length );
2269
2265
buf->append (' \n ' );
2270
2266
}
2271
2267
buf->append (body, bodylen);
@@ -2303,7 +2299,6 @@ sp_load_for_information_schema(THD *thd, TABLE *proc_table, String *db,
2303
2299
{
2304
2300
const char *sp_body;
2305
2301
String defstr;
2306
- struct st_sp_chistics sp_chistics;
2307
2302
const LEX_CSTRING definer_user= {STRING_WITH_LEN (" " )};
2308
2303
const LEX_CSTRING definer_host= {STRING_WITH_LEN (" " )};
2309
2304
LEX_CSTRING sp_db_str;
@@ -2326,15 +2321,14 @@ sp_load_for_information_schema(THD *thd, TABLE *proc_table, String *db,
2326
2321
Stored_program_creation_ctx *creation_ctx=
2327
2322
Stored_routine_creation_ctx::load_from_db (thd, &sp_name_obj, proc_table);
2328
2323
sp_body= (type == TYPE_ENUM_FUNCTION ? " RETURN NULL" : " BEGIN END" );
2329
- bzero ((char *) &sp_chistics, sizeof (sp_chistics));
2330
2324
defstr.set_charset (creation_ctx->get_client_cs ());
2331
2325
if (!show_create_sp (thd, &defstr, type,
2332
2326
sp_db_str.str , sp_db_str.length ,
2333
2327
sp_name_obj.m_name .str , sp_name_obj.m_name .length ,
2334
2328
params, strlen (params),
2335
2329
returns, strlen (returns),
2336
2330
sp_body, strlen (sp_body),
2337
- &sp_chistics , &definer_user, &definer_host, sql_mode))
2331
+ Sp_chistics () , &definer_user, &definer_host, sql_mode))
2338
2332
return 0 ;
2339
2333
2340
2334
thd->lex = &newlex;
0 commit comments