~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/oldlibdrizzle/oldlibdrizzle.h

Rename of handler to Cursor.  You would not believe how long I have wanted
to do that.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
 
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2010 Brian Aker
 
4
 *  Copyright (C) 2008 Sun Microsystems
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
8
 
 *  the Free Software Foundation; either version 2 of the License, or
9
 
 *  (at your option) any later version.
 
8
 *  the Free Software Foundation; version 2 of the License.
10
9
 *
11
10
 *  This program is distributed in the hope that it will be useful,
12
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
18
 */
20
19
 
21
 
 
22
 
#ifndef PLUGIN_DRIZZLE_PROTOCOL_DRIZZLE_PROTOCOL_H
23
 
#define PLUGIN_DRIZZLE_PROTOCOL_DRIZZLE_PROTOCOL_H
 
20
#ifndef DRIZZLED_PLUGIN_OLDLIBDRIZZLE_H
 
21
#define DRIZZLED_PLUGIN_OLDLIBDRIZZLE_H
24
22
 
25
23
#include <drizzled/plugin/listen_tcp.h>
26
24
#include <drizzled/plugin/client.h>
27
 
#include <drizzled/atomics.h>
28
 
#include "drizzled/plugin/table_function.h"
29
 
 
30
 
#include "plugin/mysql_protocol/mysql_protocol.h"
31
 
 
32
 
namespace drizzle_plugin
33
 
{
34
 
namespace drizzle_protocol
35
 
{
36
 
 
37
 
class ListenDrizzleProtocol: public ListenMySQLProtocol
 
25
 
 
26
#include "net_serv.h"
 
27
 
 
28
class ListenOldLibdrizzle: public drizzled::plugin::ListenTcp
38
29
{
39
30
public:
40
 
  ListenDrizzleProtocol(std::string name, 
41
 
                        const std::string &bind_address,
42
 
                        bool using_mysql41_protocol):
43
 
    ListenMySQLProtocol(name, bind_address, using_mysql41_protocol)
 
31
  ListenOldLibdrizzle(std::string name_arg)
 
32
   : drizzled::plugin::ListenTcp(name_arg)
44
33
  { }
45
 
 
46
 
  ~ListenDrizzleProtocol();
47
 
  in_port_t getPort(void) const;
48
 
  static ProtocolCounters *drizzle_counters;
49
 
  virtual ProtocolCounters *getCounters(void) const { return drizzle_counters; }
50
 
  drizzled::plugin::Client *getClient(int fd);
 
34
  virtual const char* getHost(void) const;
 
35
  virtual in_port_t getPort(void) const;
 
36
  virtual drizzled::plugin::Client *getClient(int fd);
51
37
};
52
38
 
53
 
class ClientDrizzleProtocol: public ClientMySQLProtocol
 
39
class ClientOldLibdrizzle: public drizzled::plugin::Client
54
40
{
 
41
private:
 
42
  NET net;
 
43
  String packet;
 
44
  uint32_t client_capabilities;
 
45
 
 
46
  bool checkConnection(void);
 
47
  bool netStoreData(const unsigned char *from, size_t length);
 
48
  void writeEOFPacket(uint32_t server_status, uint32_t total_warn_count);
 
49
 
55
50
public:
56
 
  ClientDrizzleProtocol(int fd, ProtocolCounters *set_counters): ClientMySQLProtocol(fd, true, set_counters) {}
57
 
 
58
 
  static std::vector<std::string> drizzle_admin_ip_addresses;
59
 
  static void drizzle_compose_ip_addresses(std::vector<std::string> options);
60
 
  bool isAdminAllowed(void);
 
51
  ClientOldLibdrizzle(int fd);
 
52
  virtual ~ClientOldLibdrizzle();
 
53
 
 
54
  virtual int getFileDescriptor(void);
 
55
  virtual bool isConnected();
 
56
  virtual bool isReading(void);
 
57
  virtual bool isWriting(void);
 
58
  virtual bool flush(void);
 
59
  virtual void close(void);
 
60
 
 
61
  virtual bool authenticate(void);
 
62
  virtual bool readCommand(char **packet, uint32_t *packet_length);
 
63
 
 
64
  virtual void sendOK(void);
 
65
  virtual void sendEOF(void);
 
66
  virtual void sendError(uint32_t sql_errno, const char *err);
 
67
 
 
68
  virtual bool sendFields(List<Item> *list);
 
69
 
 
70
  using Client::store;
 
71
  virtual bool store(Field *from);
 
72
  virtual bool store(void);
 
73
  virtual bool store(int32_t from);
 
74
  virtual bool store(uint32_t from);
 
75
  virtual bool store(int64_t from);
 
76
  virtual bool store(uint64_t from);
 
77
  virtual bool store(double from, uint32_t decimals, String *buffer);
 
78
  virtual bool store(const char *from, size_t length);
 
79
 
 
80
  virtual bool haveError(void);
 
81
  virtual bool haveMoreData(void);
 
82
  virtual bool wasAborted(void);
61
83
};
62
84
 
63
 
} /* namespace drizzle_protocol */
64
 
} /* namespace drizzle_plugin */
65
 
 
66
 
#endif /* PLUGIN_DRIZZLE_PROTOCOL_DRIZZLE_PROTOCOL_H */
 
85
#endif /* DRIZZLED_PLUGIN_OLDLIBDRIZZLE_H */