~drizzle-trunk/drizzle/development

1063.4.5 by Padraig O'Sullivan
Fixed a stupid mistake I made in the innodb handler. Also reverted back to
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
520.4.14 by Monty Taylor
Removed korr.h and tztime.h from common_includes. Also removed the HAVE_DTRACE block and stuck it in autoconf.
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
4
 *  Copyright (C) 2008 Sun Microsystems
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
 */
1 by brian
clean slate
19
20
21
/* Function with list databases, tables or fields */
1241.9.36 by Monty Taylor
ZOMG. I deleted drizzled/server_includes.h.
22
#include "config.h"
243.1.17 by Jay Pipes
FINAL PHASE removal of mysql_priv.h (Bye, bye my friend.)
23
#include <drizzled/sql_select.h>
575.4.7 by Monty Taylor
More header cleanup.
24
#include <drizzled/show.h>
538 by Monty Taylor
Moved gettext.h into drizzled in anticipation of the new client lib.
25
#include <drizzled/gettext.h>
492.1.8 by Monty Taylor
Replaced some int10_to_str with to_string.
26
#include <drizzled/util/convert.h>
550 by Monty Taylor
Moved error.h into just the files that need it.
27
#include <drizzled/error.h>
520.4.14 by Monty Taylor
Removed korr.h and tztime.h from common_includes. Also removed the HAVE_DTRACE block and stuck it in autoconf.
28
#include <drizzled/tztime.h>
520.6.7 by Monty Taylor
Moved a bunch of crap out of common_includes.
29
#include <drizzled/data_home.h>
642.1.63 by Lee
more header file cleanup
30
#include <drizzled/item/blob.h>
584.4.7 by Monty Taylor
Removed a big bank of includes from item.h.
31
#include <drizzled/item/cmpfunc.h>
642.1.17 by Lee
header file clean up
32
#include <drizzled/item/return_int.h>
642.1.23 by Lee
more header file cleanup
33
#include <drizzled/item/empty_string.h>
642.1.18 by Lee
header file clean up
34
#include <drizzled/item/return_date_time.h>
584.1.15 by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes.
35
#include <drizzled/sql_base.h>
36
#include <drizzled/db.h>
584.5.1 by Monty Taylor
Removed field includes from field.h.
37
#include <drizzled/field/timestamp.h>
670.1.1 by Monty Taylor
Renamed fdecimal.* to decimal.*. Let's see how many things we can break!
38
#include <drizzled/field/decimal.h>
670.2.4 by Monty Taylor
Removed more stuff from the headers.
39
#include <drizzled/lock.h>
675 by Brian Aker
Cleanup around item includes.
40
#include <drizzled/item/return_date_time.h>
41
#include <drizzled/item/empty_string.h>
1241.9.17 by Monty Taylor
Removed more bits from server_includes.
42
#include "drizzled/session_list.h"
1089.10.1 by Stewart Smith
fix SHOW CREATE DATABASE for default collation. Move database metadata reading code around to be a bit more sane.
43
#include <drizzled/message/schema.pb.h>
971.6.1 by Eric Day
Renamed Protocol to Client, cleaned up some unnecessary methods along the way.
44
#include <drizzled/plugin/client.h>
1241.9.44 by Monty Taylor
Made magic with cached_directory.
45
#include <drizzled/cached_directory.h>
1241.9.23 by Monty Taylor
Removed sql_table.h from server_includes.h.
46
#include "drizzled/sql_table.h"
1241.9.28 by Monty Taylor
Removed global_charset_info.h from server_includes.h
47
#include "drizzled/global_charset_info.h"
1241.9.31 by Monty Taylor
Moved global pthread variables into their own header.
48
#include "drizzled/pthread_globals.h"
1241.9.64 by Monty Taylor
Moved remaining non-public portions of mysys and mystrings to drizzled/internal.
49
#include "drizzled/internal/m_string.h"
50
#include "drizzled/internal/my_sys.h"
1638.10.2 by Stewart Smith
for store_create_info() (called in SHOW CREATE TABLE code path) call transformTableDefinitionToSql() in statement_transform lib instead of doing manual things on Table. This is the initial step in getting SHOW CREATE TABLE to be run from proto.
51
#include "drizzled/message/statement_transform.h"
52
1241.9.28 by Monty Taylor
Removed global_charset_info.h from server_includes.h
53
1108.4.2 by David Shrewsbury
Replace my_dir in find_files() with CachedDirectory. Renamed find_files() to find_dirs() to more accurately reflect what it is doing after removing dead code inside it.
54
#include <sys/stat.h>
584.1.13 by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes.
55
56
#include <string>
629.4.1 by Monty Taylor
First step in support size_t sys_var stuff.
57
#include <iostream>
58
#include <sstream>
901.1.1 by Padraig
Initial work to replace an instance of DYNAMIC_ARRAY in show.cc with STL
59
#include <vector>
60
#include <algorithm>
629.4.1 by Monty Taylor
First step in support size_t sys_var stuff.
61
62
using namespace std;
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
63
64
namespace drizzled
65
{
1 by brian
clean slate
66
322.2.2 by Mats Kindahl
Hiding THD::proc_info field and providing a setter and getter.
67
inline const char *
68
str_or_nil(const char *str)
69
{
70
  return str ? str : "<nil>";
71
}
1 by brian
clean slate
72
1273.13.38 by Brian Aker
Add in new show work.
73
int wild_case_compare(const CHARSET_INFO * const cs, const char *str, const char *wildstr)
1 by brian
clean slate
74
{
75
  register int flag;
1273.13.61 by Brian Aker
Fixes a memory leak. sql_string() sucks.
76
1 by brian
clean slate
77
  while (*wildstr)
78
  {
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
79
    while (*wildstr && *wildstr != internal::wild_many && *wildstr != internal::wild_one)
1 by brian
clean slate
80
    {
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
81
      if (*wildstr == internal::wild_prefix && wildstr[1])
51.1.1 by Jay Pipes
Merged PatG's removal of various DBUG stuff with still keeping DBUG_ASSERT calls since they seem to be breaking test runs
82
        wildstr++;
83
      if (my_toupper(cs, *wildstr++) != my_toupper(cs, *str++))
1067.3.1 by Padraig O'Sullivan
Extracted the CHARACTER_SET I_S table into the I_S plugin.
84
        return (1);
1 by brian
clean slate
85
    }
51.1.1 by Jay Pipes
Merged PatG's removal of various DBUG stuff with still keeping DBUG_ASSERT calls since they seem to be breaking test runs
86
    if (! *wildstr )
87
      return (*str != 0);
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
88
    if (*wildstr++ == internal::wild_one)
1 by brian
clean slate
89
    {
51.1.1 by Jay Pipes
Merged PatG's removal of various DBUG stuff with still keeping DBUG_ASSERT calls since they seem to be breaking test runs
90
      if (! *str++)
91
        return (1);	/* One char; skip */
1 by brian
clean slate
92
    }
93
    else
94
    {						/* Found '*' */
1067.3.1 by Padraig O'Sullivan
Extracted the CHARACTER_SET I_S table into the I_S plugin.
95
      if (! *wildstr)
96
        return (0);		/* '*' as last char: OK */
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
97
      flag=(*wildstr != internal::wild_many && *wildstr != internal::wild_one);
1 by brian
clean slate
98
      do
99
      {
1067.3.1 by Padraig O'Sullivan
Extracted the CHARACTER_SET I_S table into the I_S plugin.
100
        if (flag)
101
        {
102
          char cmp;
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
103
          if ((cmp= *wildstr) == internal::wild_prefix && wildstr[1])
1067.3.1 by Padraig O'Sullivan
Extracted the CHARACTER_SET I_S table into the I_S plugin.
104
            cmp= wildstr[1];
105
          cmp= my_toupper(cs, cmp);
106
          while (*str && my_toupper(cs, *str) != cmp)
107
            str++;
108
          if (! *str)
109
            return (1);
110
        }
111
        if (wild_case_compare(cs, str, wildstr) == 0)
112
          return (0);
113
      } while (*str++);
51.1.1 by Jay Pipes
Merged PatG's removal of various DBUG stuff with still keeping DBUG_ASSERT calls since they seem to be breaking test runs
114
      return (1);
1 by brian
clean slate
115
    }
116
  }
1273.13.61 by Brian Aker
Fixes a memory leak. sql_string() sucks.
117
51.1.1 by Jay Pipes
Merged PatG's removal of various DBUG stuff with still keeping DBUG_ASSERT calls since they seem to be breaking test runs
118
  return (*str != '\0');
1 by brian
clean slate
119
}
120
121
/*
122
  Get the quote character for displaying an identifier.
123
124
  SYNOPSIS
125
    get_quote_char_for_identifier()
126
127
  IMPLEMENTATION
128
    Force quoting in the following cases:
129
      - name is empty (for one, it is possible when we use this function for
130
        quoting user and host names for DEFINER clause);
131
      - name is a keyword;
132
      - name includes a special character;
133
    Otherwise identifier is quoted only if the option OPTION_QUOTE_SHOW_CREATE
134
    is set.
135
136
  RETURN
137
    EOF	  No quote character is needed
138
    #	  Quote character
139
*/
140
1014.3.4 by Brian Aker
Remove dead session calls.
141
int get_quote_char_for_identifier()
1 by brian
clean slate
142
{
352.2.1 by Harrison Fisk
Fix for bugs 259843 and 256482
143
  return '`';
1 by brian
clean slate
144
}
145
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
146
} /* namespace drizzled */