MySQL 8.0.29
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...
 

Public Attributes

uint used_count
 The actual size of the vector (NULL may be ignored) More...
 

Private Member Functions

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

Private Attributes

const uint count
 Original 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

◆ 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.

◆ resize_and_sort()

virtual void in_vector::resize_and_sort ( )
privatepure virtual

Resize and then 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.

◆ set()

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

◆ 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

◆ count

const uint in_vector::count
private

Original size of the vector.

◆ used_count

uint in_vector::used_count

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


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