MySQL 9.0.0
Source Code Documentation
anonymous_namespace{field.cc} Namespace Reference

Function to compare two unsigned integers for their relative order. More...

Functions

bool sql_type_prevents_inplace (const Field &from, const Create_field &to)
 Predicate to determine if a field type change prevents alter from being done inplace. More...
 
bool length_prevents_inplace (const Field &from, const Create_field &to)
 Predicate to determine if a length change prevents alter from being done inplace. More...
 
bool charset_prevents_inplace (const Field_str &from, const Create_field &to)
 Predicate to determine if a charset change prevents alter from being done inplace. More...
 
bool change_prevents_inplace (const Field_str &from, const Create_field &to)
 Predicate to determine if the difference between a Field and the new Create_field prevents alter from being done inplace. More...
 
int compare (unsigned int a, unsigned int b)
 

Detailed Description

Function to compare two unsigned integers for their relative order.

Used below. In an anonymous namespace to not clash with definitions in other files.

Function Documentation

◆ change_prevents_inplace()

bool anonymous_namespace{field.cc}::change_prevents_inplace ( const Field_str from,
const Create_field to 
)

Predicate to determine if the difference between a Field and the new Create_field prevents alter from being done inplace.

Convenience wrapper for the preceding predicates.

Parameters
from- existing Field object.
to- Create_field object describing new version of field.
Returns
true if alter cannot be done inplace due to specified condition, false otherwise.

◆ charset_prevents_inplace()

bool anonymous_namespace{field.cc}::charset_prevents_inplace ( const Field_str from,
const Create_field to 
)

Predicate to determine if a charset change prevents alter from being done inplace.

For changes other than the following, we can immediately reject using the inplace algorithm:

  • Changing collation while keeping the charset.
  • Changing any charset to the binary charset.
  • Changing utf8mb3 to utf8mb4.
Note
The changes listed above are potentially acceptable if the field is not indexed in the target table. This information is not available here, and is checked later in fill_alter_inplace_info().
ASCII cannot be converted to UTF-8 inplace because inserting non-ascii values into an ASCII column only trigger a warning not an error.
Parameters
from- existing Field object.
to- Create_field object describing new version of field.
Returns
true if alter cannot be done inplace due to specified condition, false otherwise.

◆ compare()

int anonymous_namespace{field.cc}::compare ( unsigned int  a,
unsigned int  b 
)

◆ length_prevents_inplace()

bool anonymous_namespace{field.cc}::length_prevents_inplace ( const Field from,
const Create_field to 
)

Predicate to determine if a length change prevents alter from being done inplace.

Length cannot decrease and cannot cross the 256 byte row format barrier.

Parameters
from- existing Field object.
to- Create_field object describing new version of field.
Returns
true if alter cannot be done inplace due to specified condition, false otherwise.

◆ sql_type_prevents_inplace()

bool anonymous_namespace{field.cc}::sql_type_prevents_inplace ( const Field from,
const Create_field to 
)

Predicate to determine if a field type change prevents alter from being done inplace.

Parameters
from- existing Field object.
to- Create_field object describing new version of field.
Returns
true if alter cannot be done inplace due to specified condition, false otherwise.