drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
client.h
1/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3 *
4 * Copyright (C) 2008 Sun Microsystems, Inc.
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
20#pragma once
21
22#include <drizzled/catalog/instance.h>
23#include <drizzled/catalog/local.h>
24#include <drizzled/error_t.h>
25#include <drizzled/item.h>
26#include <drizzled/visibility.h>
27
28namespace drizzled {
29namespace plugin {
30
39{
40protected:
41 Session *session;
42
43public:
44 virtual ~Client() {}
45
51 {
52 return session;
53 }
54
59 virtual void setSession(Session *session_arg)
60 {
61 session= session_arg;
62 }
63
68 virtual int getFileDescriptor()= 0;
69
74 virtual bool isConnected()= 0;
75
80 virtual bool flush()= 0;
81
85 virtual void close()= 0;
86
90 virtual bool authenticate()= 0;
91
92 virtual bool isConsole() const
93 {
94 return false;
95 }
96
97 virtual bool isInteractive() const
98 {
99 return false;
100 }
101
102 virtual catalog::Instance::shared_ptr catalog()
103 {
104 return catalog::local();
105 }
106
110 virtual bool readCommand(char **packet, uint32_t& packet_length)= 0;
111
112 /* Send responses. */
113 virtual void sendOK()= 0;
114 virtual void sendEOF()= 0;
115 virtual void sendError(const drizzled::error_t sql_errno, const char *err)= 0;
116
120 virtual void sendFields(List<Item>&)= 0;
121
122 /* Send result fields in various forms. */
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(str_ref from)
134 {
135 store(from.data(), from.size());
136 }
137
138 /* Try to remove these. */
139 virtual bool haveError()= 0;
140 virtual bool wasAborted()= 0;
141
142};
143
144} /* namespace plugin */
145} /* namespace drizzled */
virtual void close()=0
virtual Session * getSession()
Definition client.h:50
virtual int getFileDescriptor()=0
virtual void setSession(Session *session_arg)
Definition client.h:59
virtual bool isConnected()=0
virtual bool flush()=0
virtual void sendFields(List< Item > &)=0
virtual bool authenticate()=0
virtual bool readCommand(char **packet, uint32_t &packet_length)=0
TODO: Rename this file - func.h is stupid.
Visibility Control Macros.
#define DRIZZLED_API
Definition visibility.h:38