MySQL Connector/C++ 9.1.0
MySQL connector library for C and C++ applications
|
Value object can store value of scalar type, string, array or document. More...
Public Types | |
enum | Type { VNULL , UINT64 , INT64 , FLOAT , DOUBLE , BOOL , STRING , DOCUMENT , RAW , ARRAY } |
Possible types of values. More... | |
Public Member Functions | |
Value Constructors | |
Value () | |
Constructs Null value. | |
Value (std::nullptr_t) | |
Constructs Null value. | |
Value (const mysqlx::string &str) | |
Constructs Null value. | |
Value (mysqlx::string &&str) | |
Constructs Null value. | |
Value (const std::string &str) | |
Constructs Null value. | |
Value (std::string &&str) | |
Constructs Null value. | |
Value (const char *str) | |
Constructs Null value. | |
template<typename C > | |
Value (const std::basic_string< C > &str) | |
Constructs Null value. | |
template<typename C > | |
Value (const C *str) | |
Constructs Null value. | |
Value (const bytes &) | |
Constructs Null value. | |
Value (int64_t) | |
Constructs Null value. | |
Value (uint64_t) | |
Constructs Null value. | |
Value (float) | |
Constructs Null value. | |
Value (double) | |
Constructs Null value. | |
Value (bool) | |
Constructs Null value. | |
Value (const DbDoc &doc) | |
Constructs Null value. | |
Value (const std::initializer_list< Value > &list) | |
Constructs Null value. | |
template<typename Iterator > | |
Value (Iterator begin_, Iterator end_) | |
Constructs Null value. | |
Conversion to C++ Types | |
Attempt to convert value of non-compatible type throws an error. | |
typedef std::vector< Value > | Array |
Return type of the value stored in this instance (or VNULL if no value is stored). | |
enum mysqlx::abi2::r0::Value:: { ... } | m_type = VAL |
Return type of the value stored in this instance (or VNULL if no value is stored). | |
DbDoc | m_doc |
Return type of the value stored in this instance (or VNULL if no value is stored). | |
std::shared_ptr< Array > | m_arr |
Return type of the value stored in this instance (or VNULL if no value is stored). | |
friend | SessionSettings |
Return type of the value stored in this instance (or VNULL if no value is stored). | |
friend | DbDoc |
Return type of the value stored in this instance (or VNULL if no value is stored). | |
friend | Access |
Return type of the value stored in this instance (or VNULL if no value is stored). | |
operator int () const | |
Return type of the value stored in this instance (or VNULL if no value is stored). | |
operator unsigned () const | |
Return type of the value stored in this instance (or VNULL if no value is stored). | |
operator int64_t () const | |
Return type of the value stored in this instance (or VNULL if no value is stored). | |
operator uint64_t () const | |
Return type of the value stored in this instance (or VNULL if no value is stored). | |
operator float () const | |
Return type of the value stored in this instance (or VNULL if no value is stored). | |
operator double () const | |
Return type of the value stored in this instance (or VNULL if no value is stored). | |
operator bool () const | |
Return type of the value stored in this instance (or VNULL if no value is stored). | |
operator mysqlx::string () const | |
Return type of the value stored in this instance (or VNULL if no value is stored). | |
operator std::string () const | |
Return type of the value stored in this instance (or VNULL if no value is stored). | |
template<typename C > | |
operator std::basic_string< C > () const | |
Return type of the value stored in this instance (or VNULL if no value is stored). | |
operator bytes () const | |
Return type of the value stored in this instance (or VNULL if no value is stored). | |
operator DbDoc () const | |
Return type of the value stored in this instance (or VNULL if no value is stored). | |
template<typename T > | |
T | get () const |
Return type of the value stored in this instance (or VNULL if no value is stored). | |
bytes | getRawBytes () const |
Return type of the value stored in this instance (or VNULL if no value is stored). | |
Type | getType () const |
Return type of the value stored in this instance (or VNULL if no value is stored). | |
bool | isNull () const |
Convenience method for checking if value is null. | |
bool | hasField (const Field &) const |
Check if document value contains given (top-level) field. More... | |
const Value & | operator[] (const Field &) const |
If this value is not a document, throws error. More... | |
const Value & | operator[] (const char *name) const |
Return type of the value stored in this instance (or VNULL if no value is stored). | |
const Value & | operator[] (const mysqlx::string &name) const |
Return type of the value stored in this instance (or VNULL if no value is stored). | |
iterator | begin () |
Access to elements of an array value. More... | |
const_iterator | begin () const |
Return type of the value stored in this instance (or VNULL if no value is stored). | |
iterator | end () |
Return type of the value stored in this instance (or VNULL if no value is stored). | |
const_iterator | end () const |
Return type of the value stored in this instance (or VNULL if no value is stored). | |
size_t | elementCount () const |
Return type of the value stored in this instance (or VNULL if no value is stored). | |
const Value & | operator[] (unsigned) const |
Return type of the value stored in this instance (or VNULL if no value is stored). | |
const Value & | operator[] (int pos) const |
Return type of the value stored in this instance (or VNULL if no value is stored). | |
void | print (std::ostream &out) const |
Print the value to a stream. | |
void | check_type (Type t) const |
Return type of the value stored in this instance (or VNULL if no value is stored). | |
bool | is_expr () const |
Return type of the value stored in this instance (or VNULL if no value is stored). | |
void | set_as_expr () |
Return type of the value stored in this instance (or VNULL if no value is stored). | |
Value object can store value of scalar type, string, array or document.
Implicit conversions to and from corresponding C++ types are defined. If conversion to wrong type is attempted, an error is thrown. If Value object holds an array or document, then array elements or fields of the document can be accessed using operator[]. Array values can be used as STL containers.
Only direct conversions of stored value to the corresponding C++ type are supported. There are no implicit number->string conversions etc.
Values of type RAW can refer to a region of memory containing raw bytes. Such values are created from bytes
and can by casted to bytes
type.
enum Type |
Possible types of values.
|
inline |
Check if document value contains given (top-level) field.
Throws error if this is not a document value.
|
inline |
If this value is not a document, throws error.
Otherwise returns value of given field of the document.
|
inline |
Access to elements of an array value.
If non-array value is accessed like an array, an error is thrown.