~drizzle-developers/ubuntu/karmic/drizzle/ppa

« back to all changes in this revision

Viewing changes to drizzled/display.cc

  • Committer: Monty Taylor
  • Date: 2010-11-24 18:44:57 UTC
  • mfrom: (1308.1.31 trunk)
  • Revision ID: mordred@inaugust.com-20101124184457-qd6jvoe2wgnvl3yq
Tags: 2010.11.04-0ubuntu1~karmic1
* New upstream release.
* Turn off -Werror for packaging builds. (Closes: #602662)

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) 2010 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/display.h"
 
24
 
 
25
#include <assert.h>
 
26
 
 
27
namespace drizzled {
 
28
namespace display {
 
29
 
 
30
static const std::string PROGRAM_ERROR("PROGRAM_ERROR");
 
31
 
 
32
static const std::string COM_SLEEP("COM_SLEEP"); 
 
33
static const std::string COM_QUIT("COM_QUIT"); 
 
34
static const std::string COM_INIT_DB("COM_INIT_DB"); 
 
35
static const std::string COM_QUERY("COM_QUERY"); 
 
36
static const std::string COM_SHUTDOWN("COM_SHUTDOWN"); 
 
37
static const std::string COM_CONNECT("COM_CONNECT"); 
 
38
static const std::string COM_PING("COM_PING"); 
 
39
static const std::string COM_END("COM_END"); 
 
40
 
 
41
static const std::string DRIZZLE_TYPE_LONG("DRIZZLE_TYPE_LONG"); 
 
42
static const std::string DRIZZLE_TYPE_DOUBLE("DRIZZLE_TYPE_DOUBLE"); 
 
43
static const std::string DRIZZLE_TYPE_NULL("DRIZZLE_TYPE_NULL"); 
 
44
static const std::string DRIZZLE_TYPE_TIMESTAMP("DRIZZLE_TYPE_TIMESTAMP"); 
 
45
static const std::string DRIZZLE_TYPE_LONGLONG("DRIZZLE_TYPE_LONGLONG"); 
 
46
static const std::string DRIZZLE_TYPE_DATETIME("DRIZZLE_TYPE_DATETIME"); 
 
47
static const std::string DRIZZLE_TYPE_DATE("DRIZZLE_TYPE_DATE"); 
 
48
static const std::string DRIZZLE_TYPE_VARCHAR("DRIZZLE_TYPE_VARCHAR"); 
 
49
static const std::string DRIZZLE_TYPE_DECIMAL("DRIZZLE_TYPE_DECIMAL"); 
 
50
static const std::string DRIZZLE_TYPE_ENUM("DRIZZLE_TYPE_ENUM"); 
 
51
static const std::string DRIZZLE_TYPE_BLOB("DRIZZLE_TYPE_BLOB"); 
 
52
static const std::string DRIZZLE_TYPE_MAX("DRIZZLE_TYPE_MAX"); 
 
53
 
 
54
static const std::string YES("YES");
 
55
static const std::string NO("NO");
 
56
 
 
57
 
 
58
const std::string &type(drizzled::enum_server_command type)
 
59
{
 
60
  switch (type)
 
61
  {
 
62
  case drizzled::COM_SLEEP : 
 
63
    return COM_SLEEP;
 
64
  case drizzled::COM_QUIT : 
 
65
    return COM_QUIT;
 
66
  case drizzled::COM_INIT_DB : 
 
67
    return COM_INIT_DB;
 
68
  case drizzled::COM_QUERY : 
 
69
    return COM_QUERY;
 
70
  case drizzled::COM_SHUTDOWN : 
 
71
    return COM_SHUTDOWN;
 
72
  case drizzled::COM_CONNECT : 
 
73
    return COM_CONNECT;
 
74
  case drizzled::COM_PING : 
 
75
    return COM_PING;
 
76
  case drizzled::COM_END : 
 
77
    return COM_END;
 
78
  }
 
79
 
 
80
  assert(0);
 
81
  return PROGRAM_ERROR;
 
82
}
 
83
 
 
84
 
 
85
const std::string &type(drizzled::enum_field_types type)
 
86
{
 
87
  switch (type)
 
88
  {
 
89
  case drizzled::DRIZZLE_TYPE_LONG : 
 
90
    return DRIZZLE_TYPE_LONG;
 
91
  case drizzled::DRIZZLE_TYPE_DOUBLE : 
 
92
    return DRIZZLE_TYPE_DOUBLE;
 
93
  case drizzled::DRIZZLE_TYPE_NULL : 
 
94
    return DRIZZLE_TYPE_NULL;
 
95
  case drizzled::DRIZZLE_TYPE_TIMESTAMP : 
 
96
    return DRIZZLE_TYPE_TIMESTAMP;
 
97
  case drizzled::DRIZZLE_TYPE_LONGLONG : 
 
98
    return DRIZZLE_TYPE_LONGLONG;
 
99
  case drizzled::DRIZZLE_TYPE_DATETIME : 
 
100
    return DRIZZLE_TYPE_DATETIME;
 
101
  case drizzled::DRIZZLE_TYPE_DATE : 
 
102
    return DRIZZLE_TYPE_DATE;
 
103
  case drizzled::DRIZZLE_TYPE_VARCHAR : 
 
104
    return DRIZZLE_TYPE_VARCHAR;
 
105
  case drizzled::DRIZZLE_TYPE_DECIMAL : 
 
106
    return DRIZZLE_TYPE_DECIMAL;
 
107
  case drizzled::DRIZZLE_TYPE_ENUM : 
 
108
    return DRIZZLE_TYPE_ENUM;
 
109
  case drizzled::DRIZZLE_TYPE_BLOB : 
 
110
    return DRIZZLE_TYPE_BLOB;
 
111
  }
 
112
 
 
113
  assert(0);
 
114
  return PROGRAM_ERROR;
 
115
}
 
116
 
 
117
} /* namespace display */
 
118
} /* namespace drizzled */