MySQL 8.3.0
Source Code Documentation
classic_query_param.cc File Reference
#include "classic_query_param.h"
#include <charconv>
#include <iomanip>
#include <sstream>
#include "mysqlrouter/classic_protocol_binary.h"
#include "mysqlrouter/classic_protocol_codec_binary.h"

Namespaces

namespace  classic_protocol
 
namespace  classic_protocol::borrowable
 
namespace  classic_protocol::borrowable::binary
 

Functions

template<class T >
static constexpr uint16_t binary_type ()
 
template<bool Borrowed>
std::ostream & classic_protocol::borrowable::binary::operator<< (std::ostream &os, const classic_protocol::borrowable::binary::String< Borrowed > &v)
 
template<bool Borrowed>
std::ostream & classic_protocol::borrowable::binary::operator<< (std::ostream &os, const classic_protocol::borrowable::binary::Json< Borrowed > &v)
 
template<bool Borrowed>
std::ostream & classic_protocol::borrowable::binary::operator<< (std::ostream &os, const classic_protocol::borrowable::binary::Varchar< Borrowed > &v)
 
template<bool Borrowed>
std::ostream & classic_protocol::borrowable::binary::operator<< (std::ostream &os, const classic_protocol::borrowable::binary::VarString< Borrowed > &v)
 
template<bool Borrowed>
std::ostream & classic_protocol::borrowable::binary::operator<< (std::ostream &os, const classic_protocol::borrowable::binary::Decimal< Borrowed > &v)
 
template<bool Borrowed>
std::ostream & classic_protocol::borrowable::binary::operator<< (std::ostream &os, const classic_protocol::borrowable::binary::NewDecimal< Borrowed > &v)
 
std::ostream & classic_protocol::borrowable::binary::operator<< (std::ostream &os, const classic_protocol::borrowable::binary::Double &v)
 
std::ostream & classic_protocol::borrowable::binary::operator<< (std::ostream &os, const classic_protocol::borrowable::binary::Float &v)
 
std::ostream & classic_protocol::borrowable::binary::operator<< (std::ostream &os, const classic_protocol::borrowable::binary::Tiny &v)
 
std::ostream & classic_protocol::borrowable::binary::operator<< (std::ostream &os, const classic_protocol::borrowable::binary::Int24 &v)
 
std::ostream & classic_protocol::borrowable::binary::operator<< (std::ostream &os, const classic_protocol::borrowable::binary::Short &v)
 
std::ostream & classic_protocol::borrowable::binary::operator<< (std::ostream &os, const classic_protocol::borrowable::binary::Long &v)
 
std::ostream & classic_protocol::borrowable::binary::operator<< (std::ostream &os, const classic_protocol::borrowable::binary::LongLong &v)
 
template<bool Borrowed>
std::ostream & classic_protocol::borrowable::binary::operator<< (std::ostream &os, const classic_protocol::borrowable::binary::TinyBlob< Borrowed > &v)
 
template<bool Borrowed>
std::ostream & classic_protocol::borrowable::binary::operator<< (std::ostream &os, const classic_protocol::borrowable::binary::Blob< Borrowed > &v)
 
template<bool Borrowed>
std::ostream & classic_protocol::borrowable::binary::operator<< (std::ostream &os, const classic_protocol::borrowable::binary::MediumBlob< Borrowed > &v)
 
template<bool Borrowed>
std::ostream & classic_protocol::borrowable::binary::operator<< (std::ostream &os, const classic_protocol::borrowable::binary::LongBlob< Borrowed > &v)
 
std::ostream & classic_protocol::borrowable::binary::operator<< (std::ostream &os, const classic_protocol::borrowable::binary::DatetimeBase &v)
 
std::ostream & classic_protocol::borrowable::binary::operator<< (std::ostream &os, const classic_protocol::binary::Time &v)
 
stdx::expected< std::string, std::error_code > param_to_string (const classic_protocol::borrowed::message::client::Query::Param &param)
 convert any param-type into a human readable string. More...
 
stdx::expected< uint64_t, std::error_code > param_to_number (const classic_protocol::borrowed::message::client::Query::Param &param)
 convert a numeric type into an unsigned integer. More...
 
stdx::expected< std::string, std::error_code > param_as_string (const classic_protocol::borrowed::message::client::Query::Param &param)
 convert a string-typed query param to a std::string. More...
 

Function Documentation

◆ binary_type()

template<class T >
static constexpr uint16_t binary_type ( )
staticconstexpr

◆ param_as_string()

stdx::expected< std::string, std::error_code > param_as_string ( const classic_protocol::borrowed::message::client::Query::Param param)

convert a string-typed query param to a std::string.

  • BLOB
  • TEXT
  • STRING
  • VARCHAR
  • VARSTRING

are string-types.

  • returns std::errc::bad_message if a non-string type is provided
  • returns a codec_errc if decoding the parameter fails.
Parameters
paramparameter of a query attribute
Returns
a std::string on success, a std::error_code on error.

◆ param_to_number()

stdx::expected< uint64_t, std::error_code > param_to_number ( const classic_protocol::borrowed::message::client::Query::Param param)

convert a numeric type into an unsigned integer.

◆ param_to_string()

stdx::expected< std::string, std::error_code > param_to_string ( const classic_protocol::borrowed::message::client::Query::Param param)

convert any param-type into a human readable string.