~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/oldlibdrizzle/oldlibdrizzle.h

  • Committer: Padraig O'Sullivan
  • Date: 2009-08-08 04:22:33 UTC
  • mto: (1115.3.4 captain)
  • mto: This revision was merged to the branch mainline in revision 1117.
  • Revision ID: osullivan.padraig@gmail.com-20090808042233-q0z88zc490z3f3r7
Renamed the Command class to be Statement. Renamed the command directory to
statement and also the command header file to statement. Updated various
source files to reflect this renaming.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#ifndef PLUGIN_DRIZZLE_PROTOCOL_DRIZZLE_PROTOCOL_H
21
 
#define PLUGIN_DRIZZLE_PROTOCOL_DRIZZLE_PROTOCOL_H
 
20
#ifndef DRIZZLED_PLUGIN_OLDLIBDRIZZLE_H
 
21
#define DRIZZLED_PLUGIN_OLDLIBDRIZZLE_H
22
22
 
23
 
#include <drizzled/plugin/listen_tcp.h>
24
 
#include <drizzled/plugin/client.h>
 
23
#include <drizzled/plugin/listen.h>
 
24
#include <drizzled/plugin/protocol.h>
25
25
 
26
26
#include "net_serv.h"
27
 
 
28
 
namespace drizzle_protocol
29
 
{
30
 
 
31
 
class ListenDrizzleProtocol: public drizzled::plugin::ListenTcp
 
27
#include "password.h"
 
28
 
 
29
class ListenOldLibdrizzle: public Listen
32
30
{
33
31
private:
34
 
  bool using_mysql41_protocol;
 
32
  in_port_t port;
35
33
 
36
34
public:
37
 
  ListenDrizzleProtocol(std::string name_arg, bool using_mysql41_protocol_arg):
38
 
   drizzled::plugin::ListenTcp(name_arg),
39
 
   using_mysql41_protocol(using_mysql41_protocol_arg)
40
 
  { }
41
 
  virtual const char* getHost(void) const;
 
35
  ListenOldLibdrizzle();
 
36
  ListenOldLibdrizzle(in_port_t port_arg): port(port_arg) {}
42
37
  virtual in_port_t getPort(void) const;
43
 
  virtual drizzled::plugin::Client *getClient(int fd);
 
38
  virtual Protocol *protocolFactory(void) const;
44
39
};
45
40
 
46
 
class ClientDrizzleProtocol: public drizzled::plugin::Client
 
41
class ProtocolOldLibdrizzle: public Protocol
47
42
{
48
43
private:
49
44
  NET net;
50
 
  drizzled::String packet;
51
 
  uint32_t client_capabilities;
52
 
  bool using_mysql41_protocol;
 
45
  Vio* save_vio;
 
46
  struct rand_struct rand;
 
47
  char scramble[SCRAMBLE_LENGTH+1];
 
48
  String *packet;
 
49
  String *convert;
 
50
  uint32_t field_pos;
 
51
  uint32_t field_count;
 
52
  bool netStoreData(const unsigned char *from, size_t length);
53
53
 
 
54
  /**
 
55
   * Performs handshake with client and authorizes user.
 
56
   *
 
57
   * Returns true is the connection is valid and the
 
58
   * user is authorized, otherwise false.
 
59
   */  
54
60
  bool checkConnection(void);
55
 
  bool netStoreData(const unsigned char *from, size_t length);
56
 
  void writeEOFPacket(uint32_t server_status, uint32_t total_warn_count);
57
61
 
58
62
public:
59
 
  ClientDrizzleProtocol(int fd, bool using_mysql41_protocol_arg);
60
 
  virtual ~ClientDrizzleProtocol();
61
 
 
62
 
  virtual int getFileDescriptor(void);
 
63
  ProtocolOldLibdrizzle();
 
64
  ~ProtocolOldLibdrizzle();
 
65
  virtual void setSession(Session *session_arg);
63
66
  virtual bool isConnected();
 
67
  virtual void setReadTimeout(uint32_t timeout);
 
68
  virtual void setWriteTimeout(uint32_t timeout);
 
69
  virtual void setRetryCount(uint32_t count);
 
70
  virtual void setError(char error);
 
71
  virtual bool haveError(void);
 
72
  virtual bool wasAborted(void);
 
73
  virtual void enableCompression(void);
 
74
  virtual bool haveMoreData(void);
64
75
  virtual bool isReading(void);
65
76
  virtual bool isWriting(void);
66
 
  virtual bool flush(void);
67
 
  virtual void close(void);
68
 
 
 
77
  virtual bool setFileDescriptor(int fd);
 
78
  virtual int fileDescriptor(void);
 
79
  virtual void setRandom(uint64_t seed1, uint64_t seed2);
69
80
  virtual bool authenticate(void);
70
81
  virtual bool readCommand(char **packet, uint32_t *packet_length);
71
 
 
72
 
  virtual void sendOK(void);
73
 
  virtual void sendEOF(void);
 
82
  virtual void sendOK();
 
83
  virtual void sendEOF();
74
84
  virtual void sendError(uint32_t sql_errno, const char *err);
75
 
 
76
 
  virtual bool sendFields(drizzled::List<drizzled::Item> *list);
77
 
 
78
 
  using Client::store;
79
 
  virtual bool store(drizzled::Field *from);
 
85
  virtual void close();
 
86
  virtual void forceClose();
 
87
  virtual void prepareForResend();
 
88
  virtual void free();
 
89
  virtual bool write();
 
90
 
 
91
  virtual bool sendFields(List<Item> *list, uint32_t flags);
 
92
 
 
93
  using Protocol::store;
 
94
  virtual bool store(Field *from);
80
95
  virtual bool store(void);
81
96
  virtual bool store(int32_t from);
82
97
  virtual bool store(uint32_t from);
83
98
  virtual bool store(int64_t from);
84
99
  virtual bool store(uint64_t from);
85
 
  virtual bool store(double from, uint32_t decimals, drizzled::String *buffer);
 
100
  virtual bool store(double from, uint32_t decimals, String *buffer);
 
101
  virtual bool store(const DRIZZLE_TIME *from);
86
102
  virtual bool store(const char *from, size_t length);
87
 
 
88
 
  virtual bool haveError(void);
89
 
  virtual bool haveMoreData(void);
90
 
  virtual bool wasAborted(void);
91
103
};
92
104
 
93
 
} /* namespace drizzle_protocol */
94
 
 
95
 
#endif /* PLUGIN_DRIZZLE_PROTOCOL_DRIZZLE_PROTOCOL_H */
 
105
#endif /* DRIZZLED_PLUGIN_OLDLIBDRIZZLE_H */