MySQL Connector/C++ 9.1.0
MySQL connector library for C and C++ applications
|
Represents a single row from a result that contains rows. More...
Public Member Functions | |
bytes | getBytes (col_count_t pos) const |
Get raw bytes representing value of row field at position pos . More... | |
Value & | get (col_count_t pos) |
Get reference to row field at position pos . More... | |
Value & | set (col_count_t pos, const Value &val) |
Set value of row field at position pos . More... | |
const Value & | operator[] (col_count_t pos) const |
Get const reference to row field at position pos . More... | |
Value & | operator[] (col_count_t pos) |
Get modifiable reference to row field at position pos . More... | |
bool | isNull () const |
Check if this row contains fields or is null. | |
Represents a single row from a result that contains rows.
Such a row consists of a number of fields, each storing single value. The number of fields and types of values stored in each field are described by RowResult
instance that produced this row.
Values of fields can be accessed with get()
method or using row[pos]
expression. Fields are identified by 0-based position. It is also possible to get raw bytes representing value of a given field with getBytes()
method.
Value
class.
|
inline |
Get raw bytes representing value of row field at position pos
.
The raw bytes are as received from the server. In genral the value is represented using x-protocol encoding that corresponds to the type and other meta-data of the given column. This meta-data can be accessed via Column
object returned by RowResult#getColumn()
method.
The x-protocol represenation of different value types is documented here. Most types reported by Column#getType()
method correspond to an x-protocol value type of the same name.
All integer types use the x-protocol UINT or SINT encoding, which is the protobuf variant encoding together with zig-zag encoding for the signed case (see https://developers.google.com/protocol-buffers/docs/encoding)
STRING values are encoded using the character set encoding as reported by Column#getCharacterSet()
method of the corresponding Column
object (usually utf8mb4
).
JSON data is represented as a JSON string. ENUM values are represented as strings with enum constant names. Values of type DATE and TIMESTAMP use the same representation as DATETIME, with time part empty in case of DATE values. GEOMETRY values use the internal geometry storage format described here.
Note that raw representation of BYTES and STRING values has an extra 0x00 byte added at the end, which is not part of the originial data. It is used to distinguish null values from empty byte sequences.
out_of_range | if given row was not fetched from server. |
|
inline |
Get reference to row field at position pos
.
out_of_range | if given field does not exist in the row. |
Set value of row field at position pos
.
Creates new field if it does not exist.
|
inline |
Get const reference to row field at position pos
.
This is const version of method get()
.
out_of_range | if given field does not exist in the row. |
|
inline |
Get modifiable reference to row field at position pos
.
The field is created if it does not exist. In this case the initial value of the field is NULL.