MySQL  8.0.17
Source Code Documentation
Copy_field Class Reference

Constitutes a mapping from columns of tables in the from clause to aggregated columns. More...

#include <field.h>

Public Member Functions

 Copy_field ()
 
 Copy_field (Field *to, Field *from, bool save)
 
 Copy_field (uchar *to, Field *from)
 
void set (Field *to, Field *from, bool save)
 
void set (uchar *to, Field *from)
 copy of field to maybe null string. More...
 
void invoke_do_copy (Copy_field *f)
 
void invoke_do_copy2 (Copy_field *f)
 
Fieldfrom_field ()
 
Fieldto_field ()
 
uint from_length () const
 
uint to_length () const
 
void swap_direction ()
 

Public Attributes

ucharfrom_ptr
 
ucharto_ptr
 
ucharfrom_null_ptr
 
ucharto_null_ptr
 
uint from_bit
 
uint to_bit
 
String tmp
 

Private Types

typedef void Copy_func(Copy_field *)
 Convenience definition of a copy function returned by get_copy_func. More...
 

Private Member Functions

Copy_funcget_copy_func (Field *to, Field *from)
 
void check_and_set_temporary_null ()
 

Private Attributes

void(* m_do_copy )(Copy_field *)
 
void(* m_do_copy2 )(Copy_field *)
 
uint m_from_length
 Number of bytes in the fields pointed to by 'from_ptr' and 'to_ptr'. More...
 
uint m_to_length
 
Fieldm_from_field
 The field in the table in the from clause that is read from. More...
 
Fieldm_to_field
 

Detailed Description

Constitutes a mapping from columns of tables in the from clause to aggregated columns.

Typically, this means that they represent the mapping between columns of temporary tables used for aggregatation, but not always. They are also used for aggregation that can be executed "on the fly" without a temporary table.

Member Typedef Documentation

◆ Copy_func

typedef void Copy_field::Copy_func(Copy_field *)
private

Convenience definition of a copy function returned by get_copy_func.

Constructor & Destructor Documentation

◆ Copy_field() [1/3]

Copy_field::Copy_field ( )
inline

◆ Copy_field() [2/3]

Copy_field::Copy_field ( Field to,
Field from,
bool  save 
)
inline

◆ Copy_field() [3/3]

Copy_field::Copy_field ( uchar to,
Field from 
)
inline

Member Function Documentation

◆ check_and_set_temporary_null()

void Copy_field::check_and_set_temporary_null ( )
inlineprivate

◆ from_field()

Field* Copy_field::from_field ( )
inline

◆ from_length()

uint Copy_field::from_length ( ) const
inline

◆ get_copy_func()

Copy_field::Copy_func * Copy_field::get_copy_func ( Field to,
Field from 
)
private

◆ invoke_do_copy()

void Copy_field::invoke_do_copy ( Copy_field f)

◆ invoke_do_copy2()

void Copy_field::invoke_do_copy2 ( Copy_field f)

◆ set() [1/2]

void Copy_field::set ( Field to,
Field from,
bool  save 
)

◆ set() [2/2]

void Copy_field::set ( uchar to,
Field from 
)

copy of field to maybe null string.

If field is null then the all bytes are set to 0. if field is not null then the first byte is set to 1 and the rest of the string is the field value. The 'to' buffer should have a size of field->pack_length()+1

◆ swap_direction()

void Copy_field::swap_direction ( )

◆ to_field()

Field* Copy_field::to_field ( )
inline

◆ to_length()

uint Copy_field::to_length ( ) const
inline

Member Data Documentation

◆ from_bit

uint Copy_field::from_bit

◆ from_null_ptr

uchar* Copy_field::from_null_ptr

◆ from_ptr

uchar* Copy_field::from_ptr

◆ m_do_copy

void(* Copy_field::m_do_copy) (Copy_field *)
private

◆ m_do_copy2

void(* Copy_field::m_do_copy2) (Copy_field *)
private

◆ m_from_field

Field* Copy_field::m_from_field
private

The field in the table in the from clause that is read from.

If this Copy_field is used without a temporary table, this member is nullptr.

◆ m_from_length

uint Copy_field::m_from_length
private

Number of bytes in the fields pointed to by 'from_ptr' and 'to_ptr'.

Usually this is the number of bytes that are copied from 'from_ptr' to 'to_ptr'.

For variable-length fields (VARCHAR), the first byte(s) describe the actual length of the text. For VARCHARs with length < 256 there is 1 length byte >= 256 there is 2 length bytes Thus, if from_field is VARCHAR(10), from_length (and in most cases to_length) is 11. For VARCHAR(1024), the length is 1026.

See also
Field_varstring::length_bytes

Note that for VARCHARs, do_copy() will be do_varstring*() which only copies the length-bytes (1 or 2) + the actual length of the text instead of from/to_length bytes.

See also
get_copy_func()

◆ m_to_field

Field* Copy_field::m_to_field
private

◆ m_to_length

uint Copy_field::m_to_length
private

◆ tmp

String Copy_field::tmp

◆ to_bit

uint Copy_field::to_bit

◆ to_null_ptr

uchar * Copy_field::to_null_ptr

◆ to_ptr

uchar * Copy_field::to_ptr

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