1 /* Copyright (C) 2004-2006 MySQL AB
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; version 2 of the License.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 GNU General Public License for more details.
12 You should have received a copy of the GNU General Public License
13 along with this program; if not, write to the Free Software
14 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
16 #ifndef INCLUDES_MYSQL_INSTANCE_MANAGER_MYSQL_CONNECTION_H
17 #define INCLUDES_MYSQL_INSTANCE_MANAGER_MYSQL_CONNECTION_H
19 #include "thread_registry.h"
20 #include <mysql_com.h>
22 #if defined(__GNUC__) && defined(USE_PRAGMA_INTERFACE)
30 MySQL connection - handle one connection with mysql command line client
31 See also comments in mysqlmanager.cc to picture general Instance Manager
33 We use conventional technique to work with classes without exceptions:
34 class acquires all vital resource in init(); Thus if init() succeed,
35 a user must call cleanup(). All other methods are valid only between
39 class Mysql_connection
: public Thread
42 Mysql_connection(Thread_registry
*thread_registry_arg
,
43 User_map
*user_map_arg
,
44 struct st_vio
*vio_arg
,
45 ulong connection_id_arg
);
46 virtual ~Mysql_connection();
54 Thread_info thread_info
;
55 Thread_registry
*thread_registry
;
58 struct rand_struct rand_st
;
59 char scramble
[SCRAMBLE_LENGTH
+ 1];
61 ulong client_capabilities
;
63 /* The main loop implementation triad */
68 /* Names are conventionally the same as in mysqld */
69 int check_connection();
71 int dispatch_command(enum enum_server_command command
, const char *text
);
74 #endif // INCLUDES_MYSQL_INSTANCE_MANAGER_MYSQL_CONNECTION_H