MySQL 8.3.0
Source Code Documentation
qep_row::mem_root_str Struct Reference

Helper class to keep string data in MEM_ROOT before passing to Item_string. More...

#include <opt_explain_format.h>

Public Member Functions

 mem_root_str ()
 
void cleanup ()
 
bool is_empty ()
 
bool set (const char *str_arg)
 
bool set (const String &s)
 
bool set (const char *str_arg, size_t length_arg)
 Make a copy of the string in MEM_ROOT. More...
 
void set (Lazy *x)
 Save expression for further evaluation. More...
 
void set_const (const char *str_arg)
 Make a copy of string constant. More...
 
void set_const (const char *str_arg, size_t length_arg)
 

Static Public Member Functions

static char * strndup_root (MEM_ROOT *root, const char *str, size_t len)
 

Public Attributes

const char * str
 
size_t length
 
Lazydeferred
 encapsulated expression to evaluate it later (on demand) More...
 

Detailed Description

Helper class to keep string data in MEM_ROOT before passing to Item_string.

Since Item_string constructors doesn't copy input string parameter data in the most cases, those input strings must have the same lifetime as Item_string objects, i.e. lifetime of MEM_ROOT. This class allocates input parameters for Item_string objects in MEM_ROOT.

Note
Call to is_empty() is necessary before the access to "str" and "length" fields, since is_empty() may trigger an evaluation of an associated expression that updates these fields.

Constructor & Destructor Documentation

◆ mem_root_str()

qep_row::mem_root_str::mem_root_str ( )
inline

Member Function Documentation

◆ cleanup()

void qep_row::mem_root_str::cleanup ( )
inline

◆ is_empty()

bool qep_row::mem_root_str::is_empty ( )

◆ set() [1/4]

bool qep_row::mem_root_str::set ( const char *  str_arg)
inline

◆ set() [2/4]

bool qep_row::mem_root_str::set ( const char *  str_arg,
size_t  length_arg 
)

Make a copy of the string in MEM_ROOT.

Parameters
str_argstring to copy
length_arginput string length
Returns
false if success, true if error

◆ set() [3/4]

bool qep_row::mem_root_str::set ( const String s)
inline

◆ set() [4/4]

void qep_row::mem_root_str::set ( Lazy x)
inline

Save expression for further evaluation.

Parameters
xExpression

◆ set_const() [1/2]

void qep_row::mem_root_str::set_const ( const char *  str_arg)
inline

Make a copy of string constant.

Variant of set() usable when the str_arg argument lives longer than the mem_root_str instance.

◆ set_const() [2/2]

void qep_row::mem_root_str::set_const ( const char *  str_arg,
size_t  length_arg 
)
inline

◆ strndup_root()

static char * qep_row::mem_root_str::strndup_root ( MEM_ROOT root,
const char *  str,
size_t  len 
)
inlinestatic

Member Data Documentation

◆ deferred

Lazy* qep_row::mem_root_str::deferred

encapsulated expression to evaluate it later (on demand)

◆ length

size_t qep_row::mem_root_str::length

◆ str

const char* qep_row::mem_root_str::str

The documentation for this struct was generated from the following files: