327.2.4
by Brian Aker
Refactoring table.h |
1 |
#include <drizzled/server_includes.h> |
2 |
#include <drizzled/natural_join_column.h> |
|
584.1.15
by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes. |
3 |
#include <drizzled/table_list.h> |
4 |
#include <drizzled/session.h> |
|
327.2.4
by Brian Aker
Refactoring table.h |
5 |
|
575.1.2
by Monty Taylor
Changed a bunch of __attribute__((unused)) to removing the parameter name instead. |
6 |
Natural_join_column::Natural_join_column(Field_translator *, TableList *tab) |
327.2.4
by Brian Aker
Refactoring table.h |
7 |
{
|
8 |
assert(tab->field_translation); |
|
9 |
table_field= NULL; |
|
10 |
table_ref= tab; |
|
11 |
is_common= false; |
|
12 |
}
|
|
13 |
||
14 |
||
15 |
Natural_join_column::Natural_join_column(Field *field_param, |
|
16 |
TableList *tab) |
|
17 |
{
|
|
18 |
assert(tab->table == field_param->table); |
|
19 |
table_field= field_param; |
|
20 |
table_ref= tab; |
|
21 |
is_common= false; |
|
22 |
}
|
|
23 |
||
24 |
||
25 |
const char *Natural_join_column::name() |
|
26 |
{
|
|
27 |
return table_field->field_name; |
|
28 |
}
|
|
29 |
||
30 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
31 |
Item *Natural_join_column::create_item(Session *session) |
327.2.4
by Brian Aker
Refactoring table.h |
32 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
33 |
return new Item_field(session, &session->lex->current_select->context, table_field); |
327.2.4
by Brian Aker
Refactoring table.h |
34 |
}
|
35 |
||
36 |
||
37 |
Field *Natural_join_column::field() |
|
38 |
{
|
|
39 |
return table_field; |
|
40 |
}
|
|
41 |
||
42 |
||
43 |
const char *Natural_join_column::table_name() |
|
44 |
{
|
|
45 |
assert(table_ref); |
|
46 |
return table_ref->alias; |
|
47 |
}
|
|
48 |
||
49 |
||
50 |
const char *Natural_join_column::db_name() |
|
51 |
{
|
|
52 |
/*
|
|
53 |
Test that TableList::db is the same as st_table_share::db to
|
|
54 |
ensure consistency. An exception are I_S schema tables, which
|
|
55 |
are inconsistent in this respect.
|
|
56 |
*/
|
|
57 |
assert(!strcmp(table_ref->db, |
|
58 |
table_ref->table->s->db.str) || |
|
59 |
(table_ref->schema_table && |
|
60 |
table_ref->table->s->db.str[0] == 0)); |
|
61 |
return table_ref->db; |
|
62 |
}
|