MySQL 9.1.0
Source Code Documentation
|
Represents a MySQL decimal number, type J_DECIMAL. More...
#include <json_dom.h>
Public Member Functions | |
Json_decimal (const my_decimal &value) | |
int | binary_size () const |
Get the number of bytes needed to store this decimal in a Json_opaque. More... | |
bool | get_binary (char *dest) const |
Get the binary representation of the wrapped my_decimal, so that this value can be stored inside of a Json_opaque. More... | |
enum_json_type | json_type () const override |
const my_decimal * | value () const |
Get a pointer to the MySQL decimal held by this object. More... | |
Json_dom_ptr | clone () const override |
Make a deep clone. More... | |
Public Member Functions inherited from Json_number | |
bool | is_number () const final |
Public Member Functions inherited from Json_scalar | |
uint32 | depth () const final |
Compute the depth of a document. More... | |
bool | is_scalar () const final |
Public Member Functions inherited from Json_dom | |
virtual | ~Json_dom ()=default |
void * | operator new (size_t size, const std::nothrow_t &) noexcept |
Allocate space on the heap for a Json_dom object. More... | |
void | operator delete (void *ptr) noexcept |
Deallocate the space used by a Json_dom object. More... | |
void | operator delete (void *ptr, const std::nothrow_t &) noexcept |
Nothrow delete. More... | |
Json_container * | parent () const |
Get the parent dom to which this dom is attached. More... | |
Json_path | get_location () const |
Get the path location of this dom, measured from the outermost document it nests inside. More... | |
bool | seek (const Json_seekable_path &path, size_t legs, Json_dom_vector *hits, bool auto_wrap, bool only_need_one) |
Finds all of the json sub-documents which match the path expression. More... | |
Static Public Member Functions | |
static bool | convert_from_binary (const char *bin, size_t len, my_decimal *dec) |
Convert a binary value produced by get_binary() back to a my_decimal. More... | |
static const char * | get_encoded_binary (const char *bin) |
Returns stored DECIMAL binary. More... | |
static size_t | get_encoded_binary_len (size_t length) |
Returns length of stored DECIMAL binary. More... | |
Static Public Member Functions inherited from Json_dom | |
static Json_dom_ptr | parse (const char *text, size_t length, const JsonParseErrorHandler &error_handler, const JsonErrorHandler &depth_handler) |
Parse Json text to DOM (using rapidjson). More... | |
static Json_dom_ptr | parse (const json_binary::Value &v) |
Construct a DOM object based on a binary JSON value. More... | |
Static Public Attributes | |
static const int | MAX_BINARY_SIZE = DECIMAL_MAX_FIELD_SIZE + 2 |
Private Attributes | |
my_decimal | m_dec |
holds the decimal number More... | |
Represents a MySQL decimal number, type J_DECIMAL.
|
explicit |
int Json_decimal::binary_size | ( | ) | const |
Get the number of bytes needed to store this decimal in a Json_opaque.
|
inlineoverridevirtual |
Make a deep clone.
The ownership of the returned object is henceforth with the caller.
Implements Json_dom.
|
static |
Convert a binary value produced by get_binary() back to a my_decimal.
This and two next functions help storage engine to deal with decimal value in a serialized JSON document. This function converts serialized value to my_decimal. The later two functions extract the decimal value from serialized JSON, so SE can index it in multi-valued index.
[in] | bin | decimal value in binary format |
[in] | len | length of the binary value |
[out] | dec | my_decimal object to store the value to |
bool Json_decimal::get_binary | ( | char * | dest | ) | const |
Get the binary representation of the wrapped my_decimal, so that this value can be stored inside of a Json_opaque.
dest | the destination buffer to which the binary representation is written |
|
inlinestatic |
Returns stored DECIMAL binary.
bin | serialized Json_decimal object |
|
inlinestatic |
Returns length of stored DECIMAL binary.
length | length of serialized Json_decimal object |
|
inlineoverridevirtual |
Implements Json_dom.
|
inline |
Get a pointer to the MySQL decimal held by this object.
Ownership is not transferred.
|
private |
holds the decimal number
|
static |