MySQL 8.4.2
Source Code Documentation
in_vector Class Referenceabstract

#include <item_cmpfunc.h>

Inheritance diagram for in_vector:
[legend]

Public Member Functions

 in_vector (uint elements)
 See Item_func_in::resolve_type() for why we need both count and used_count. More...
 
virtual ~in_vector ()=default
 
virtual bool find_item (Item *item)=0
 Calls item->val_int() or item->val_str() etc. More...
 
virtual Item_basic_constantcreate_item (MEM_ROOT *mem_root) const =0
 Create an instance of Item_{type} (e.g. More...
 
virtual void value_to_item (uint pos, Item_basic_constant *item) const =0
 Store the value at position pos into provided item object. More...
 
virtual bool compare_elems (uint pos1, uint pos2) const =0
 Compare values number pos1 and pos2 for equality. More...
 
virtual bool is_row_result () const
 
bool fill (Item **items, uint item_count)
 Fill the vector by evaluating the items passed as arguments. More...
 
virtual void cleanup ()
 

Public Attributes

uint m_used_size {0}
 The actual size of the vector (NULL may be ignored) More...
 

Private Member Functions

virtual void set (uint pos, Item *item)=0
 
virtual void sort_array ()=0
 Sort the IN-list array, so we can do efficient lookup with binary_search. More...
 

Private Attributes

const uint m_size
 Size of the vector. More...
 

Constructor & Destructor Documentation

◆ in_vector()

in_vector::in_vector ( uint  elements)
inlineexplicit

See Item_func_in::resolve_type() for why we need both count and used_count.

◆ ~in_vector()

virtual in_vector::~in_vector ( )
virtualdefault

Member Function Documentation

◆ cleanup()

virtual void in_vector::cleanup ( )
inlinevirtual

Reimplemented in in_string.

◆ compare_elems()

virtual bool in_vector::compare_elems ( uint  pos1,
uint  pos2 
) const
pure virtual

Compare values number pos1 and pos2 for equality.

Implemented in in_string, in_longlong, in_double, in_decimal, and in_row.

◆ create_item()

virtual Item_basic_constant * in_vector::create_item ( MEM_ROOT mem_root) const
pure virtual

Create an instance of Item_{type} (e.g.

Item_decimal) constant object which type allows it to hold an element of this vector without any conversions. The purpose of this function is to be able to get elements of this vector in form of Item_xxx constants without creating Item_xxx object for every array element you get (i.e. this implements "FlyWeight" pattern)

Parameters
mem_rootWhere to allocate the Item.

Implemented in in_row, in_string, in_longlong, in_datetime_as_longlong, in_time_as_longlong, in_datetime, in_double, and in_decimal.

◆ fill()

bool in_vector::fill ( Item **  items,
uint  item_count 
)

Fill the vector by evaluating the items passed as arguments.

Note that null values are skipped so the vector may end up containing fewer elements than the number of items. The vector is sorted so that it can be used for binary search.

Parameters
itemsItems to evaluate
item_countNumber of items
Returns
true if any null values was found, false otherwise.

◆ find_item()

virtual bool in_vector::find_item ( Item item)
pure virtual

Calls item->val_int() or item->val_str() etc.

and then does binary_search if the value is non-null.

Parameters
itemto evaluate, and lookup in the IN-list.
Returns
true if evaluated value of the item was found.

Implemented in in_string, in_longlong, in_double, in_decimal, and in_row.

◆ is_row_result()

virtual bool in_vector::is_row_result ( ) const
inlinevirtual

Reimplemented in in_row.

◆ set()

virtual void in_vector::set ( uint  pos,
Item item 
)
privatepure virtual

◆ sort_array()

virtual void in_vector::sort_array ( )
privatepure virtual

Sort the IN-list array, so we can do efficient lookup with binary_search.

Implemented in in_string, in_longlong, in_double, in_decimal, and in_row.

◆ value_to_item()

virtual void in_vector::value_to_item ( uint  pos,
Item_basic_constant item 
) const
pure virtual

Store the value at position pos into provided item object.

Parameters
posIndex of value to store
itemConstant item to store value into. The item must be of the same type that create_item() returns.

Implemented in in_string, in_longlong, in_double, in_decimal, and in_row.

Member Data Documentation

◆ m_size

const uint in_vector::m_size
private

Size of the vector.

◆ m_used_size

uint in_vector::m_used_size {0}

The actual size of the vector (NULL may be ignored)


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