MySQL  8.0.19
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, 2019, Oracle and/or its affiliates. All rights reserved.
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),
43  m_err_msg(NULL),
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 */
MYSQL_LEX_CSTRING
Definition: mysql_lex_string.h:39
THD
Definition: sql_class.h:764
Gis_read_stream::set_error_msg
void set_error_msg(const char *msg)
Definition: gstream.cc:108
msg
char msg[1024]
Definition: test_sql_9_sessions.cc:281
Gis_read_stream
Definition: gstream.h:35
Gis_read_stream::check_next_symbol
bool check_next_symbol(char)
Definition: gstream.cc:91
NULL
#define NULL
Definition: types.h:55
Gis_read_stream::numeric
@ numeric
Definition: gstream.h:37
Gis_read_stream::comma
@ comma
Definition: gstream.h:37
CHARSET_INFO
Definition: m_ctype.h:354
Gis_read_stream::is_end_of_stream
bool is_end_of_stream()
Definition: gstream.h:54
Gis_read_stream::unknown
@ unknown
Definition: gstream.h:37
Gis_read_stream::eostream
@ eostream
Definition: gstream.h:37
my_charset_latin1
MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_latin1
Definition: ctype-latin1.cc:357
Gis_read_stream::m_limit
const char * m_limit
Definition: gstream.h:80
Gis_read_stream::get_next_word
bool get_next_word(LEX_CSTRING *)
Definition: gstream.cc:55
mysqlrouter::skip
static size_t skip(size_t pos_start, size_t match_len)
Definition: uri.cc:83
Gis_read_stream::get_next_number
bool get_next_number(double *)
Definition: gstream.cc:74
NullS
#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:50
Gis_read_stream::word
@ word
Definition: gstream.h:37
service_mysql_alloc.h
m_ctype.h
lex_string.h
Gis_read_stream::get_error_msg
char * get_error_msg()
Definition: gstream.h:70
Gis_read_stream::skip_space
void skip_space()
Definition: gstream.h:56
Gis_read_stream::~Gis_read_stream
~Gis_read_stream()
Definition: gstream.h:47
Gis_read_stream::m_cur
const char * m_cur
Definition: gstream.h:79
Gis_read_stream::Gis_read_stream
Gis_read_stream()
Definition: gstream.h:46
Gis_read_stream::enum_tok_types
enum_tok_types
Definition: gstream.h:37
Gis_read_stream::Gis_read_stream
Gis_read_stream(THD *thd, const CHARSET_INFO *charset, const char *buffer, int size)
Definition: gstream.h:39
Gis_read_stream::m_thd
THD * m_thd
Definition: gstream.h:85
Gis_read_stream::m_charset
const CHARSET_INFO * m_charset
Definition: gstream.h:82
my_isspace
#define my_isspace(s, c)
Definition: m_ctype.h:656
Gis_read_stream::thd
THD * thd()
Definition: gstream.h:76
my_free
void my_free(void *ptr)
Frees the memory pointed by the ptr.
Definition: my_memory.cc:81
Gis_read_stream::r_bra
@ r_bra
Definition: gstream.h:37
m_string.h
Gis_read_stream::l_bra
@ l_bra
Definition: gstream.h:37
udf_ext::consts::charset
const std::string charset("charset")
Gis_read_stream::skip_char
bool skip_char(char skip)
Definition: gstream.h:60
buffer
char buffer[STRING_BUFFER]
Definition: test_sql_9_sessions.cc:57
Gis_read_stream::m_err_msg
char * m_err_msg
Definition: gstream.h:81
Gis_read_stream::get_next_toc_type
enum enum_tok_types get_next_toc_type()
Definition: gstream.cc:44