~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session/state.cc

  • Committer: Stewart Smith
  • Date: 2010-11-07 04:22:31 UTC
  • mto: (1911.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 1912.
  • Revision ID: stewart@flamingspork.com-20101107042231-ola4sl7j0qvg58tz
fix ARCHIVE storage engine calling exit (lintian warning). Was because we were linking in libinternal into libazio, which links into archive plugin. Just link libinternal into the command line utilities.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 
 *
4
 
 *  Copyright (C) 2011 Brian Aker
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; either version 2 of the License, or
9
 
 *  (at your option) any later version.
10
 
 *
11
 
 *  This program is distributed in the hope that it will be useful,
12
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 
 *  GNU General Public License for more details.
15
 
 *
16
 
 *  You should have received a copy of the GNU General Public License
17
 
 *  along with this program; if not, write to the Free Software
18
 
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
 
 */
20
 
 
21
 
#include <config.h>
22
 
 
23
 
#include <drizzled/session/state.h>
24
 
#include <drizzled/definitions.h>
25
 
 
26
 
#include <string>
27
 
 
28
 
namespace drizzled
29
 
{
30
 
 
31
 
namespace session
32
 
{
33
 
 
34
 
State::State(const char *in_packet, size_t in_packet_length)
35
 
{
36
 
  if (in_packet_length)
37
 
  {
38
 
    size_t minimum= std::min(in_packet_length, static_cast<size_t>(PROCESS_LIST_WIDTH));
39
 
    _query.resize(minimum + 1);
40
 
    memcpy(&_query[0], in_packet, minimum);
41
 
  }
42
 
  else
43
 
  {
44
 
    _query.resize(0);
45
 
  }
46
 
}
47
 
 
48
 
const char *State::query() const
49
 
{
50
 
  if (_query.size())
51
 
    return &_query[0];
52
 
 
53
 
  return "";
54
 
}
55
 
 
56
 
const char *State::query(size_t &size) const
57
 
{
58
 
  if (_query.size())
59
 
  {
60
 
    size= _query.size() -1;
61
 
    return &_query[0];
62
 
  }
63
 
 
64
 
  size= 0;
65
 
  return "";
66
 
}
67
 
 
68
 
} /* namespace session */
69
 
} /* namespace drizzled */