~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/natural_join_column.cc

Moved sql_common.h and my_time.h to libdrizzle.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include <drizzled/server_includes.h>
2
 
#include <drizzled/natural_join_column.h>
3
 
 
4
 
Natural_join_column::Natural_join_column(Field_translator *, TableList *tab)
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(Session *session)
30
 
{
31
 
  return new Item_field(session, &session->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
 
}