1
#ifndef INCLUDES_MYSQL_INSTANCE_MANAGER_BUFFER_H
2
#define INCLUDES_MYSQL_INSTANCE_MANAGER_BUFFER_H
3
/* Copyright (C) 2004 MySQL AB
5
This program is free software; you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation; version 2 of the License.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public License
15
along with this program; if not, write to the Free Software
16
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
18
#include <my_global.h>
21
#if defined(__GNUC__) && defined(USE_PRAGMA_INTERFACE)
26
This class is a simple implementation of the buffer of varying size.
27
It is used to store MySQL client-server protocol packets. This is why
28
the maximum buffer size if 16Mb. (See internals manual section
29
7. MySQL Client/Server Protocol)
35
static const uint BUFFER_INITIAL_SIZE;
36
/* maximum buffer size is 16Mb */
37
static const uint MAX_BUFFER_SIZE;
39
/* Error flag. Triggered if we get an error of some kind */
42
Buffer(size_t buffer_size_arg= BUFFER_INITIAL_SIZE)
43
:buffer_size(buffer_size_arg), error(0)
46
As append() will invokes realloc() anyway, it's ok if malloc returns 0
48
if (!(buffer= (uchar*) my_malloc(buffer_size, MYF(0))))
54
my_free(buffer, MYF(0));
61
int append(size_t position, const char *string, size_t len_arg);
62
int reserve(size_t position, size_t len_arg);
65
#endif /* INCLUDES_MYSQL_INSTANCE_MANAGER_BUFFER_H */