1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008 Sun Microsystems
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.
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.
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
20
#ifndef DRIZZLED_PLUGIN_PROTOCOL_H
21
#define DRIZZLED_PLUGIN_PROTOCOL_H
23
#include <drizzled/sql_list.h>
24
#include <drizzled/item.h>
36
virtual ~Protocol() {}
38
virtual void setSession(Session *session_arg)
43
virtual Session *getSession(void)
48
virtual bool isConnected()= 0;
49
virtual void setReadTimeout(uint32_t timeout)= 0;
50
virtual void setWriteTimeout(uint32_t timeout)= 0;
51
virtual void setRetryCount(uint32_t count)= 0;
52
virtual void setError(char error)= 0;
53
virtual bool haveError(void)= 0;
54
virtual bool wasAborted(void)= 0;
55
virtual void enableCompression(void)= 0;
56
virtual bool haveMoreData(void)= 0;
57
virtual bool isReading(void)= 0;
58
virtual bool isWriting(void)= 0;
59
virtual bool setFileDescriptor(int fd)=0;
60
virtual int fileDescriptor(void)=0;
61
virtual void setRandom(uint64_t, uint64_t) {};
62
virtual bool authenticate(void)=0;
63
virtual bool readCommand(char **packet, uint32_t *packet_length)=0;
64
virtual void sendOK()= 0;
65
virtual void sendEOF()= 0;
66
virtual void sendError(uint32_t sql_errno, const char *err)=0;
67
virtual void close(void) {};
68
virtual void prepareForResend()= 0;
69
virtual void free()= 0;
70
virtual bool write()= 0;
72
enum { SEND_NUM_ROWS= 1, SEND_DEFAULTS= 2, SEND_EOF= 4 };
73
virtual bool sendFields(List<Item> *list, uint32_t flags)= 0;
75
virtual bool store(Field *from)= 0;
76
virtual bool store(void)= 0;
77
virtual bool store(int32_t from)= 0;
78
virtual bool store(uint32_t from)= 0;
79
virtual bool store(int64_t from)= 0;
80
virtual bool store(uint64_t from)= 0;
81
virtual bool store(double from, uint32_t decimals, String *buffer)= 0;
82
virtual bool store(const DRIZZLE_TIME *from)= 0;
83
virtual bool store(const char *from, const CHARSET_INFO * const cs)
87
return store(from, strlen(from), cs);
89
virtual bool store(const char *from, size_t length,
90
const CHARSET_INFO * const cs)= 0;
97
virtual ~ProtocolFactory() {}
98
virtual Protocol *operator()(void)= 0;
101
#endif /* DRIZZLED_PLUGIN_PROTOCOL_H */