~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table_ident.h

  • Committer: Olaf van der Spek
  • Date: 2011-08-05 09:43:18 UTC
  • mto: This revision was merged to the branch mainline in revision 2395.
  • Revision ID: olafvdspek@gmail.com-20110805094318-5z2r61cu4mdy0fuw
Refactor Table_ident 

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
30
class Table_ident : public memory::SqlAlloc
34
31
{
36
33
  lex_string_t db;
37
34
  lex_string_t table;
38
35
  Select_Lex_Unit *sel;
 
36
 
39
37
  inline Table_ident(lex_string_t db_arg, lex_string_t table_arg)
40
 
    : table(table_arg), sel(NULL)
 
38
    : db(db_arg), table(table_arg), sel(NULL)
41
39
  {
42
 
    db= db_arg;
43
40
  }
 
41
 
44
42
  explicit Table_ident(lex_string_t table_arg)
45
43
    : table(table_arg), sel(NULL)
46
44
  {
47
 
    db.str=0;
 
45
    db.str= 0;
48
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
63
};