~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to sql/rpl_tblmap.cc

  • Committer: Brian Aker
  • Date: 2008-07-07 14:25:25 UTC
  • mto: (77.1.25 codestyle)
  • mto: This revision was merged to the branch mainline in revision 82.
  • Revision ID: brian@tangent.org-20080707142525-xzy2nl3ie2ebwfln
LL() cleanup

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
   along with this program; if not, write to the Free Software
14
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
 
#include <drizzled/server_includes.h>
 
16
#include "mysql_priv.h"
 
17
 
 
18
#ifdef HAVE_REPLICATION
17
19
 
18
20
#include "rpl_tblmap.h"
19
21
 
44
46
  free_root(&m_mem_root, MYF(0));
45
47
}
46
48
 
47
 
Table* table_mapping::get_table(ulong table_id)
 
49
st_table* table_mapping::get_table(ulong table_id)
48
50
{
 
51
  DBUG_ENTER("table_mapping::get_table(ulong)");
 
52
  DBUG_PRINT("enter", ("table_id: %lu", table_id));
49
53
  entry *e= find_entry(table_id);
50
54
  if (e) 
51
55
  {
52
 
    return(e->table);
 
56
    DBUG_PRINT("info", ("tid %lu -> table 0x%lx (%s)", 
 
57
                        table_id, (long) e->table,
 
58
                        MAYBE_TABLE_NAME(e->table)));
 
59
    DBUG_RETURN(e->table);
53
60
  }
54
61
 
55
 
  return(NULL);
 
62
  DBUG_PRINT("info", ("tid %lu is not mapped!", table_id));
 
63
  DBUG_RETURN(NULL);
56
64
}
57
65
 
58
66
/*
81
89
  return 0;
82
90
}
83
91
 
84
 
int table_mapping::set_table(ulong table_id, Table* table)
 
92
int table_mapping::set_table(ulong table_id, TABLE* table)
85
93
{
 
94
  DBUG_ENTER("table_mapping::set_table(ulong,TABLE*)");
 
95
  DBUG_PRINT("enter", ("table_id: %lu  table: 0x%lx (%s)", 
 
96
                       table_id, 
 
97
                       (long) table, MAYBE_TABLE_NAME(table)));
86
98
  entry *e= find_entry(table_id);
87
99
  if (e == 0)
88
100
  {
89
101
    if (m_free == 0 && expand())
90
 
      return(ERR_MEMORY_ALLOCATION); // Memory allocation failed      
 
102
      DBUG_RETURN(ERR_MEMORY_ALLOCATION); // Memory allocation failed      
91
103
    e= m_free;
92
104
    m_free= m_free->next;
93
105
  }
94
106
  else
95
 
    hash_delete(&m_table_ids,(unsigned char *)e);
 
107
    hash_delete(&m_table_ids,(uchar *)e);
96
108
 
97
109
  e->table_id= table_id;
98
110
  e->table= table;
99
 
  my_hash_insert(&m_table_ids,(unsigned char *)e);
 
111
  my_hash_insert(&m_table_ids,(uchar *)e);
100
112
 
101
 
  return(0);            // All OK
 
113
  DBUG_PRINT("info", ("tid %lu -> table 0x%lx (%s)", 
 
114
                      table_id, (long) e->table,
 
115
                      MAYBE_TABLE_NAME(e->table)));
 
116
  DBUG_RETURN(0);               // All OK
102
117
}
103
118
 
104
119
int table_mapping::remove_table(ulong table_id)
106
121
  entry *e= find_entry(table_id);
107
122
  if (e)
108
123
  {
109
 
    hash_delete(&m_table_ids,(unsigned char *)e);
 
124
    hash_delete(&m_table_ids,(uchar *)e);
110
125
    /* we add this entry to the chain of free (free for use) entries */
111
126
    e->next= m_free;
112
127
    m_free= e;
121
136
*/
122
137
void table_mapping::clear_tables()
123
138
{
124
 
  for (uint32_t i= 0; i < m_table_ids.records; i++)
 
139
  DBUG_ENTER("table_mapping::clear_tables()");
 
140
  for (uint i= 0; i < m_table_ids.records; i++)
125
141
  {
126
142
    entry *e= (entry *)hash_element(&m_table_ids, i);
127
143
    e->next= m_free;
128
144
    m_free= e;
129
145
  }
130
146
  my_hash_reset(&m_table_ids);
131
 
  return;
 
147
  DBUG_VOID_RETURN;
132
148
}
 
149
 
 
150
#endif