#include <stddef.h>
#include "my_inttypes.h"
Go to the source code of this file.
|
namespace | dd |
| The version of the current data dictionary table definitions.
|
|
◆ max_pack_length()
Find the largest field among a list of create fields.
Iterates over the list of create fields and find the largest one, i.e. the field with largest pack length.
- Parameters
-
create_fields | List of create fields. |
- Returns
- Size of the largest field, as number of bytes.
◆ prepare_default_value()
Prepare the default value of a single column.
This function creates a fake field using the submitted fake table object, which also has assigned a fake table share. The field is create in order to use existing code to store the default value. The value is stored into the submitted buffer, which has been allocated in advance (and will be deleted afterwards). The fake table and share are required by the field infrastructure.
After storing the default value into the buffer, the value is read back and copied into the column object's default value field. For bit fields with leftover bits in the preamble, these bits are copied and appended onto the default value as the last byte.
- Parameters
-
| thd | Thread context. |
| buf | Buffer to store the default value into. The buffer size must be at least two bytes. |
| table | Fake table to use when storing the default value. |
| field | Create_field corresponding to the column object. |
[in,out] | col_obj | Column for which to prepare the default value. |
- Return values
-
true | Failure. |
false | Success. |
◆ prepare_default_value_buffer_and_table_share()
Prepare the default value buffer for an empty record.
This function prepares the buffer based on the objects retrieved from the data dictionary. The function will scan the columns of the submitted table objects and calculate the length of the record, the number of null bits, etc. The empty buffer is allocated, and all bits are set to 0, including used null bits, the actual field values, etc. Afterwards, the unused bits in the preamble, up to the next full byte border, are set to 1. Finally, the buffer is assigned to the 'TABLE_SHARE::default_values' field.
- Note
- This function does not fill in the actual default values, it just allocates and prepares the buffer.
- Parameters
-
| thd | Thread context. |
| table | Table for which the default value buffer should be prepared. |
[in,out] | share | Table share for the table. The default value buffer is assigned to the appropriate table share field. |
- Return values
-
true | Failure. |
false | Success. |