~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table_ident.h

  • Committer: Mark Atwood
  • Date: 2011-08-11 03:05:03 UTC
  • mfrom: (2385.1.12 refactor4)
  • Revision ID: me@mark.atwood.name-20110811030503-rp9xjihc5x3y0x4q
mergeĀ lp:~olafvdspek/drizzle/refactor4

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
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((Select_Lex_Unit *)0)
 
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
 
    :table(table_arg), sel((Select_Lex_Unit *)0)
 
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
 
  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 */