MySQL  8.0.27
Source Code Documentation
gstream.h
Go to the documentation of this file.
1 #ifndef GSTREAM_INCLUDED
2 #define GSTREAM_INCLUDED
3 
4 /* Copyright (c) 2000, 2021, Oracle and/or its affiliates.
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License, version 2.0,
8  as published by the Free Software Foundation.
9 
10  This program is also distributed with certain software (including
11  but not limited to OpenSSL) that is licensed under separate terms,
12  as designated in a particular file or component or in included license
13  documentation. The authors of MySQL hereby grant you an additional
14  permission to link the program and your derivative works with the
15  separately licensed software that they have included with MySQL.
16 
17  This program is distributed in the hope that it will be useful,
18  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  GNU General Public License, version 2.0, for more details.
21 
22  You should have received a copy of the GNU General Public License
23  along with this program; if not, write to the Free Software
24  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
25 
26 #include <stddef.h>
27 
28 #include "lex_string.h"
29 #include "m_ctype.h" /* my_charset_latin1, my_charset_bin */
30 #include "m_string.h"
32 
33 class THD;
34 
36  public:
38 
40  int size)
41  : m_cur(buffer),
42  m_limit(buffer + size),
45  m_thd(thd) {}
48 
50  bool get_next_word(LEX_CSTRING *);
51  bool get_next_number(double *);
52  bool check_next_symbol(char);
53 
55 
56  inline void skip_space() {
57  while ((m_cur < m_limit) && my_isspace(&my_charset_latin1, *m_cur)) m_cur++;
58  }
59  /* Skip next character, if match. Return 1 if no match */
60  inline bool skip_char(char skip) {
61  skip_space();
62  if ((m_cur >= m_limit) || *m_cur != skip)
63  return true; /* Didn't find char */
64  m_cur++;
65  return false;
66  }
67  void set_error_msg(const char *msg);
68 
69  // caller should free this pointer
70  char *get_error_msg() {
71  char *err_msg = m_err_msg;
72  m_err_msg = NullS;
73  return err_msg;
74  }
75 
76  THD *thd() { return m_thd; }
77 
78  protected:
79  const char *m_cur;
80  const char *m_limit;
81  char *m_err_msg;
83 
84  private:
86 };
87 
88 #endif /* GSTREAM_INCLUDED */
Definition: gstream.h:35
char * get_error_msg()
Definition: gstream.h:70
enum_tok_types
Definition: gstream.h:37
@ eostream
Definition: gstream.h:37
@ word
Definition: gstream.h:37
@ l_bra
Definition: gstream.h:37
@ unknown
Definition: gstream.h:37
@ comma
Definition: gstream.h:37
@ numeric
Definition: gstream.h:37
@ r_bra
Definition: gstream.h:37
void skip_space()
Definition: gstream.h:56
const char * m_cur
Definition: gstream.h:79
Gis_read_stream(THD *thd, const CHARSET_INFO *charset, const char *buffer, int size)
Definition: gstream.h:39
const char * m_limit
Definition: gstream.h:80
char * m_err_msg
Definition: gstream.h:81
bool get_next_number(double *)
Definition: gstream.cc:74
bool is_end_of_stream()
Definition: gstream.h:54
bool get_next_word(LEX_CSTRING *)
Definition: gstream.cc:55
bool check_next_symbol(char)
Definition: gstream.cc:91
enum enum_tok_types get_next_toc_type()
Definition: gstream.cc:44
THD * thd()
Definition: gstream.h:76
void set_error_msg(const char *msg)
Definition: gstream.cc:108
const CHARSET_INFO * m_charset
Definition: gstream.h:82
THD * m_thd
Definition: gstream.h:85
~Gis_read_stream()
Definition: gstream.h:47
Gis_read_stream()
Definition: gstream.h:46
bool skip_char(char skip)
Definition: gstream.h:60
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:821
Dialog Client Authentication nullptr
Definition: dialog.cc:352
A better implementation of the UNIX ctype(3) library.
#define my_isspace(s, c)
Definition: m_ctype.h:655
MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_latin1
Definition: ctype-latin1.cc:367
#define NullS
Definition of the null string (a null pointer of type char *), used in some of our string handling co...
Definition: m_string.h:52
void my_free(void *ptr)
Frees the memory pointed by the ptr.
Definition: my_memory.cc:80
const std::string charset("charset")
static size_t skip(size_t pos_start, size_t match_len)
Definition: uri.cc:83
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:391
Definition: m_ctype.h:354
Definition: mysql_lex_string.h:39