~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to server-tools/instance-manager/mysql_connection.h

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2004-2006 MySQL AB
 
2
 
 
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.
 
6
 
 
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.
 
11
 
 
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
15
 
 
16
#ifndef INCLUDES_MYSQL_INSTANCE_MANAGER_MYSQL_CONNECTION_H
 
17
#define INCLUDES_MYSQL_INSTANCE_MANAGER_MYSQL_CONNECTION_H
 
18
 
 
19
#include "thread_registry.h"
 
20
#include <mysql_com.h>
 
21
 
 
22
#if defined(__GNUC__) && defined(USE_PRAGMA_INTERFACE)
 
23
#pragma interface
 
24
#endif
 
25
 
 
26
struct st_vio;
 
27
class User_map;
 
28
 
 
29
/*
 
30
  MySQL connection - handle one connection with mysql command line client
 
31
  See also comments in mysqlmanager.cc to picture general Instance Manager
 
32
  architecture.
 
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
 
36
  init() and cleanup().
 
37
*/
 
38
 
 
39
class Mysql_connection: public Thread
 
40
{
 
41
public:
 
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();
 
47
 
 
48
protected:
 
49
  virtual void run();
 
50
 
 
51
private:
 
52
  struct st_vio *vio;
 
53
  ulong connection_id;
 
54
  Thread_info thread_info;
 
55
  Thread_registry *thread_registry;
 
56
  User_map *user_map;
 
57
  NET net;
 
58
  struct rand_struct rand_st;
 
59
  char scramble[SCRAMBLE_LENGTH + 1];
 
60
  uint status;
 
61
  ulong client_capabilities;
 
62
private:
 
63
  /* The main loop implementation triad */
 
64
  bool init();
 
65
  void main();
 
66
  void cleanup();
 
67
 
 
68
  /* Names are conventionally the same as in mysqld */
 
69
  int check_connection();
 
70
  int do_command();
 
71
  int dispatch_command(enum enum_server_command command, const char *text);
 
72
};
 
73
 
 
74
#endif // INCLUDES_MYSQL_INSTANCE_MANAGER_MYSQL_CONNECTION_H