MySQL 8.4.2
Source Code Documentation
sql_digest.cc File Reference
#include "sql/sql_digest.h"
#include <assert.h>
#include "lex_string.h"
#include "my_inttypes.h"
#include "my_macros.h"
#include "my_sys.h"
#include "mysql/strings/m_ctype.h"
#include "mysql_com.h"
#include "sha2.h"
#include "sql/lexer_yystype.h"
#include "sql/sql_digest_stream.h"
#include "sql/sql_yacc.h"
#include "sql_string.h"
#include "template_utils.h"
#include "sql/lex_token.h"

Macros

#define LEX_TOKEN_WITH_DEFINITION
 
#define SIZE_OF_A_TOKEN   2
 

Functions

ulong get_max_digest_length ()
 
uint read_token (const sql_digest_storage *digest_storage, uint index, uint *tok)
 Read a single token from token array. More...
 
void store_token (sql_digest_storage *digest_storage, uint token)
 Store a single token in token array. More...
 
uint read_identifier (const sql_digest_storage *digest_storage, uint index, const char **id_string, int *id_length)
 Read an identifier from token array. More...
 
void store_token_identifier (sql_digest_storage *digest_storage, uint token, size_t id_length, const char *id_name)
 Store an identifier in token array. More...
 
void compute_digest_hash (const sql_digest_storage *digest_storage, unsigned char *hash)
 Compute a digest hash. More...
 
void compute_digest_text (const sql_digest_storage *digest_storage, String *digest_text)
 Compute a digest text. More...
 
static uint peek_token (const sql_digest_storage *digest, uint index)
 
static void peek_last_two_tokens (const sql_digest_storage *digest_storage, uint last_id_index, uint *t1, uint *t2)
 Function to read last two tokens from token array. More...
 
static void peek_last_three_tokens (const sql_digest_storage *digest_storage, uint last_id_index, uint *t1, uint *t2, uint *t3)
 Function to read last three tokens from token array. More...
 
sql_digest_statedigest_add_token (sql_digest_state *state, uint token, Lexer_yystype *yylval)
 
sql_digest_statedigest_reduce_token (sql_digest_state *state, uint token_left, uint token_right)
 

Variables

ulong max_digest_length = 0
 

Macro Definition Documentation

◆ LEX_TOKEN_WITH_DEFINITION

#define LEX_TOKEN_WITH_DEFINITION

◆ SIZE_OF_A_TOKEN

#define SIZE_OF_A_TOKEN   2

Function Documentation

◆ compute_digest_hash()

void compute_digest_hash ( const sql_digest_storage digest_storage,
unsigned char *  hash 
)

Compute a digest hash.

Parameters
digest_storageThe digest
[out]hashThe computed digest hash. This parameter is a buffer of size DIGEST_HASH_SIZE.

◆ compute_digest_text()

void compute_digest_text ( const sql_digest_storage digest_storage,
String digest_text 
)

Compute a digest text.

A 'digest text' is a textual representation of a query, where:

  • comments are removed,
  • non significant spaces are removed,
  • literal values are replaced with a special '?' marker,
  • lists of values are collapsed using a shorter notation
    Parameters
    digest_storageThe digest
    [out]digest_textThe digest text

◆ digest_add_token()

sql_digest_state * digest_add_token ( sql_digest_state state,
uint  token,
Lexer_yystype yylval 
)

◆ digest_reduce_token()

sql_digest_state * digest_reduce_token ( sql_digest_state state,
uint  token_left,
uint  token_right 
)

◆ get_max_digest_length()

ulong get_max_digest_length ( )

◆ peek_last_three_tokens()

static void peek_last_three_tokens ( const sql_digest_storage digest_storage,
uint  last_id_index,
uint *  t1,
uint *  t2,
uint *  t3 
)
inlinestatic

Function to read last three tokens from token array.

If an identifier is found, do not look for token before that.

◆ peek_last_two_tokens()

static void peek_last_two_tokens ( const sql_digest_storage digest_storage,
uint  last_id_index,
uint *  t1,
uint *  t2 
)
inlinestatic

Function to read last two tokens from token array.

If an identifier is found, do not look for token before that.

◆ peek_token()

static uint peek_token ( const sql_digest_storage digest,
uint  index 
)
inlinestatic

◆ read_identifier()

uint read_identifier ( const sql_digest_storage digest_storage,
uint  index,
const char **  id_string,
int *  id_length 
)
inline

Read an identifier from token array.

◆ read_token()

uint read_token ( const sql_digest_storage digest_storage,
uint  index,
uint *  tok 
)
inline

Read a single token from token array.

◆ store_token()

void store_token ( sql_digest_storage digest_storage,
uint  token 
)
inline

Store a single token in token array.

◆ store_token_identifier()

void store_token_identifier ( sql_digest_storage digest_storage,
uint  token,
size_t  id_length,
const char *  id_name 
)
inline

Store an identifier in token array.

Variable Documentation

◆ max_digest_length

ulong max_digest_length = 0