~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/rpl_utility.h

  • Committer: Monty Taylor
  • Date: 2008-10-16 06:32:30 UTC
  • mto: (511.1.5 codestyle)
  • mto: This revision was merged to the branch mainline in revision 521.
  • Revision ID: monty@inaugust.com-20081016063230-4brxsra0qsmsg84q
Added -Wunused-macros.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2006 MySQL AB
2
 
 
3
 
   This program is free software; you can redistribute it and/or modify
4
 
   it under the terms of the GNU General Public License as published by
5
 
   the Free Software Foundation; version 2 of the License.
6
 
 
7
 
   This program is distributed in the hope that it will be useful,
8
 
   but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
 
   GNU General Public License for more details.
11
 
 
12
 
   You should have received a copy of the GNU General Public License
13
 
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
 
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
 
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
 
3
 *
 
4
 *  Copyright (C) 2008 Sun Microsystems
 
5
 *
 
6
 *  This program is free software; you can redistribute it and/or modify
 
7
 *  it under the terms of the GNU General Public License as published by
 
8
 *  the Free Software Foundation; version 2 of the License.
 
9
 *
 
10
 *  This program is distributed in the hope that it will be useful,
 
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 *  GNU General Public License for more details.
 
14
 *
 
15
 *  You should have received a copy of the GNU General Public License
 
16
 *  along with this program; if not, write to the Free Software
 
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
18
 */
15
19
 
16
20
#ifndef RPL_UTILITY_H
17
21
#define RPL_UTILITY_H
18
22
 
19
 
#ifndef __cplusplus
20
 
#error "Don't include this C++ header file from a non-C++ file!"
21
 
#endif
22
 
 
23
 
#include "mysql_priv.h"
 
23
#include <drizzled/server_includes.h>
24
24
 
25
25
class Relay_log_info;
26
26
 
70
70
                                       &m_null_bits, (size + 7) / 8,
71
71
                                       NULL);
72
72
 
73
 
    bzero(m_field_metadata, size * sizeof(uint16_t));
 
73
    memset(m_field_metadata, 0, size * sizeof(uint16_t));
74
74
 
75
75
    if (m_type)
76
76
      memcpy(m_type, types, size);
89
89
      for (unsigned int i= 0; i < m_size; i++)
90
90
      {
91
91
        switch (m_type[i]) {
92
 
        case MYSQL_TYPE_BLOB:
93
 
        case MYSQL_TYPE_DOUBLE:
 
92
        case DRIZZLE_TYPE_BLOB:
 
93
        case DRIZZLE_TYPE_DOUBLE:
94
94
        {
95
95
          /*
96
96
            These types store a single byte.
99
99
          index++;
100
100
          break;
101
101
        }
102
 
        case MYSQL_TYPE_SET:
103
 
        case MYSQL_TYPE_ENUM:
104
 
        case MYSQL_TYPE_STRING:
 
102
        case DRIZZLE_TYPE_ENUM:
105
103
        {
106
104
          uint16_t x= field_metadata[index++] << 8U; // real_type
107
105
          x+= field_metadata[index++];            // pack or field length
108
106
          m_field_metadata[i]= x;
109
107
          break;
110
108
        }
111
 
        case MYSQL_TYPE_VARCHAR:
 
109
        case DRIZZLE_TYPE_VARCHAR:
112
110
        {
113
111
          /*
114
112
            These types store two bytes.
118
116
          index= index + 2;
119
117
          break;
120
118
        }
121
 
        case MYSQL_TYPE_NEWDECIMAL:
 
119
        case DRIZZLE_TYPE_NEWDECIMAL:
122
120
        {
123
121
          uint16_t x= field_metadata[index++] << 8U; // precision
124
122
          x+= field_metadata[index++];            // decimals
136
134
  }
137
135
 
138
136
  ~table_def() {
139
 
    my_free(m_memory, MYF(0));
 
137
    free(m_memory);
140
138
    m_type= 0;
141
139
    m_size= 0;
142
140
  }
190
188
    This function returns whether the field on the master can be null.
191
189
    This value is derived from field->maybe_null().
192
190
  */
193
 
  my_bool maybe_null(uint32_t index) const
 
191
  bool maybe_null(uint32_t index) const
194
192
  {
195
193
    assert(index < m_size);
196
194
    return ((m_null_bits[(index / 8)] & 
204
202
    WL#3915) or needs to advance the pointer for the fields in the raw 
205
203
    data from the master to a specific column.
206
204
  */
207
 
  uint32 calc_field_size(uint32_t col, unsigned char *master_data) const;
 
205
  uint32_t calc_field_size(uint32_t col, unsigned char *master_data) const;
208
206
 
209
207
  /**
210
208
    Decide if the table definition is compatible with a table.
223
221
    @retval 1  if the table definition is not compatible with @c table
224
222
    @retval 0  if the table definition is compatible with @c table
225
223
  */
226
 
  int compatible_with(Relay_log_info const *rli, TABLE *table) const;
 
224
  int compatible_with(Relay_log_info const *rli, Table *table) const;
227
225
 
228
226
private:
229
227
  uint32_t m_size;           // Number of elements in the types array
238
236
   Extend the normal table list with a few new fields needed by the
239
237
   slave thread, but nowhere else.
240
238
 */
241
 
struct RPL_TABLE_LIST
242
 
  : public TABLE_LIST
 
239
struct RPL_TableList
 
240
  : public TableList
243
241
{
244
242
  bool m_tabledef_valid;
245
243
  table_def m_tabledef;