Skip to content

Commit d7871c3

Browse files
Dyre TjeldvollDyre Tjeldvoll
authored andcommitted
Bug #24481933: STD::BASIC_STRING INSTANTIATION W/ PFS INSTRUMENTATION FOR THE DD
Patch 4: Replace all usage of std::string and std::stringstream in the DD code with dd::String and dd::Stringstream_type. This is just a syntactic change at this point since the new typedefs still refer to std::string and std::stringstream. But it does make it possible to check that the correct headers have been included and the correct form of the new typenames (bare or namespace qualified) have been used. To avoid the inclusion of dd/string_type.h header in handler.h, the following additional changes were included: 1) Removal of the ha_resolve_by_name_raw overload for dd::String_type 2) Creation of a template function lex_cstring_handle() in strfunc.h which takes an std::string-like argument and returns a MYSQL_LEX_CSTRING which references the c_str() of the std::string-like object. 3) Use MYSQL_LEX_CSTRING, rather than sdi_t (alias for dd::String_type) to pass SDIs in the handler interface.
1 parent 03e7c85 commit d7871c3

File tree

200 files changed

+1491
-1494
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

200 files changed

+1491
-1494
lines changed

sql/dd/cache/dictionary_client.h

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ class Dictionary_client
358358
*/
359359

360360
template <typename T>
361-
bool acquire(const std::string &object_name, const T** object);
361+
bool acquire(const String_type &object_name, const T** object);
362362

363363

364364
/**
@@ -382,7 +382,7 @@ class Dictionary_client
382382
*/
383383

384384
template <typename T>
385-
bool acquire_uncached(const std::string &object_name, const T** object);
385+
bool acquire_uncached(const String_type &object_name, const T** object);
386386

387387

388388
/**
@@ -408,7 +408,7 @@ class Dictionary_client
408408
*/
409409

