MySQL 8.0.40
Source Code Documentation
Json_opaque Class Referencefinal

Represents a MySQL value opaquely, i.e. More...

#include <json_dom.h>

Inheritance diagram for Json_opaque:
[legend]

Public Member Functions

template<typename... Args>
 Json_opaque (enum_field_types mytype, Args &&...args)
 An opaque MySQL value. More...
 
enum_json_type json_type () const override
 
const char * value () const
 
enum_field_types type () const
 
size_t size () const
 
Json_dom_ptr clone () const override
 Make a deep clone. More...
 
- 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_containerparent () const
 Get the parent dom to which this dom is attached. More...
 
virtual bool is_number () const
 
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...
 

Private Attributes

enum_field_types m_mytype
 
std::string m_val
 

Additional Inherited Members

- Static Public Member Functions inherited from Json_dom
static Json_dom_ptr parse (const char *text, size_t length, const JsonParseErrorHandler &error_handler, const JsonDocumentDepthHandler &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...
 

Detailed Description

Represents a MySQL value opaquely, i.e.

the Json DOM can not serialize or deserialize these values. This should be used to store values that don't map to the other Json_scalar classes. Using the "to_string" method on such values (via Json_wrapper) will yield a base 64 encoded string tagged with the MySQL type with this syntax:

"base64:typeXX:<base 64 encoded value>"

Constructor & Destructor Documentation

◆ Json_opaque()

template<typename... Args>
Json_opaque::Json_opaque ( enum_field_types  mytype,
Args &&...  args 
)
inlineexplicit

An opaque MySQL value.

Parameters
[in]mytypethe MySQL type of the value
[in]argsarguments to construct the binary value to be stored in the DOM (anything accepted by the std::string constructors)
See also
enum_field_types
Class documentation

Member Function Documentation

◆ clone()

Json_dom_ptr Json_opaque::clone ( ) const
overridevirtual

Make a deep clone.

The ownership of the returned object is henceforth with the caller.

Returns
a cloned Json_dom object.

Implements Json_dom.

◆ json_type()

enum_json_type Json_opaque::json_type ( ) const
inlineoverridevirtual
Returns
the type corresponding to the actual Json_dom subclass

Implements Json_dom.

◆ size()

size_t Json_opaque::size ( ) const
inline
Returns
the size in bytes of the value

◆ type()

enum_field_types Json_opaque::type ( ) const
inline
Returns
the MySQL type of the value

◆ value()

const char * Json_opaque::value ( ) const
inline
Returns
a pointer to the opaque value. Use size() to get its size.

Member Data Documentation

◆ m_mytype

enum_field_types Json_opaque::m_mytype
private

◆ m_val

std::string Json_opaque::m_val
private

The documentation for this class was generated from the following files: