~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/natural_join_column.cc

  • Committer: Monty Taylor
  • Date: 2008-08-04 19:37:18 UTC
  • mto: (261.2.2 codestyle)
  • mto: This revision was merged to the branch mainline in revision 262.
  • Revision ID: monty@inaugust.com-20080804193718-f0rz13uli4429ozb
Changed gettext_noop() to N_()

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
 
#include <drizzled/table_list.h>
4
 
#include <drizzled/session.h>
5
 
 
6
 
Natural_join_column::Natural_join_column(Field_translator *, TableList *tab)
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
 
 
31
 
Item *Natural_join_column::create_item(Session *session)
32
 
{
33
 
  return new Item_field(session, &session->lex->current_select->context, table_field);
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
 
}