410410
template <typename T>
411-
bool acquire(const std::string &schema_name, const std::string &object_name,
411+
bool acquire(const String_type &schema_name, const String_type &object_name,
412412
const T** object);
413413

414414

@@ -441,7 +441,7 @@ class Dictionary_client
441441
*/
442442

443443
template <typename T>
444-
bool acquire(const std::string &schema_name, const std::string &object_name,
444+
bool acquire(const String_type &schema_name, const String_type &object_name,
445445
const typename T::cache_partition_type** object);
446446

447447

@@ -473,8 +473,8 @@ class Dictionary_client
473473
*/
474474

475475
template <typename T>
476-
bool acquire_uncached(const std::string &schema_name,
477-
const std::string &object_name,
476+
bool acquire_uncached(const String_type &schema_name,
477+
const String_type &object_name,
478478
const T** object);
479479

480480

@@ -495,7 +495,7 @@ class Dictionary_client
495495
object of a wrong type was found).
496496
*/
497497

498-
bool acquire_uncached_table_by_se_private_id(const std::string &engine,
498+
bool acquire_uncached_table_by_se_private_id(const String_type &engine,
499499
Object_id se_private_id,
500500
const Table **table);
501501

@@ -512,7 +512,7 @@ class Dictionary_client
512512
*/
513513

514514
bool acquire_uncached_table_by_partition_se_private_id(
515-
const std::string &engine,
515+
const String_type &engine,
516516
Object_id se_partition_id,
517517
const Table **table);
518518

@@ -531,10 +531,10 @@ class Dictionary_client
531531
@retval true Error.
532532
*/
533533

534-
bool get_table_name_by_se_private_id(const std::string &engine,
534+
bool get_table_name_by_se_private_id(const String_type &engine,
535535
Object_id se_private_id,
536-
std::string *schema_name,
537-
std::string *table_name);
536+
String_type *schema_name,
537+
String_type *table_name);
538538

539539

540540
/**
@@ -551,10 +551,10 @@ class Dictionary_client
551551
@retval true Error.
552552
*/
553553

554-
bool get_table_name_by_partition_se_private_id(const std::string &engine,
554+
bool get_table_name_by_partition_se_private_id(const String_type &engine,
555555
Object_id se_partition_id,
556-
std::string *schema_name,
557-
std::string *table_name);
556+
String_type *schema_name,
557+
String_type *table_name);
558558

559559

560560
/**
@@ -571,8 +571,8 @@ class Dictionary_client
571571
*/
572572

573573
bool get_table_name_by_trigger_name(Object_id schema_id,
574-
const std::string &trigger_name,
575-
std::string *table_name);
574+
const String_type &trigger_name,
575+
String_type *table_name);
576576

577577

578578
/**
@@ -585,7 +585,7 @@ class Dictionary_client
585585
@return false Success.
586586
*/
587587

588-
bool get_tables_max_se_private_id(const std::string &engine,
588+
bool get_tables_max_se_private_id(const String_type &engine,
589589
Object_id *max_id);
590590

591591

@@ -606,7 +606,7 @@ class Dictionary_client
606606
template <typename T>
607607
bool fetch_schema_component_names(
608608
const Schema *schema,
609-
std::vector<std::string> *names) const;
609+
std::vector<String_type> *names) const;
610610

611611

612612
/**
@@ -856,8 +856,8 @@ class Dictionary_client
856856
@return true - on failure
857857
@return false - on success
858858
*/
859-
bool remove_table_dynamic_statistics(const std::string &schema_name,
860-
const std::string &table_name);
859+
bool remove_table_dynamic_statistics(const String_type &schema_name,
860+
const String_type &table_name);
861861

862862
/**
863863
Make a dictionary object sticky or not in the cache.

sql/dd/cache/element_map.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -19,7 +19,6 @@
1919
#include "my_global.h" // DBUG_ASSERT() etc.
2020
#include "malloc_allocator.h" // Malloc_allocator.
2121

22-
#include <string> // std::string
2322
#include <cstddef> // size_t
2423
#include <map> // std::map
2524
#include <set> // std::set

sql/dd/dd_event.cc

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,8 @@ static Event::enum_interval_field get_enum_interval_field(
250250

251251
bool
252252
event_exists(dd::cache::Dictionary_client *dd_client,
253-
const std::string &schema_name,
254-
const std::string &event_name,
253+
const String_type &schema_name,
254+
const String_type &event_name,
255255
bool *exists)
256256
{
257257
DBUG_ENTER("dd::event_exists");
@@ -286,9 +286,9 @@ event_exists(dd::cache::Dictionary_client *dd_client,
286286
*/
287287

288288
static void set_event_attributes(THD *thd, Event *event,
289-
const std::string &event_name,
290-
const std::string &event_body,
291-
const std::string &event_body_utf8,
289+
const String_type &event_name,
290+
const String_type &event_body,
291+
const String_type &event_body_utf8,
292292
const LEX_USER *definer,
293293
Event_parse_data *event_data,
294294
bool is_update)
@@ -355,7 +355,7 @@ static void set_event_attributes(THD *thd, Event *event,
355355
DBUG_ASSERT(is_update);
356356

357357
if (event_data->comment.str != nullptr)
358-
event->set_comment(std::string(event_data->comment.str));
358+
event->set_comment(String_type(event_data->comment.str));
359359

360360
// Set collation relate attributes.
361361
event->set_client_collation_id(
@@ -377,10 +377,10 @@ static void set_event_attributes(THD *thd, Event *event,
377377

378378

379379
bool create_event(THD *thd,
380-
const std::string &schema_name,
381-
const std::string &event_name,
382-
const std::string &event_body,
383-
const std::string &event_body_utf8,
380+
const String_type &schema_name,
381+
const String_type &event_name,
382+
const String_type &event_body,
383+
const String_type &event_body_utf8,
384384
const LEX_USER *definer,
385385
Event_parse_data *event_data)
386386
{
@@ -421,10 +421,10 @@ bool create_event(THD *thd,
421421

422422

423423
bool update_event(THD *thd, const Event *event,
424-
const std::string &new_db_name,
425-
const std::string &new_event_name,
426-
const std::string &new_event_body,
427-
const std::string &new_event_body_utf8,
424+
const String_type &new_db_name,
425+
const String_type &new_event_name,
426+
const String_type &new_event_body,
427+
const String_type &new_event_body_utf8,
428428
const LEX_USER *definer,
429429
Event_parse_data *event_data)
430430
{

sql/dd/dd_event.h

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@
1919
#include "my_global.h"
2020

2121
#include "my_time.h" // interval_type
22+
#include "dd/string_type.h" // dd::String_type
2223
#include "dd/types/event.h" // dd::Event::enum_event_status
2324

24-
#include <string>
25-
2625
class Event_parse_data;
2726
class sp_head;
2827
class THD;
@@ -80,8 +79,8 @@ interval_type get_old_interval_type(Event::enum_interval_field interval_field);
8079
@retval false Success.
8180
*/
8281
bool event_exists(dd::cache::Dictionary_client *dd_client,
83-
const std::string &schema_name,
84-
const std::string &name,
82+
const String_type &schema_name,
83+
const String_type &name,
8584
bool *exists);
8685

8786
/**
@@ -98,9 +97,9 @@ bool event_exists(dd::cache::Dictionary_client *dd_client,
9897
@retval true Event creation failed.
9998
@retval false Event creation succeeded.
10099
*/
101-
bool create_event(THD *thd, const std::string &schema_name,
102-
const std::string &event_name, const std::string &event_body,
103-
const std::string &event_body_utf8, const LEX_USER *definer,
100+
bool create_event(THD *thd, const String_type &schema_name,
101+
const String_type &event_name, const String_type &event_body,
102+
const String_type &event_body_utf8, const LEX_USER *definer,
104103
Event_parse_data *event_data);
105104

106105
/**
@@ -120,10 +119,10 @@ bool create_event(THD *thd, const std::string &schema_name,
120119
@retval false Event updation succeeded.
121120
*/
122121
bool update_event(THD *thd, const Event *event,
123-
const std::string &new_db_name,
124-
const std::string &new_event_name,
125-
const std::string &new_event_body,
126-
const std::string &new_event_body_utf8,
122+
const String_type &new_db_name,
123+
const String_type &new_event_name,
124+
const String_type &new_event_body,
125+
const String_type &new_event_body_utf8,
127126
const LEX_USER *definer,
128127
Event_parse_data *event_data);
129128

sql/dd/dd_routine.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ static bool fill_parameter_info_from_field(Create_field *field,
212212
// Create enum/set object.
213213
Parameter_type_element *elem_obj= param->add_element();
214214

215-
std::string interval_name(*pos, field->interval->type_lengths[i]);
215+
String_type interval_name(*pos, field->interval->type_lengths[i]);
216216

217217
elem_obj->set_name(interval_name);
218218
}

sql/dd/dd_schema.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020

2121
#include "dd/object_id.h" // Object_id
2222

23-
#include <string>
24-
2523
class MDL_ticket;
2624
class THD;
2725
typedef struct st_ha_create_information HA_CREATE_INFO;

0 commit comments

Comments
 (0)