971.3.13
by Eric Day
Added new Protocol plugin header. |
1 |
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
3 |
*
|
|
1999.6.1
by kalebral at gmail
update Copyright strings to a more common format to help with creating the master debian copyright file |
4 |
* Copyright (C) 2008 Sun Microsystems, Inc.
|
971.3.13
by Eric Day
Added new Protocol plugin header. |
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or modify
|
|
7 |
* it under the terms of the GNU General Public License as published by
|
|
8 |
* the Free Software Foundation; version 2 of the License.
|
|
9 |
*
|
|
10 |
* This program is distributed in the hope that it will be useful,
|
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 |
* GNU General Public License for more details.
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License
|
|
16 |
* along with this program; if not, write to the Free Software
|
|
17 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
18 |
*/
|
|
19 |
||
2234
by Brian Aker
Mass removal of ifdef/endif in favor of pragma once. |
20 |
#pragma once
|
971.3.13
by Eric Day
Added new Protocol plugin header. |
21 |
|
2154.2.4
by Brian Aker
This fixes 716459 |
22 |
#include <drizzled/catalog/instance.h> |
23 |
#include <drizzled/catalog/local.h> |
|
24 |
#include <drizzled/error_t.h> |
|
25 |
#include <drizzled/item.h> |
|
971.3.13
by Eric Day
Added new Protocol plugin header. |
26 |
#include <drizzled/sql_list.h> |
2173.2.1
by Monty Taylor
Fixes incorrect usage of include |
27 |
#include <drizzled/visibility.h> |
2119.4.1
by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by |
28 |
|
2252.1.22
by Olaf van der Spek
Common fwd |
29 |
namespace drizzled { |
30 |
namespace plugin { |
|
971.3.65
by Eric Day
Namespace cleanup for Protocol and Listen. |
31 |
|
971.6.1
by Eric Day
Renamed Protocol to Client, cleaned up some unnecessary methods along the way. |
32 |
/**
|
33 |
* This class allows new client sources to be written. This could be through
|
|
34 |
* network protocols, in-process threads, or any other client source that can
|
|
35 |
* provide commands and handle result sets. The current implementation is
|
|
36 |
* file-descriptor based, so for non-fd client sources (like from another
|
|
37 |
* thread), derived classes will need to use a pipe() for event notifications.
|
|
38 |
*/
|
|
2119.4.1
by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by |
39 |
class DRIZZLED_API Client |
971.3.13
by Eric Day
Added new Protocol plugin header. |
40 |
{
|
41 |
protected: |
|
42 |
Session *session; |
|
43 |
||
44 |
public: |
|
971.6.1
by Eric Day
Renamed Protocol to Client, cleaned up some unnecessary methods along the way. |
45 |
virtual ~Client() {} |
46 |
||
47 |
/**
|
|
48 |
* Get attached session from the client object.
|
|
49 |
* @retval Session object that is attached, NULL if none.
|
|
50 |
*/
|
|
51 |
virtual Session *getSession(void) |
|
52 |
{
|
|
53 |
return session; |
|
54 |
}
|
|
55 |
||
56 |
/**
|
|
57 |
* Attach session to the client object.
|
|
58 |
* @param[in] session_arg Session object to attach, or NULL to clear.
|
|
59 |
*/
|
|
971.3.13
by Eric Day
Added new Protocol plugin header. |
60 |
virtual void setSession(Session *session_arg) |
61 |
{
|
|
62 |
session= session_arg; |
|
63 |
}
|
|
64 |
||
971.6.1
by Eric Day
Renamed Protocol to Client, cleaned up some unnecessary methods along the way. |
65 |
/**
|
66 |
* Get file descriptor associated with client object.
|
|
67 |
* @retval File descriptor that is attached, -1 if none.
|
|
68 |
*/
|
|
69 |
virtual int getFileDescriptor(void)= 0; |
|
70 |
||
71 |
/**
|
|
72 |
* Check to see if the client is currently connected.
|
|
73 |
* @retval Boolean value representing connected state.
|
|
74 |
*/
|
|
75 |
virtual bool isConnected(void)= 0; |
|
76 |
||
77 |
/**
|
|
78 |
* Check to see if the client is actively reading.
|
|
79 |
* @retval Boolean value representing reading state.
|
|
80 |
*/
|
|
971.3.19
by Eric Day
Finished first pass at Protocol cleanup, still some things to remove but they are a bit more involved. |
81 |
virtual bool isReading(void)= 0; |
971.6.1
by Eric Day
Renamed Protocol to Client, cleaned up some unnecessary methods along the way. |
82 |
|
83 |
/**
|
|
84 |
* Check to see if the client is actively writing.
|
|
85 |
* @retval Boolean value representing writing state.
|
|
86 |
*/
|
|
971.3.19
by Eric Day
Finished first pass at Protocol cleanup, still some things to remove but they are a bit more involved. |
87 |
virtual bool isWriting(void)= 0; |
971.6.1
by Eric Day
Renamed Protocol to Client, cleaned up some unnecessary methods along the way. |
88 |
|
89 |
/**
|
|
90 |
* Flush all data that has been buffered with store() methods.
|
|
91 |
* @retval Boolean indicating success or failure.
|
|
92 |
*/
|
|
93 |
virtual bool flush(void)= 0; |
|
94 |
||
95 |
/**
|
|
96 |
* Close the client object.
|
|
97 |
*/
|
|
98 |
virtual void close(void)= 0; |
|
99 |
||
100 |
/**
|
|
101 |
* Perform handshake and authorize client if needed.
|
|
102 |
*/
|
|
103 |
virtual bool authenticate(void)= 0; |
|
104 |
||
2191.1.4
by Brian Aker
Add in interactive mode back to protocol. |
105 |
virtual bool isConsole() const |
106 |
{
|
|
107 |
return false; |
|
108 |
}
|
|
109 |
||
110 |
virtual bool isInteractive() const |
|
111 |
{
|
|
112 |
return false; |
|
113 |
}
|
|
114 |
||
115 |
virtual bool isAdmin() const |
|
2191.1.2
by Brian Aker
Adding SESSION table and adding back in the mysql interactive flag. |
116 |
{
|
117 |
return false; |
|
118 |
}
|
|
119 |
||
2154.2.4
by Brian Aker
This fixes 716459 |
120 |
virtual catalog::Instance::shared_ptr catalog() |
2104.1.2
by Brian Aker
Update console to switch to different catalogs. |
121 |
{
|
122 |
return catalog::local(); |
|
123 |
}
|
|
124 |
||
971.6.1
by Eric Day
Renamed Protocol to Client, cleaned up some unnecessary methods along the way. |
125 |
/**
|
126 |
* Read command from client.
|
|
127 |
*/
|
|
971.6.10
by Eric Day
Added NULL client for rm_tmp_table. |
128 |
virtual bool readCommand(char **packet, uint32_t *packet_length)= 0; |
971.6.1
by Eric Day
Renamed Protocol to Client, cleaned up some unnecessary methods along the way. |
129 |
|
130 |
/* Send responses. */
|
|
131 |
virtual void sendOK(void)= 0; |
|
132 |
virtual void sendEOF(void)= 0; |
|
2126.3.4
by Brian Aker
Additional error cleanup (passing error correctly to the client code). |
133 |
virtual void sendError(const drizzled::error_t sql_errno, const char *err)= 0; |
971.3.17
by Eric Day
Cleaned up int/date related store functions. |
134 |
|
971.6.1
by Eric Day
Renamed Protocol to Client, cleaned up some unnecessary methods along the way. |
135 |
/**
|
136 |
* Send field list for result set.
|
|
137 |
*/
|
|
971.3.63
by Eric Day
Removed protocol field flags. |
138 |
virtual bool sendFields(List<Item> *list)= 0; |
971.3.17
by Eric Day
Cleaned up int/date related store functions. |
139 |
|
971.6.1
by Eric Day
Renamed Protocol to Client, cleaned up some unnecessary methods along the way. |
140 |
/* Send result fields in various forms. */
|
971.3.18
by Eric Day
Finished store() cleanup. |
141 |
virtual bool store(Field *from)= 0; |
971.3.17
by Eric Day
Cleaned up int/date related store functions. |
142 |
virtual bool store(void)= 0; |
143 |
virtual bool store(int32_t from)= 0; |
|
144 |
virtual bool store(uint32_t from)= 0; |
|
145 |
virtual bool store(int64_t from)= 0; |
|
146 |
virtual bool store(uint64_t from)= 0; |
|
971.3.18
by Eric Day
Finished store() cleanup. |
147 |
virtual bool store(double from, uint32_t decimals, String *buffer)= 0; |
2030.1.5
by Brian Aker
Update for moving DRIZZLE_TIME to type::Time |
148 |
virtual bool store(const type::Time *from); |
971.7.1
by Eric Day
Client/Listen cleanup, moved globals, console plugin cleanup. |
149 |
virtual bool store(const char *from); |
1054.2.9
by Monty Taylor
Removed CHARSET_INFO stuff from protocol plugin interface - it makes no sense. |
150 |
virtual bool store(const char *from, size_t length)= 0; |
1245.2.4
by Monty Taylor
Fixed the store methods to take std::string properly. |
151 |
virtual bool store(const std::string &from) |
1245.2.1
by Monty Taylor
Removed final use if I_List<> in the server. |
152 |
{
|
153 |
return store(from.c_str(), from.size()); |
|
154 |
}
|
|
971.6.1
by Eric Day
Renamed Protocol to Client, cleaned up some unnecessary methods along the way. |
155 |
|
156 |
/* Try to remove these. */
|
|
157 |
virtual bool haveMoreData(void)= 0; |
|
158 |
virtual bool haveError(void)= 0; |
|
159 |
virtual bool wasAborted(void)= 0; |
|
1192.2.2
by Monty Taylor
Added type name strings to all of the plugin types. |
160 |
|
971.3.13
by Eric Day
Added new Protocol plugin header. |
161 |
};
|
162 |
||
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
163 |
} /* namespace plugin */ |
164 |
} /* namespace drizzled */ |
|
971.3.65
by Eric Day
Namespace cleanup for Protocol and Listen. |
165 |