~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table_ident.h

  • Committer: Henrik Ingo
  • Date: 2011-09-23 06:14:37 UTC
  • mfrom: (2425 drizzle)
  • mto: This revision was merged to the branch mainline in revision 2439.
  • Revision ID: henrik.ingo@avoinelama.fi-20110923061437-ct1wedkb9s47uy2t
Merge newest trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
namespace drizzled {
28
28
 
29
 
extern char empty_c_string[1];
30
 
extern char internal_table_name[2];
31
 
 
32
29
/* Structure for db & table in sql_yacc */
33
 
class Table_ident :public memory::SqlAlloc
 
30
class Table_ident : public memory::SqlAlloc
34
31
{
35
32
public:
36
 
  LEX_STRING db;
37
 
  LEX_STRING table;
 
33
  lex_string_t db;
 
34
  lex_string_t table;
38
35
  Select_Lex_Unit *sel;
39
 
  inline Table_ident(LEX_STRING db_arg, LEX_STRING table_arg)
40
 
    :table(table_arg), sel((Select_Lex_Unit *)0)
41
 
  {
42
 
    db= db_arg;
43
 
  }
44
 
  explicit Table_ident(LEX_STRING table_arg)
45
 
    :table(table_arg), sel((Select_Lex_Unit *)0)
46
 
  {
47
 
    db.str=0;
48
 
  }
 
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
 
49
48
  /*
50
49
    This constructor is used only for the case when we create a derived
51
50
    table. A derived table has no name and doesn't belong to any database.
55
54
  explicit Table_ident(Select_Lex_Unit *s) : sel(s)
56
55
  {
57
56
    /* We must have a table name here as this is used with add_table_to_list */
58
 
    db.str= empty_c_string;                    /* a subject to casedn_str */
 
57
    db.str= const_cast<char*>("");                    /* a subject to casedn_str */
59
58
    db.length= 0;
60
 
    table.str= internal_table_name;
61
 
    table.length=1;
 
59
    table.str= const_cast<char*>("*");
 
60
    table.length= 1;
62
61
  }
63
62
  bool is_derived_table() const { return test(sel); }
64
 
  inline void change_db(char *db_name)
65
 
  {
66
 
    db.str= db_name; db.length= (uint32_t) strlen(db_name);
67
 
  }
68
63
};
69
64
 
70
65
} /* namespace drizzled */