26#ifndef TEMPTABLE_COLUMN_H
27#define TEMPTABLE_COLUMN_H
45 const unsigned char *mysql_row,
49 const Field &mysql_field);
56 const unsigned char *mysql_row)
const;
63 unsigned char *mysql_row,
65 size_t mysql_row_length)
const;
73 const unsigned char *mysql_row)
const;
80 unsigned char *mysql_row,
82 size_t mysql_row_length)
const;
97 const unsigned char *mysql_row,
99 size_t mysql_row_length)
const;
107 const unsigned char *data,
109 uint32_t data_length,
111 unsigned char *mysql_row,
113 size_t mysql_row_length)
const;
136 uint32_t data_length,
138 const unsigned char *mysql_row,
146 const unsigned char *data,
148 uint32_t data_length,
150 unsigned char *mysql_row,
160 uint32_t data_length,
162 const unsigned char *mysql_row,
171 const unsigned char *data,
173 uint32_t data_length,
175 unsigned char *mysql_row,
184 const unsigned char *mysql_row)
const;
190 const unsigned char *mysql_row)
const;
226typedef std::vector<Column, Allocator<Column>>
Columns;
239 size_t mysql_row_length
249 *b &= ~m_null_bitmask;
259 const unsigned char *mysql_row)
const {
270 const unsigned char *
p = mysql_row +
m_offset;
275 return *
p | (*(
p + 1) << 8);
277 return *
p | (*(
p + 1) << 8) | (*(
p + 2) << 16);
279 return *
p | (*(
p + 1) << 8) | (*(
p + 2) << 16) | (*(
p + 3) << 24);
287 uint32_t data_length,
unsigned char *mysql_row,
300 assert(data_length <= 0xFF);
304 assert(data_length <= 0xFFFF);
305 p[0] = (data_length & 0x000000FF);
306 p[1] = (data_length & 0x0000FF00) >> 8;
309 assert(data_length <= 0xFFFFFF);
310 p[0] = (data_length & 0x000000FF);
311 p[1] = (data_length & 0x0000FF00) >> 8;
312 p[2] = (data_length & 0x00FF0000) >> 16;
316 p[0] = (data_length & 0x000000FF);
317 p[1] = (data_length & 0x0000FF00) >> 8;
318 p[2] = (data_length & 0x00FF0000) >> 16;
319 p[3] = (data_length & 0xFF000000) >> 24;
327 const unsigned char *mysql_row,
328 size_t mysql_row_length)
const {
337 uint32_t data_length,
338 unsigned char *mysql_row,
339 size_t mysql_row_length)
const {
353 unsigned char *data, uint32_t data_length,
const unsigned char *mysql_row,
361 memcpy(data,
p, data_length);
365 const unsigned char *data, uint32_t data_length,
unsigned char *mysql_row,
369 if (data_length > 0) {
374 memcpy(
p, data, data_length);
379 unsigned char *data, uint32_t data_length,
const unsigned char *mysql_row,
385 const unsigned char *ptr_to_data;
391 memcpy(&ptr_to_data,
p,
sizeof(ptr_to_data));
393 assert((ptr_to_data) || (data_length == 0));
395 memcpy(data, ptr_to_data, data_length);
400 unsigned char *mysql_row,
408 const unsigned char *ptr_to_data = data;
413 memcpy(
p, &ptr_to_data,
sizeof(ptr_to_data));
417 const unsigned char *mysql_row)
const {
426 const unsigned char *mysql_row)
const {
433 const unsigned char *mysql_row)
const {
438 const unsigned char *data_ptr;
441 memcpy(&data_ptr,
p,
sizeof(data_ptr));
A column class that describes the metadata of a column.
Definition: column.h:40
bool m_is_blob
True if it is a blob.
Definition: column.h:196
uint32_t m_user_data_offset
The offset of the user data from the start of the mysql row in bytes.
Definition: column.h:222
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:398
bool m_nullable
True if can be NULL.
Definition: column.h:193
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:204
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:286
bool is_nullable() const
Check if the cells in this column can be NULL.
Definition: column.h:230
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:364
bool is_blob() const
Check this column stores blobs.
Definition: column.h:232
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:425
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:378
bool read_is_null(const unsigned char *mysql_row) const
Check if a particular cell is NULL.
Definition: column.h:234
uint8_t m_null_bitmask
Bitmask to extract is is-NULL bit from the is-NULL byte.
Definition: column.h:199
uint32_t m_length
Length of the user data of a cell.
Definition: column.h:209
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:258
uint32_t m_offset
Offset of the bytes that indicate the user data length of a cell.
Definition: column.h:213
uint32_t m_null_byte_offset
The offset of the is-NULL byte from the start of the mysql row.
Definition: column.h:219
bool is_fixed_size() const
Check if different cells that belong to this column can have different size (eg VARCHAR).
Definition: column.h:256
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:352
Column(const unsigned char *mysql_row, const TABLE &mysql_table TEMPTABLE_UNUSED_NODBUG, const Field &mysql_field)
Constructor.
Definition: column.cc:38
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:238
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:432
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:336
const unsigned char * get_user_data_ptr(const unsigned char *mysql_row) const
Return pointer to user data in MySQL row.
Definition: column.h:416
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:326
const char * p
Definition: ctype-mb.cc:1234
TempTable miscellaneous helper utilities declarations.
#define TEMPTABLE_UNUSED_NODBUG
Definition: misc.h:38
#define TEMPTABLE_UNUSED
Definition: misc.h:33
void my_abort()
Calls our own implementation of abort, if specified, or std's abort().
Definition: my_init.cc:260
#define DBUG_ABORT()
Definition: my_dbug.h:201
Definition: allocator.h:44
std::vector< Column, Allocator< Column > > Columns
A type that designates all the columns of a table.
Definition: column.h:226
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:45
TempTable custom allocator.