Coverage Report

Created: 2025-09-27 06:50

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/mysql-server/sql/sql_digest_stream.h
Line
Count
Source
1
/* Copyright (c) 2008, 2025, Oracle and/or its affiliates.
2
3
  This program is free software; you can redistribute it and/or modify
4
  it under the terms of the GNU General Public License, version 2.0,
5
  as published by the Free Software Foundation.
6
7
  This program is designed to work with certain software (including
8
  but not limited to OpenSSL) that is licensed under separate terms,
9
  as designated in a particular file or component or in included license
10
  documentation.  The authors of MySQL hereby grant you an additional
11
  permission to link the program and your derivative works with the
12
  separately licensed software that they have either included with
13
  the program or referenced in the documentation.
14
15
  This program is distributed in the hope that it will be useful,
16
  but WITHOUT ANY WARRANTY; without even the implied warranty of
17
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
  GNU General Public License, version 2.0, for more details.
19
20
  You should have received a copy of the GNU General Public License
21
  along with this program; if not, write to the Free Software
22
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
23
24
#ifndef SQL_DIGEST_STREAM_H
25
#define SQL_DIGEST_STREAM_H
26
27
#include "sql/sql_digest.h"
28
29
union Lexer_yystype;
30
31
/**
32
  State data storage for @c digest_start, @c digest_add_token.
33
  This structure extends the @c sql_digest_storage structure
34
  with temporary state used only during parsing.
35
*/
36
struct sql_digest_state {
37
  /**
38
    Index, in the digest token array, of the last identifier seen.
39
    Reduce rules used in the digest computation can not
40
    apply to tokens seen before an identifier.
41
    @sa digest_add_token
42
  */
43
  int m_last_id_index;
44
  sql_digest_storage m_digest_storage;
45
46
0
  inline void reset(unsigned char *token_array, uint length) {
47
0
    m_last_id_index = 0;
48
0
    m_digest_storage.reset(token_array, length);
49
0
  }
50
51
0
  inline bool is_empty() { return m_digest_storage.is_empty(); }
52
};
53
typedef struct sql_digest_state sql_digest_state;
54
55
sql_digest_state *digest_add_token(sql_digest_state *state, uint token,
56
                                   Lexer_yystype *yylval);
57
58
sql_digest_state *digest_reduce_token(sql_digest_state *state, uint token_left,
59
                                      uint token_right);
60
61
#endif