~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table_ident.h

  • Committer: Daniel Nichter
  • Date: 2011-10-23 16:01:37 UTC
  • mto: This revision was merged to the branch mainline in revision 2448.
  • Revision ID: daniel@percona.com-20111023160137-7ac3blgz8z4tf8za
Add Administration Getting Started and Logging.  Capitalize SQL clause keywords.

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) 2008 Sun Microsystems, Inc.
 
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
#pragma once
 
22
 
 
23
#include <drizzled/lex_string.h>
 
24
#include <drizzled/memory/sql_alloc.h>
 
25
#include <drizzled/util/test.h>
 
26
 
 
27
namespace drizzled {
 
28
 
 
29
/* Structure for db & table in sql_yacc */
 
30
class Table_ident : public memory::SqlAlloc
 
31
{
 
32
public:
 
33
  lex_string_t db;
 
34
  lex_string_t table;
 
35
  Select_Lex_Unit *sel;
 
36
 
 
37
  inline Table_ident(lex_string_t db_arg, lex_string_t table_arg)
 
38
    : db(db_arg), table(table_arg), sel(NULL)
 
39
  {
 
40
  }
 
41
 
 
42
  explicit Table_ident(lex_string_t table_arg)
 
43
    : table(table_arg), sel(NULL)
 
44
  {
 
45
    db.str= 0;
 
46
  }
 
47
 
 
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
  */
 
54
  explicit Table_ident(Select_Lex_Unit *s) : sel(s)
 
55
  {
 
56
    /* We must have a table name here as this is used with add_table_to_list */
 
57
    db.str= const_cast<char*>("");                    /* a subject to casedn_str */
 
58
    db.length= 0;
 
59
    table.str= const_cast<char*>("*");
 
60
    table.length= 1;
 
61
  }
 
62
  bool is_derived_table() const { return test(sel); }
 
63
};
 
64
 
 
65
} /* namespace drizzled */
 
66