~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table_ident.h

  • Committer: Stewart Smith
  • Date: 2008-12-18 23:54:47 UTC
  • mto: This revision was merged to the branch mainline in revision 719.
  • Revision ID: stewart@flamingspork.com-20081218235447-qf6dofgd6guwefo2
fix RENAME TABLE

(problem was missing hton to mysql_rename_table)

If engine implements table_exists_in_engine we get the hton from there.

Else, we reintroduce the mysql_frm_type hackery (temporarily, it *will* go away again with FRM removal).

also fix rename test: no views, plus current FLUSH LOCKS bug.

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
 
#ifndef DRIZZLED_TABLE_IDENT_H
22
 
#define DRIZZLED_TABLE_IDENT_H
23
 
 
24
 
#include "drizzled/lex_string.h"
25
 
#include "drizzled/memory/sql_alloc.h"
26
 
#include "drizzled/util/test.h"
27
 
 
28
 
namespace drizzled
29
 
{
30
 
 
31
 
extern char empty_c_string[1];
32
 
extern char internal_table_name[2];
33
 
 
34
 
/* Structure for db & table in sql_yacc */
35
 
class Table_ident :public memory::SqlAlloc
36
 
{
37
 
public:
38
 
  LEX_STRING db;
39
 
  LEX_STRING table;
40
 
  Select_Lex_Unit *sel;
41
 
  inline Table_ident(LEX_STRING db_arg, LEX_STRING table_arg)
42
 
    :table(table_arg), sel((Select_Lex_Unit *)0)
43
 
  {
44
 
    db= db_arg;
45
 
  }
46
 
  explicit Table_ident(LEX_STRING table_arg)
47
 
    :table(table_arg), sel((Select_Lex_Unit *)0)
48
 
  {
49
 
    db.str=0;
50
 
  }
51
 
  /*
52
 
    This constructor is used only for the case when we create a derived
53
 
    table. A derived table has no name and doesn't belong to any database.
54
 
    Later, if there was an alias specified for the table, it will be set
55
 
    by add_table_to_list.
56
 
  */
57
 
  explicit Table_ident(Select_Lex_Unit *s) : sel(s)
58
 
  {
59
 
    /* We must have a table name here as this is used with add_table_to_list */
60
 
    db.str= empty_c_string;                    /* a subject to casedn_str */
61
 
    db.length= 0;
62
 
    table.str= internal_table_name;
63
 
    table.length=1;
64
 
  }
65
 
  bool is_derived_table() const { return test(sel); }
66
 
  inline void change_db(char *db_name)
67
 
  {
68
 
    db.str= db_name; db.length= (uint32_t) strlen(db_name);
69
 
  }
70
 
};
71
 
 
72
 
} /* namespace drizzled */
73
 
 
74
 
#endif /* DRIZZLED_TABLE_IDENT_H */