~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
 *
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
 */
19
20
21
#ifndef DRIZZLED_TABLE_IDENT_H
22
#define DRIZZLED_TABLE_IDENT_H
23
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
24
#include "drizzled/session.h"
25
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
26
namespace drizzled
27
{
28
851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
29
/* Structure for db & table in sql_yacc */
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
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:
33
  LEX_STRING db;
34
  LEX_STRING table;
35
  Select_Lex_Unit *sel;
971.3.59 by Eric Day
Removed client_capabilities from session and pushed functionality into protocol plugin.
36
  inline Table_ident(LEX_STRING db_arg, LEX_STRING table_arg)
851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
37
    :table(table_arg), sel((Select_Lex_Unit *)0)
38
  {
971.3.59 by Eric Day
Removed client_capabilities from session and pushed functionality into protocol plugin.
39
    db= db_arg;
851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
40
  }
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
41
  explicit Table_ident(LEX_STRING table_arg)
851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
42
    :table(table_arg), sel((Select_Lex_Unit *)0)
43
  {
44
    db.str=0;
45
  }
46
  /*
47
    This constructor is used only for the case when we create a derived
48
    table. A derived table has no name and doesn't belong to any database.
49
    Later, if there was an alias specified for the table, it will be set
50
    by add_table_to_list.
51
  */
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
52
  explicit Table_ident(Select_Lex_Unit *s) : sel(s)
851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
53
  {
54
    /* We must have a table name here as this is used with add_table_to_list */
55
    db.str= empty_c_string;                    /* a subject to casedn_str */
56
    db.length= 0;
57
    table.str= internal_table_name;
58
    table.length=1;
59
  }
60
  bool is_derived_table() const { return test(sel); }
61
  inline void change_db(char *db_name)
62
  {
895 by Brian Aker
Completion (?) of uint conversion.
63
    db.str= db_name; db.length= (uint32_t) strlen(db_name);
851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
64
  }
65
};
66
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
67
} /* namespace drizzled */
68
851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
69
#endif /* DRIZZLED_TABLE_IDENT_H */