MySQL 8.3.0
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, 2023, 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"
30#include "mysql/strings/m_ctype.h" /* my_charset_latin1, my_charset_bin */
31#include "nulls.h"
32
33class THD;
34
36 public:
38
40 int size)
41 : m_cur(buffer),
42 m_limit(buffer + size),
45 m_thd(thd) {}
48
51 bool get_next_number(double *);
52 bool check_next_symbol(char);
53
55
56 inline void skip_space() {
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;
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 */
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:250
Definition: gstream.h:35
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:75
bool is_end_of_stream()
Definition: gstream.h:54
bool get_next_word(LEX_CSTRING *)
Definition: gstream.cc:56
THD * thd()
Definition: gstream.h:76
bool check_next_symbol(char)
Definition: gstream.cc:92
enum enum_tok_types get_next_toc_type()
Definition: gstream.cc:45
void set_error_msg(const char *msg)
Definition: gstream.cc:109
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
char * get_error_msg()
Definition: gstream.h:70
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:35
A better implementation of the UNIX ctype(3) library.
bool my_isspace(const CHARSET_INFO *cs, char ch)
Definition: m_ctype.h:592
MYSQL_STRINGS_EXPORT CHARSET_INFO my_charset_latin1
Definition: ctype-latin1.cc:365
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:81
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:417
#define NullS
Definition of the null string (a null pointer of type char *), used in some of our string handling co...
Definition: nulls.h:32
Definition: m_ctype.h:422
Definition: mysql_lex_string.h:39