~drizzle-trunk/drizzle/development

851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
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.
851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
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
20
2234 by Brian Aker
Mass removal of ifdef/endif in favor of pragma once.
21
#pragma once
851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
22
2173.2.1 by Monty Taylor
Fixes incorrect usage of include
23
#include <drizzled/lex_string.h>
24
#include <drizzled/memory/sql_alloc.h>
25
#include <drizzled/util/test.h>
1638.10.77 by Stewart Smith
table_ident.h was missing a dependency on session.h for: ./drizzled/table_ident.h:53: error: ‘empty_c_string’ was not declared in this scope
26
2239.1.3 by Olaf van der Spek
Refactor includes
27
namespace drizzled {
28
851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
29
/* Structure for db & table in sql_yacc */
2385.1.1 by Olaf van der Spek
Refactor lex_string_t
30
class Table_ident : public memory::SqlAlloc
851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
31
{
32
public:
2371.1.2 by Brian Aker
Remove the typedef on lexkey
33
  lex_string_t db;
2445.1.14 by Olaf van der Spek
Refactor
34
  str_ref table;
851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
35
  Select_Lex_Unit *sel;
2385.1.2 by Olaf van der Spek
Refactor Table_ident
36
2445.1.14 by Olaf van der Spek
Refactor
37
  Table_ident(lex_string_t db_arg, str_ref table_arg)
2385.1.2 by Olaf van der Spek
Refactor Table_ident
38
    : db(db_arg), table(table_arg), sel(NULL)
851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
39
  {
40
  }
2385.1.2 by Olaf van der Spek
Refactor Table_ident
41
2371.1.2 by Brian Aker
Remove the typedef on lexkey
42
  explicit Table_ident(lex_string_t table_arg)
2385.1.1 by Olaf van der Spek
Refactor lex_string_t
43
    : table(table_arg), sel(NULL)
851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
44
  {
2430.2.6 by Olaf van der Spek
Use assign()
45
    db.assign(static_cast<const char*>(NULL), 0);
851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
46
  }
2385.1.2 by Olaf van der Spek
Refactor Table_ident
47
851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
48
  /*
49
    This constructor is used only for the case when we create a derived
50
    table. A derived table has no name and doesn't belong to any database.
51
    Later, if there was an alias specified for the table, it will be set
52
    by add_table_to_list.
53
  */
2445.1.14 by Olaf van der Spek
Refactor
54
  explicit Table_ident(Select_Lex_Unit *s) : 
55
    table("*"), sel(s)
851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
56
  {
57
    /* We must have a table name here as this is used with add_table_to_list */
2430.1.1 by Olaf van der Spek
Use lex_string assign(), data() and size()
58
    db.assign("", 0); // a subject to casedn_str
851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
59
  }
60
  bool is_derived_table() const { return test(sel); }
61
};
62
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
63
} /* namespace drizzled */
64