MySQL 9.1.0
Source Code Documentation
sql_help.cc File Reference
#include "sql/sql_help.h"
#include <assert.h>
#include <string.h>
#include <sys/types.h>
#include <algorithm>
#include <atomic>
#include <memory>
#include <string>
#include <utility>
#include "mem_root_deque.h"
#include "my_alloc.h"
#include "my_base.h"
#include "my_bitmap.h"
#include "my_dbug.h"
#include "my_inttypes.h"
#include "my_sys.h"
#include "mysql/strings/m_ctype.h"
#include "mysqld_error.h"
#include "sql/debug_sync.h"
#include "sql/field.h"
#include "sql/handler.h"
#include "sql/item.h"
#include "sql/item_cmpfunc.h"
#include "sql/iterators/basic_row_iterators.h"
#include "sql/iterators/composite_iterators.h"
#include "sql/iterators/row_iterator.h"
#include "sql/iterators/timing_iterator.h"
#include "sql/protocol.h"
#include "sql/sql_base.h"
#include "sql/sql_bitmap.h"
#include "sql/sql_class.h"
#include "sql/sql_lex.h"
#include "sql/sql_list.h"
#include "sql/sql_table.h"
#include "sql/table.h"
#include "sql_string.h"
#include "template_utils.h"
#include "thr_lock.h"
#include "typelib.h"

Classes

struct  st_find_field
 

Enumerations

enum  enum_used_fields {
  help_topic_help_topic_id = 0 , help_topic_name , help_topic_help_category_id , help_topic_description ,
  help_topic_example , help_category_help_category_id , help_category_parent_category_id , help_category_name ,
  help_keyword_help_keyword_id , help_keyword_name , help_relation_help_topic_id , help_relation_help_keyword_id
}
 

Functions

static bool init_fields (THD *thd, Table_ref *tables, struct st_find_field *find_fields, uint count)
 
static void memorize_variant_topic (THD *thd, int count, struct st_find_field *find_fields, List< String > *names, String *name, String *description, String *example)
 
static int search_topics (THD *thd, RowIterator *iterator, struct st_find_field *find_fields, List< String > *names, String *name, String *description, String *example)
 
static int search_keyword (RowIterator *iterator, struct st_find_field *find_fields, int *key_id)
 
static int get_topics_for_keyword (THD *thd, TABLE *topics, TABLE *relations, struct st_find_field *find_fields, int16 key_id, List< String > *names, String *name, String *description, String *example)
 
static int search_categories (THD *thd, RowIterator *iterator, struct st_find_field *find_fields, List< String > *names, int16 *res_id)
 Look for categories by mask. More...
 
static void get_all_items_for_category (THD *thd, RowIterator *iterator, Field *pfname, List< String > *res)
 
static int send_answer_1 (THD *thd, String *s1, String *s2, String *s3)
 
static int send_header_2 (THD *thd, bool for_category)
 
static int send_variant_2_list (MEM_ROOT *mem_root, Protocol *protocol, List< String > *names, const char *cat, String *source_name)
 
static unique_ptr_destroy_only< RowIteratorprepare_simple_query_block (THD *thd, Item *cond, TABLE *table)
 Prepare access method to do "SELECT * FROM table WHERE <cond>". More...
 
static unique_ptr_destroy_only< RowIteratorprepare_select_for_name (THD *thd, const char *mask, size_t mlen, TABLE *table, Field *pfname)
 Prepare access method to do "SELECT * FROM table LIKE mask". More...
 
bool mysqld_help (THD *thd, const char *mask)
 

Variables

static struct st_find_field init_used_fields []
 

Enumeration Type Documentation

◆ enum_used_fields

Enumerator
help_topic_help_topic_id 
help_topic_name 
help_topic_help_category_id 
help_topic_description 
help_topic_example 
help_category_help_category_id 
help_category_parent_category_id 
help_category_name 
help_keyword_help_keyword_id 
help_keyword_name 
help_relation_help_topic_id 
help_relation_help_keyword_id 

Function Documentation

◆ get_all_items_for_category()

static void get_all_items_for_category ( THD thd,
RowIterator iterator,
Field pfname,
List< String > *  res 
)
static

◆ get_topics_for_keyword()

static int get_topics_for_keyword ( THD thd,
TABLE topics,
TABLE relations,
struct st_find_field find_fields,
int16  key_id,
List< String > *  names,
String name,
String description,
String example 
)
static

◆ init_fields()

static bool init_fields ( THD thd,
Table_ref tables,
struct st_find_field find_fields,
uint  count 
)
static

◆ memorize_variant_topic()

static void memorize_variant_topic ( THD thd,
int  count,
struct st_find_field find_fields,
List< String > *  names,
String name,
String description,
String example 
)
static

◆ mysqld_help()

bool mysqld_help ( THD thd,
const char *  mask 
)

◆ prepare_select_for_name()

static unique_ptr_destroy_only< RowIterator > prepare_select_for_name ( THD thd,
const char *  mask,
size_t  mlen,
TABLE table,
Field pfname 
)
static

Prepare access method to do "SELECT * FROM table LIKE mask".

Parameters
thdThread handler
maskmask for compare with name
mlenlength of mask
tablegoal table
pfnamefield "name" in table
Returns
an iterator, or nullptr if error
See also
prepare_simple_query_block()

◆ prepare_simple_query_block()

static unique_ptr_destroy_only< RowIterator > prepare_simple_query_block ( THD thd,
Item cond,
TABLE table 
)
static

Prepare access method to do "SELECT * FROM table WHERE <cond>".

Parameters
thdThread handler
condWHERE part of select
tablegoal table
Returns
an iterator, or nullptr if error

◆ search_categories()

static int search_categories ( THD thd,
RowIterator iterator,
struct st_find_field find_fields,
List< String > *  names,
int16 res_id 
)
static

Look for categories by mask.

Parameters
thdTHD for init_table_iterator
iteratorIterator giving categories.
find_fieldsFilled array of info for fields
namesList of found categories names (out)
res_idPrimary index of found category (only if found exactly one category)
Returns
Number of categories found

◆ search_keyword()

static int search_keyword ( RowIterator iterator,
struct st_find_field find_fields,
int *  key_id 
)
static

◆ search_topics()

static int search_topics ( THD thd,
RowIterator iterator,
struct st_find_field find_fields,
List< String > *  names,
String name,
String description,
String example 
)
static

◆ send_answer_1()

static int send_answer_1 ( THD thd,
String s1,
String s2,
String s3 
)
static

◆ send_header_2()

static int send_header_2 ( THD thd,
bool  for_category 
)
static

◆ send_variant_2_list()

static int send_variant_2_list ( MEM_ROOT mem_root,
Protocol protocol,
List< String > *  names,
const char *  cat,
String source_name 
)
static

Variable Documentation

◆ init_used_fields

struct st_find_field init_used_fields[]
static
Initial value:
= {
{"help_topic", "help_topic_id", nullptr},
{"help_topic", "name", nullptr},
{"help_topic", "help_category_id", nullptr},
{"help_topic", "description", nullptr},
{"help_topic", "example", nullptr},
{"help_category", "help_category_id", nullptr},
{"help_category", "parent_category_id", nullptr},
{"help_category", "name", nullptr},
{"help_keyword", "help_keyword_id", nullptr},
{"help_keyword", "name", nullptr},
{"help_relation", "help_topic_id", nullptr},
{"help_relation", "help_keyword_id", nullptr}}