MySQL 9.6.0
Source Code Documentation
s_mysql_mysql_json_encode Struct Reference

A specialized service that transcodes input text from specified encoding into UTF-8 (MB4) and escapes JSON characters. More...

#include <mysql_json_encode.h>

Public Attributes

const unsigned char *(* encode )(const unsigned char *src, const unsigned char *src_end, const unsigned char *src_data_end, unsigned char *dst, unsigned char *dst_end, const CHARSET_INFO_h charset, unsigned char **dst_out)
 Transcode input buffer (a chunk of data) into destination buffer. More...
 

Detailed Description

A specialized service that transcodes input text from specified encoding into UTF-8 (MB4) and escapes JSON characters.

Regular encoders require that a source is placed in single buffer and the size of the output buffer cannot be determined (it must be counted). This service allows to transcode input buffer in chunks.

Member Data Documentation

◆ encode

const unsigned char *(* s_mysql_mysql_json_encode::encode) (const unsigned char *src, const unsigned char *src_end, const unsigned char *src_data_end, unsigned char *dst, unsigned char *dst_end, const CHARSET_INFO_h charset, unsigned char **dst_out)

Transcode input buffer (a chunk of data) into destination buffer.

Parameters
[in]srcInput buffer pointer.
[in]src_endWhen dividing input stream into smaller chunks, this pointer must be set to src_data_end - max_encoded_char - 1, where max_encoded_char is the maximum lenght of the character in the specified encoding (charset argument). This ensures that a partial character is not consumed. The last chunk should be called with src_end == src_data_end and the returned pointer should point to src_data_end.
[in]src_data_endInput buffer end pointer.
[in]dstDestination buffer.
[in]dst_endDestination buffer end. The buffer should be at least 6 buffer long (JSON encodes single character as \uXXXX), which can be a case in a single encode method call.
[in]charsetInput data encoding.
[out]dst_outPointer ending the transcoded data buffer. The pointer is not part of the transcoded data.
Returns
Pointer to the next data withing the input buffer to be transcoded.

The documentation for this struct was generated from the following file: