327.2.4
by Brian Aker
Refactoring table.h |
1 |
#include <drizzled/server_includes.h> |
2 |
#include <drizzled/natural_join_column.h> |
|
3 |
||
327.2.6
by Brian Aker
Removed old base view code. |
4 |
Natural_join_column::Natural_join_column(Field_translator *field_param __attribute__((unused)), TableList *tab) |
327.2.4
by Brian Aker
Refactoring table.h |
5 |
{
|
6 |
assert(tab->field_translation); |
|
7 |
table_field= NULL; |
|
8 |
table_ref= tab; |
|
9 |
is_common= false; |
|
10 |
}
|
|
11 |
||
12 |
||
13 |
Natural_join_column::Natural_join_column(Field *field_param, |
|
14 |
TableList *tab) |
|
15 |
{
|
|
16 |
assert(tab->table == field_param->table); |
|
17 |
table_field= field_param; |
|
18 |
table_ref= tab; |
|
19 |
is_common= false; |
|
20 |
}
|
|
21 |
||
22 |
||
23 |
const char *Natural_join_column::name() |
|
24 |
{
|
|
25 |
return table_field->field_name; |
|
26 |
}
|
|
27 |
||
28 |
||
29 |
Item *Natural_join_column::create_item(THD *thd) |
|
30 |
{
|
|
31 |
return new Item_field(thd, &thd->lex->current_select->context, table_field); |
|
32 |
}
|
|
33 |
||
34 |
||
35 |
Field *Natural_join_column::field() |
|
36 |
{
|
|
37 |
return table_field; |
|
38 |
}
|
|
39 |
||
40 |
||
41 |
const char *Natural_join_column::table_name() |
|
42 |
{
|
|
43 |
assert(table_ref); |
|
44 |
return table_ref->alias; |
|
45 |
}
|
|
46 |
||
47 |
||
48 |
const char *Natural_join_column::db_name() |
|
49 |
{
|
|
50 |
/*
|
|
51 |
Test that TableList::db is the same as st_table_share::db to
|
|
52 |
ensure consistency. An exception are I_S schema tables, which
|
|
53 |
are inconsistent in this respect.
|
|
54 |
*/
|
|
55 |
assert(!strcmp(table_ref->db, |
|
56 |
table_ref->table->s->db.str) || |
|
57 |
(table_ref->schema_table && |
|
58 |
table_ref->table->s->db.str[0] == 0)); |
|
59 |
return table_ref->db; |
|
60 |
}
|