MySQL 8.0.29
Source Code Documentation File Reference

TABLE SESSION_CONNECT (abstract). More...

#include "storage/perfschema/table_session_connect.h"
#include <assert.h>
#include "my_compiler.h"
#include "my_inttypes.h"
#include "sql/field.h"
#include "sql/table.h"
#include "storage/perfschema/pfs_buffer_container.h"


static bool parse_length_encoded_string (const char **ptr, char *dest, uint dest_size, uint *copied_len, const char *start_ptr, uint input_length, const CHARSET_INFO *from_cs, uint nchars_max)
 Take a length encoded string. More...
bool read_nth_attr (const char *connect_attrs, uint connect_attrs_length, const CHARSET_INFO *connect_attrs_cs, uint ordinal, char *attr_name, uint max_attr_name, uint *attr_name_length, char *attr_value, uint max_attr_value, uint *attr_value_length)
 Take the nth attribute name/value pair. More...

Detailed Description


Function Documentation

◆ parse_length_encoded_string()

static bool parse_length_encoded_string ( const char **  ptr,
char *  dest,
uint  dest_size,
uint copied_len,
const char *  start_ptr,
uint  input_length,
const CHARSET_INFO from_cs,
uint  nchars_max 

Take a length encoded string.

  • ptr inout the input string array
  • dest where to store the result
  • dest_size max size of dest
  • copied_len the actual length of the data copied
  • start_ptr pointer to the start of input
  • input_length the length of the incoming data
  • from_cs character set in which ptr is encoded
  • nchars_max maximum number of characters to read
    Return values
    trueparsing failed
    falseparsing succeeded

◆ read_nth_attr()

bool read_nth_attr ( const char *  connect_attrs,
uint  connect_attrs_length,
const CHARSET_INFO connect_attrs_cs,
uint  ordinal,
char *  attr_name,
uint  max_attr_name,
uint attr_name_length,
char *  attr_value,
uint  max_attr_value,
uint attr_value_length 

Take the nth attribute name/value pair.

Parse the attributes blob form the beginning, skipping the attributes whose number is lower than the one we seek. When we reach the attribute at an index we're looking for the values are copied to the output parameters. If parsing fails or no more attributes are found the function stops and returns an error code.

connect_attrspointer to the connect attributes blob
connect_attrs_lengthlength of connect_attrs
connect_attrs_cscharacter set used to encode connect_attrs
ordinalindex of the attribute we need
[out]attr_namebuffer to receive the attribute name
max_attr_namemax size of attr_name in bytes
[out]attr_name_lengthnumber of bytes written in attr_name
[out]attr_valuebuffer to receive the attribute name
max_attr_valuemax size of attr_value in bytes
[out]attr_value_lengthnumber of bytes written in attr_value
Return values
truerequested attribute pair is found and copied
falseerror. Either because of parsing or too few attributes.