00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #pragma once
00022
00023 #include <drizzled/lex_string.h>
00024 #include <drizzled/memory/sql_alloc.h>
00025 #include <drizzled/util/test.h>
00026
00027 namespace drizzled
00028 {
00029
00030 extern char empty_c_string[1];
00031 extern char internal_table_name[2];
00032
00033
00034 class Table_ident :public memory::SqlAlloc
00035 {
00036 public:
00037 LEX_STRING db;
00038 LEX_STRING table;
00039 Select_Lex_Unit *sel;
00040 inline Table_ident(LEX_STRING db_arg, LEX_STRING table_arg)
00041 :table(table_arg), sel((Select_Lex_Unit *)0)
00042 {
00043 db= db_arg;
00044 }
00045 explicit Table_ident(LEX_STRING table_arg)
00046 :table(table_arg), sel((Select_Lex_Unit *)0)
00047 {
00048 db.str=0;
00049 }
00050
00051
00052
00053
00054
00055
00056 explicit Table_ident(Select_Lex_Unit *s) : sel(s)
00057 {
00058
00059 db.str= empty_c_string;
00060 db.length= 0;
00061 table.str= internal_table_name;
00062 table.length=1;
00063 }
00064 bool is_derived_table() const { return test(sel); }
00065 inline void change_db(char *db_name)
00066 {
00067 db.str= db_name; db.length= (uint32_t) strlen(db_name);
00068 }
00069 };
00070
00071 }
00072