~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/client.h

  • Committer: Mark Atwood
  • Date: 2011-08-11 03:05:03 UTC
  • mfrom: (2385.1.12 refactor4)
  • Revision ID: me@mark.atwood.name-20110811030503-rp9xjihc5x3y0x4q
mergeĀ lp:~olafvdspek/drizzle/refactor4

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 DRIZZLED_PLUGIN_CLIENT_H
21
 
#define DRIZZLED_PLUGIN_CLIENT_H
 
20
#pragma once
22
21
 
23
22
#include <drizzled/catalog/instance.h>
24
23
#include <drizzled/catalog/local.h>
25
24
#include <drizzled/error_t.h>
26
25
#include <drizzled/item.h>
27
 
#include <drizzled/sql_list.h>
28
 
 
29
 
#include "drizzled/visibility.h"
30
 
 
31
 
namespace drizzled
32
 
{
33
 
class Session;
34
 
class String;
35
 
 
36
 
namespace plugin
37
 
{
 
26
#include <drizzled/visibility.h>
 
27
 
 
28
namespace drizzled {
 
29
namespace plugin {
38
30
 
39
31
/**
40
32
 * This class allows new client sources to be written. This could be through
55
47
   * Get attached session from the client object.
56
48
   * @retval Session object that is attached, NULL if none.
57
49
   */
58
 
  virtual Session *getSession(void)
 
50
  virtual Session *getSession()
59
51
  {
60
52
    return session;
61
53
  }
73
65
   * Get file descriptor associated with client object.
74
66
   * @retval File descriptor that is attached, -1 if none.
75
67
   */
76
 
  virtual int getFileDescriptor(void)= 0;
 
68
  virtual int getFileDescriptor()= 0;
77
69
 
78
70
  /**
79
71
   * Check to see if the client is currently connected.
80
72
   * @retval Boolean value representing connected state.
81
73
   */
82
 
  virtual bool isConnected(void)= 0;
83
 
 
84
 
  /**
85
 
   * Check to see if the client is actively reading.
86
 
   * @retval Boolean value representing reading state.
87
 
   */
88
 
  virtual bool isReading(void)= 0;
89
 
 
90
 
  /**
91
 
   * Check to see if the client is actively writing.
92
 
   * @retval Boolean value representing writing state.
93
 
   */
94
 
  virtual bool isWriting(void)= 0;
 
74
  virtual bool isConnected()= 0;
95
75
 
96
76
  /**
97
77
   * Flush all data that has been buffered with store() methods.
98
78
   * @retval Boolean indicating success or failure.
99
79
   */
100
 
  virtual bool flush(void)= 0;
 
80
  virtual bool flush()= 0;
101
81
 
102
82
  /**
103
83
   * Close the client object.
104
84
   */
105
 
  virtual void close(void)= 0;
 
85
  virtual void close()= 0;
106
86
 
107
87
  /**
108
88
   * Perform handshake and authorize client if needed.
109
89
   */
110
 
  virtual bool authenticate(void)= 0;
111
 
 
112
 
  virtual bool isConsole()
 
90
  virtual bool authenticate()= 0;
 
91
 
 
92
  virtual bool isConsole() const
 
93
  {
 
94
    return false;
 
95
  }
 
96
 
 
97
  virtual bool isInteractive() const
113
98
  {
114
99
    return false;
115
100
  }
122
107
  /**
123
108
   * Read command from client.
124
109
   */
125
 
  virtual bool readCommand(char **packet, uint32_t *packet_length)= 0;
 
110
  virtual bool readCommand(char **packet, uint32_t& packet_length)= 0;
126
111
 
127
112
  /* Send responses. */
128
 
  virtual void sendOK(void)= 0;
129
 
  virtual void sendEOF(void)= 0;
 
113
  virtual void sendOK()= 0;
 
114
  virtual void sendEOF()= 0;
130
115
  virtual void sendError(const drizzled::error_t sql_errno, const char *err)= 0;
131
116
 
132
117
  /**
133
118
   * Send field list for result set.
134
119
   */
135
 
  virtual bool sendFields(List<Item> *list)= 0;
 
120
  virtual void sendFields(List<Item>&)= 0;
136
121
 
137
122
  /* Send result fields in various forms. */
138
 
  virtual bool store(Field *from)= 0;
139
 
  virtual bool store(void)= 0;
140
 
  virtual bool store(int32_t from)= 0;
141
 
  virtual bool store(uint32_t from)= 0;
142
 
  virtual bool store(int64_t from)= 0;
143
 
  virtual bool store(uint64_t from)= 0;
144
 
  virtual bool store(double from, uint32_t decimals, String *buffer)= 0;
145
 
  virtual bool store(const type::Time *from);
146
 
  virtual bool store(const char *from);
147
 
  virtual bool store(const char *from, size_t length)= 0;
148
 
  virtual bool store(const std::string &from)
 
123
  virtual void store(Field *from)= 0;
 
124
  virtual void store()= 0;
 
125
  virtual void store(int32_t from)= 0;
 
126
  virtual void store(uint32_t from)= 0;
 
127
  virtual void store(int64_t from)= 0;
 
128
  virtual void store(uint64_t from)= 0;
 
129
  virtual void store(double from, uint32_t decimals, String *buffer)= 0;
 
130
  virtual void store(const type::Time *from);
 
131
  virtual void store(const char *from);
 
132
  virtual void store(const char *from, size_t length)= 0;
 
133
  virtual void store(const std::string &from)
149
134
  {
150
 
    return store(from.c_str(), from.size());
 
135
    store(from.c_str(), from.size());
151
136
  }
152
137
 
153
138
  /* Try to remove these. */
154
 
  virtual bool haveMoreData(void)= 0;
155
 
  virtual bool haveError(void)= 0;
156
 
  virtual bool wasAborted(void)= 0;
 
139
  virtual bool haveError()= 0;
 
140
  virtual bool wasAborted()= 0;
157
141
 
158
142
};
159
143
 
160
144
} /* namespace plugin */
161
145
} /* namespace drizzled */
162
 
 
163
 
#endif /* DRIZZLED_PLUGIN_CLIENT_H */