383#ifndef TEMPTABLE_ROW_H
384#define TEMPTABLE_ROW_H
436 size_t mysql_row_length)
const;
443 unsigned char *mysql_row,
445 size_t mysql_row_length)
const;
470 Field **mysql_fields);
491 const Column &column)
const;
525 : m_allocator(allocator),
526 m_data_is_in_mysql_memory(true),
527 m_ptr(const_cast<unsigned char *>(mysql_row)) {}
545 assert(
m_ptr !=
nullptr);
546 return reinterpret_cast<Cell *
>(
m_ptr +
sizeof(size_t));
558 return Cell{is_null, data_length, data_ptr};
563 assert(
m_ptr !=
nullptr);
564 return *
reinterpret_cast<size_t *
>(
m_ptr);
TempTable Cell declaration.
Custom memory allocator.
Definition: allocator.h:435
A cell is the intersection of a row and a column.
Definition: cell.h:42
A column class that describes the metadata of a column.
Definition: column.h:41
bool read_is_null(const unsigned char *mysql_row) const
Check if a particular cell is NULL.
Definition: column.h:235
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
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
A row representation.
Definition: row.h:402
Row(const unsigned char *mysql_row, Allocator< uint8_t > *allocator)
Definition: row.h:524
Row & operator=(Row &&rhs)=delete
Move assignment.
Cell * cells() const
Get a pointer to the cells array.
Definition: row.h:543
static void swap(Row &r1, Row &r2)
Swaps contents of two rows.
Definition: row.h:518
Allocator< uint8_t > * m_allocator
Allocator to use when copying from MySQL row to our own memory.
Definition: row.h:499
unsigned char * m_ptr
A pointer to either the mysql row, or our buffer.
Definition: row.h:513
Cell cell_in_row(size_t i) const
Get a given cell.
Definition: row.h:549
Cell cell(const Column &column, size_t i) const
Get a given cell.
Definition: row.h:535
Result copy_to_own_memory(const Columns &columns, size_t mysql_row_length) const
Copy the user data to an own buffer (convert from write_row() format).
Definition: row.cc:64
Row & operator=(const Row &)=delete
Copy assignment is disabled because it is too expensive.
void copy_to_mysql_row(const Columns &columns, unsigned char *mysql_row, size_t mysql_row_length) const
Copy the row in a MySQL buffer (convert to write_row() format).
Definition: row.cc:114
size_t buf_length() const
Derives the length of the buffer pointed to by m_ptr in bytes (when m_data_is_in_mysql_memory is fals...
Definition: row.h:561
~Row()
Destructor.
Definition: row.h:529
Cell cell_in_mysql_memory(const Column &column) const
Get a given cell.
Definition: row.h:551
bool m_data_is_in_mysql_memory
Indicate whether this object is lightweight, with just pointers to the MySQL row buffer or not.
Definition: row.h:503
Row(const Row &)=delete
Copy constructing is disabled because it is too expensive.
static int compare(const Row &lhs, const Row &rhs, const Columns &columns, Field **mysql_fields)
Compare to another row.
Definition: row.cc:46
Row(Row &&other)=delete
Move constructor.
Definition: allocator.h:45
Result
Definition: result.h:34
std::vector< Column, Allocator< Column > > Columns
A type that designates all the columns of a table.
Definition: column.h:227
static void swap(String &a, String &b) noexcept
Definition: sql_string.h:663
TempTable custom allocator.
TempTable Column declaration.
TempTable auxiliary Result enum.