~drizzle-trunk/drizzle/development

520.4.30 by Monty Taylor
Moved LEX_STRING into drizzled/lex_string.h.
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
1999.6.1 by kalebral at gmail
update Copyright strings to a more common format to help with creating the master debian copyright file
4
 *  Copyright (C) 2008 Sun Microsystems, Inc.
520.4.30 by Monty Taylor
Moved LEX_STRING into drizzled/lex_string.h.
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
 */
19
2234 by Brian Aker
Mass removal of ifdef/endif in favor of pragma once.
20
#pragma once
520.4.30 by Monty Taylor
Moved LEX_STRING into drizzled/lex_string.h.
21
575.1.6 by Monty Taylor
Cleaned up some headers for PCH.
22
#include <stddef.h>
23
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
24
namespace drizzled
25
{
26
520.4.30 by Monty Taylor
Moved LEX_STRING into drizzled/lex_string.h.
27
/*
28
  LEX_STRING -- a pair of a C-string and its length.
29
*/
30
31
/* This definition must match the one given in mysql/plugin.h */
2073.1.2 by Brian Aker
Basic DDL for catalog.
32
typedef struct lex_string_t
520.4.30 by Monty Taylor
Moved LEX_STRING into drizzled/lex_string.h.
33
{
34
  char *str;
35
  size_t length;
36
} LEX_STRING;
37
2114.4.5 by Brian Aker
Remove duplicate code around ident check.
38
inline const LEX_STRING &null_lex_string()
39
{
40
  static LEX_STRING tmp= { NULL, 0 };
41
  return tmp;
42
}
43
44
#define NULL_LEX_STRING null_lex_string()
45
2073.1.2 by Brian Aker
Basic DDL for catalog.
46
struct execute_string_t : public lex_string_t
1921.4.1 by Brian Aker
Adding in support for EXECUTE to have WITH NO RETURN.
47
{
1921.4.4 by Brian Aker
Fix for Solaris.
48
private:
1921.4.1 by Brian Aker
Adding in support for EXECUTE to have WITH NO RETURN.
49
  bool is_variable;
1921.4.4 by Brian Aker
Fix for Solaris.
50
public:
1921.4.1 by Brian Aker
Adding in support for EXECUTE to have WITH NO RETURN.
51
52
  bool isVariable() const
53
  {
54
    return is_variable;
55
  }
56
2073.1.2 by Brian Aker
Basic DDL for catalog.
57
  void set(const lex_string_t& ptr, bool is_variable_arg= false)
1921.4.4 by Brian Aker
Fix for Solaris.
58
  {
59
    is_variable= is_variable_arg;
1921.4.1 by Brian Aker
Adding in support for EXECUTE to have WITH NO RETURN.
60
    str= ptr.str;
61
    length= ptr.length;
62
  }
63
64
};
65
520.4.30 by Monty Taylor
Moved LEX_STRING into drizzled/lex_string.h.
66
1238.1.4 by Brian Aker
ICC cleanup
67
#define STRING_WITH_LEN(X) (X), (static_cast<size_t>((sizeof(X) - 1)))
68
#define C_STRING_WITH_LEN(X) (const_cast<char *>((X))), (static_cast<size_t>((sizeof(X) - 1)))
520.4.30 by Monty Taylor
Moved LEX_STRING into drizzled/lex_string.h.
69
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
70
} /* namespace drizzled */
520.4.30 by Monty Taylor
Moved LEX_STRING into drizzled/lex_string.h.
71