27#ifndef TEMPTABLE_COLUMN_H
28#define TEMPTABLE_COLUMN_H
46 const unsigned char *mysql_row,
50 const Field &mysql_field);
57 const unsigned char *mysql_row)
const;
64 unsigned char *mysql_row,
66 size_t mysql_row_length)
const;
74 const unsigned char *mysql_row)
const;
81 unsigned char *mysql_row,
83 size_t mysql_row_length)
const;
98 const unsigned char *mysql_row,
100 size_t mysql_row_length)
const;
108 const unsigned char *data,
110 uint32_t data_length,
112 unsigned char *mysql_row,
114 size_t mysql_row_length)
const;
137 uint32_t data_length,
139 const unsigned char *mysql_row,
147 const unsigned char *data,
149 uint32_t data_length,
151 unsigned char *mysql_row,
161 uint32_t data_length,
163 const unsigned char *mysql_row,
172 const unsigned char *data,
174 uint32_t data_length,
176 unsigned char *mysql_row,
185 const unsigned char *mysql_row)
const;
191 const unsigned char *mysql_row)
const;
227typedef std::vector<Column, Allocator<Column>>
Columns;
240 size_t mysql_row_length
250 *b &= ~m_null_bitmask;
260 const unsigned char *mysql_row)
const {
271 const unsigned char *
p = mysql_row +
m_offset;
276 return *
p | (*(
p + 1) << 8);
278 return *
p | (*(
p + 1) << 8) | (*(
p + 2) << 16);
280 return *
p | (*(
p + 1) << 8) | (*(
p + 2) << 16) | (*(
p + 3) << 24);
288 uint32_t data_length,
unsigned char *mysql_row,
301 assert(data_length <= 0xFF);
305 assert(data_length <= 0xFFFF);
306 p[0] = (data_length & 0x000000FF);
307 p[1] = (data_length & 0x0000FF00) >> 8;
310 assert(data_length <= 0xFFFFFF);
311 p[0] = (data_length & 0x000000FF);
312 p[1] = (data_length & 0x0000FF00) >> 8;
313 p[2] = (data_length & 0x00FF0000) >> 16;
317 p[0] = (data_length & 0x000000FF);
318 p[1] = (data_length & 0x0000FF00) >> 8;
319 p[2] = (data_length & 0x00FF0000) >> 16;
320 p[3] = (data_length & 0xFF000000) >> 24;
328 const unsigned char *mysql_row,
329 size_t mysql_row_length)
const {
338 uint32_t data_length,
339 unsigned char *mysql_row,
340 size_t mysql_row_length)
const {
354 unsigned char *data, uint32_t data_length,
const unsigned char *mysql_row,
362 memcpy(data,
p, data_length);
366 const unsigned char *data, uint32_t data_length,
unsigned char *mysql_row,
370 if (data_length > 0) {
375 memcpy(
p, data, data_length);
380 unsigned char *data, uint32_t data_length,
const unsigned char *mysql_row,
386 const unsigned char *ptr_to_data;
392 memcpy(&ptr_to_data,
p,
sizeof(ptr_to_data));
394 assert((ptr_to_data) || (data_length == 0));
396 memcpy(data, ptr_to_data, data_length);
401 unsigned char *mysql_row,
409 const unsigned char *ptr_to_data = data;
414 memcpy(
p, &ptr_to_data,
sizeof(ptr_to_data));
418 const unsigned char *mysql_row)
const {
427 const unsigned char *mysql_row)
const {
434 const unsigned char *mysql_row)
const {
439 const unsigned char *data_ptr;
442 memcpy(&data_ptr,
p,
sizeof(data_ptr));
A column class that describes the metadata of a column.
Definition: column.h:41
bool m_is_blob
True if it is a blob.
Definition: column.h:197
uint32_t m_user_data_offset
The offset of the user data from the start of the mysql row in bytes.
Definition: column.h:223
void write_blob_user_data(const unsigned char *data, uint32_t data_length, unsigned char *mysql_row, size_t mysql_row_length TEMPTABLE_UNUSED_NODBUG) const
Write user data stored in a cell for columns stored as BLOBs.
Definition: column.h:399
bool m_nullable
True if can be NULL.
Definition: column.h:194
uint8_t m_length_bytes_size
The number of bytes that indicate the length of the user data in the cell, for variable sized cells.
Definition: column.h:205
void write_user_data_length(uint32_t data_length, unsigned char *mysql_row, size_t mysql_row_length) const
Write the length of user data stored in a cell.
Definition: column.h:287
bool is_nullable() const
Check if the cells in this column can be NULL.
Definition: column.h:231
void write_std_user_data(const unsigned char *data, uint32_t data_length, unsigned char *mysql_row, size_t mysql_row_length TEMPTABLE_UNUSED_NODBUG) const
Write user data stored in a cell.
Definition: column.h:365
bool is_blob() const
Check this column stores blobs.
Definition: column.h:233
const unsigned char * calculate_user_data_ptr(const unsigned char *mysql_row) const
Calculate pointer to user data in a MySQL row.
Definition: column.h:426
void read_blob_user_data(unsigned char *data, uint32_t data_length, const unsigned char *mysql_row, size_t mysql_row_length TEMPTABLE_UNUSED_NODBUG) const
Reads user data stored in a cell for columns stored as BLOBs.
Definition: column.h:379
bool read_is_null(const unsigned char *mysql_row) const
Check if a particular cell is NULL.
Definition: column.h:235
uint8_t m_null_bitmask
Bitmask to extract is is-NULL bit from the is-NULL byte.
Definition: column.h:200
uint32_t m_length
Length of the user data of a cell.
Definition: column.h:210
uint32_t read_user_data_length(const unsigned char *mysql_row) const
In MySQL write_row() format - the length of the actual user data of a cell in a given row.
Definition: column.h:259
uint32_t m_offset
Offset of the bytes that indicate the user data length of a cell.
Definition: column.h:214
uint32_t m_null_byte_offset
The offset of the is-NULL byte from the start of the mysql row.
Definition: column.h:220
bool is_fixed_size() const
Check if different cells that belong to this column can have different size (eg VARCHAR).
Definition: column.h:257
void read_std_user_data(unsigned char *data, uint32_t data_length, const unsigned char *mysql_row, size_t mysql_row_length TEMPTABLE_UNUSED_NODBUG) const
Reads user data stored in a cell.
Definition: column.h:353
Column(const unsigned char *mysql_row, const TABLE &mysql_table TEMPTABLE_UNUSED_NODBUG, const Field &mysql_field)
Constructor.
Definition: column.cc:39
void write_is_null(bool is_null, unsigned char *mysql_row, size_t mysql_row_length) const
Write the information that cell is NULL or not.
Definition: column.h:239
const unsigned char * read_blob_data_ptr(const unsigned char *mysql_row) const
Reads pointer to user data for a column stored as BLOB.
Definition: column.h:433
void write_user_data(bool is_null, const unsigned char *data, uint32_t data_length, unsigned char *mysql_row, size_t mysql_row_length) const
Write user data stored in a cell.
Definition: column.h:337
const unsigned char * get_user_data_ptr(const unsigned char *mysql_row) const
Return pointer to user data in MySQL row.
Definition: column.h:417
void read_user_data(unsigned char *data, uint32_t data_length, const unsigned char *mysql_row, size_t mysql_row_length) const
Reads user data stored in a cell.
Definition: column.h:327
const char * p
Definition: ctype-mb.cc:1237
TempTable miscellaneous helper utilities declarations.
#define TEMPTABLE_UNUSED_NODBUG
Definition: misc.h:39
#define TEMPTABLE_UNUSED
Definition: misc.h:34
void my_abort()
Calls our own implementation of abort, if specified, or std's abort().
Definition: my_init.cc:258
#define DBUG_ABORT()
Definition: my_dbug.h:202
Definition: allocator.h:45
std::vector< Column, Allocator< Column > > Columns
A type that designates all the columns of a table.
Definition: column.h:227
bool buf_is_inside_another(const unsigned char *small, size_t small_length, const unsigned char *big, size_t big_length)
Check if a given buffer is inside another buffer.
Definition: misc.h:46
TempTable custom allocator.