~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/null_client.h

  • Committer: patrick crews
  • Date: 2011-06-08 03:02:27 UTC
  • mto: This revision was merged to the branch mainline in revision 2329.
  • Revision ID: gleebix@gmail.com-20110608030227-updkyv2652zvfajc
Initial voodoo worked to give us a crashme mode.  Need docs still

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems
 
4
 *  Copyright (C) 2008 Sun Microsystems, Inc.
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#ifndef DRIZZLED_PLUGIN_NULL_CLIENT_H
21
 
#define DRIZZLED_PLUGIN_NULL_CLIENT_H
 
20
#pragma once
22
21
 
23
22
#include <drizzled/plugin/client.h>
24
 
#include<boost/tokenizer.hpp>
 
23
#include <boost/tokenizer.hpp>
25
24
#include <vector>
26
25
#include <queue>
27
26
#include <string>
28
27
 
29
 
namespace drizzled
30
 
{
31
 
namespace plugin
32
 
{
 
28
namespace drizzled {
 
29
namespace plugin {
33
30
 
34
31
/**
35
32
 * This class is an empty client implementation for internal used.
57
54
  virtual void close(void) {}
58
55
  virtual bool authenticate(void) { return true; }
59
56
 
60
 
  virtual bool readCommand(char **packet, uint32_t *packet_length)
 
57
  virtual bool readCommand(char **packet, uint32_t& packet_length)
61
58
  {
62
59
    while(not to_execute.empty())
63
60
    {
67
64
 
68
65
      *packet= &packet_buffer[0];
69
66
 
70
 
      *packet_length= next.size();
 
67
      packet_length= next.size();
71
68
 
72
69
      to_execute.pop();
73
70
 
77
74
    if (not is_dead)
78
75
    {
79
76
      packet_buffer.resize(1);
80
 
      *packet_length= 1;
 
77
      packet_length= 1;
81
78
      *packet= &packet_buffer[0];
82
79
      is_dead= true;
83
80
 
84
81
      return true;
85
82
    }
86
83
 
87
 
    *packet_length= 0;
 
84
    packet_length= 0;
88
85
    return false;
89
86
  }
90
87
 
91
88
  virtual void sendOK(void) {}
92
89
  virtual void sendEOF(void) {}
93
 
  virtual void sendError(uint32_t, const char*) {}
 
90
  virtual void sendError(const drizzled::error_t, const char*) {}
94
91
  virtual bool sendFields(List<Item>*) { return false; }
95
 
  virtual bool store(Field *) { return false; }
96
 
  virtual bool store(void) { return false; }
97
 
  virtual bool store(int32_t) { return false; }
98
 
  virtual bool store(uint32_t) { return false; }
99
 
  virtual bool store(int64_t) { return false; }
100
 
  virtual bool store(uint64_t) { return false; }
101
 
  virtual bool store(double, uint32_t, String*) { return false; }
102
 
  virtual bool store(const DRIZZLE_TIME*) { return false; }
103
 
  virtual bool store(const char*) { return false; }
104
 
  virtual bool store(const char*, size_t) { return false; }
105
 
  virtual bool store(const std::string &) { return false; }
 
92
  virtual void store(Field *) {}
 
93
  virtual void store(void) {}
 
94
  virtual void store(int32_t) {}
 
95
  virtual void store(uint32_t) {}
 
96
  virtual void store(int64_t) {}
 
97
  virtual void store(uint64_t) {}
 
98
  virtual void store(double, uint32_t, String*) {}
 
99
  virtual void store(const type::Time*) {}
 
100
  virtual void store(const char*) {}
 
101
  virtual void store(const char*, size_t) {}
 
102
  virtual void store(const std::string &) {}
106
103
  virtual bool haveMoreData(void) { return false;}
107
104
  virtual bool haveError(void) { return false; }
108
105
  virtual bool wasAborted(void) { return false; }
115
112
 
116
113
    for (Tokenizer::iterator iter= tok.begin(); iter != tok.end(); ++iter)
117
114
    {
118
 
      byte.resize((*iter).size() +1); // +1 for the COM_QUERY
 
115
      byte.resize(iter->size() +1); // +1 for the COM_QUERY
119
116
      byte[0]= COM_QUERY;
120
 
      memcpy(&byte[1], (*iter).c_str(), (*iter).size());
 
117
      memcpy(&byte[1], iter->c_str(), iter->size());
121
118
      to_execute.push(byte);
122
119
    }
123
120
  }
126
123
} /* namespace plugin */
127
124
} /* namespace drizzled */
128
125
 
129
 
#endif /* DRIZZLED_PLUGIN_NULL_CLIENT_H */