~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to server/rpl_utility.h

  • Committer: Brian Aker
  • Date: 2008-07-11 00:10:24 UTC
  • Revision ID: brian@tangent.org-20080711001024-5lrgorqxoc80i0nl
ulong cleanup

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
    @param metadata_size Size of the field_metadata array
59
59
    @param null_bitmap The bitmap of fields that can be null
60
60
   */
61
 
  table_def(field_type *types, ulong size, uchar *field_metadata, 
62
 
      int metadata_size, uchar *null_bitmap)
 
61
  table_def(field_type *types, uint32_t size, unsigned char *field_metadata, 
 
62
      int metadata_size, unsigned char *null_bitmap)
63
63
    : m_size(size), m_type(0), m_field_metadata_size(metadata_size),
64
64
      m_field_metadata(0), m_null_bits(0), m_memory(NULL)
65
65
  {
66
 
    m_memory= (uchar *)my_multi_malloc(MYF(MY_WME),
 
66
    m_memory= (unsigned char *)my_multi_malloc(MYF(MY_WME),
67
67
                                       &m_type, size,
68
68
                                       &m_field_metadata,
69
 
                                       size * sizeof(uint16),
 
69
                                       size * sizeof(uint16_t),
70
70
                                       &m_null_bits, (size + 7) / 8,
71
71
                                       NULL);
72
72
 
73
 
    bzero(m_field_metadata, size * sizeof(uint16));
 
73
    bzero(m_field_metadata, size * sizeof(uint16_t));
74
74
 
75
75
    if (m_type)
76
76
      memcpy(m_type, types, size);
104
104
        case MYSQL_TYPE_ENUM:
105
105
        case MYSQL_TYPE_STRING:
106
106
        {
107
 
          uint16 x= field_metadata[index++] << 8U; // real_type
 
107
          uint16_t x= field_metadata[index++] << 8U; // real_type
108
108
          x+= field_metadata[index++];            // pack or field length
109
109
          m_field_metadata[i]= x;
110
110
          break;
121
121
        }
122
122
        case MYSQL_TYPE_NEWDECIMAL:
123
123
        {
124
 
          uint16 x= field_metadata[index++] << 8U; // precision
 
124
          uint16_t x= field_metadata[index++] << 8U; // precision
125
125
          x+= field_metadata[index++];            // decimals
126
126
          m_field_metadata[i]= x;
127
127
          break;
147
147
 
148
148
    @return The number of fields that there is type data for.
149
149
   */
150
 
  ulong size() const { return m_size; }
 
150
  uint32_t size() const { return m_size; }
151
151
 
152
152
 
153
153
  /*
159
159
    <code>index</code>. Currently, only the type identifier is
160
160
    returned.
161
161
   */
162
 
  field_type type(ulong index) const
 
162
  field_type type(uint32_t index) const
163
163
  {
164
164
    assert(index < m_size);
165
165
    return m_type[index];
178
178
    corresponding fields to properly extract the data from the binary log 
179
179
    in the event that the master's field is smaller than the slave.
180
180
  */
181
 
  uint16 field_metadata(uint index) const
 
181
  uint16_t field_metadata(uint32_t index) const
182
182
  {
183
183
    assert(index < m_size);
184
184
    if (m_field_metadata_size)
191
191
    This function returns whether the field on the master can be null.
192
192
    This value is derived from field->maybe_null().
193
193
  */
194
 
  my_bool maybe_null(uint index) const
 
194
  my_bool maybe_null(uint32_t index) const
195
195
  {
196
196
    assert(index < m_size);
197
197
    return ((m_null_bits[(index / 8)] & 
205
205
    WL#3915) or needs to advance the pointer for the fields in the raw 
206
206
    data from the master to a specific column.
207
207
  */
208
 
  uint32 calc_field_size(uint col, uchar *master_data) const;
 
208
  uint32 calc_field_size(uint32_t col, unsigned char *master_data) const;
209
209
 
210
210
  /**
211
211
    Decide if the table definition is compatible with a table.
227
227
  int compatible_with(Relay_log_info const *rli, TABLE *table) const;
228
228
 
229
229
private:
230
 
  ulong m_size;           // Number of elements in the types array
 
230
  uint32_t m_size;           // Number of elements in the types array
231
231
  field_type *m_type;                     // Array of type descriptors
232
 
  uint m_field_metadata_size;
233
 
  uint16 *m_field_metadata;
234
 
  uchar *m_null_bits;
235
 
  uchar *m_memory;
 
232
  uint32_t m_field_metadata_size;
 
233
  uint16_t *m_field_metadata;
 
234
  unsigned char *m_null_bits;
 
235
  unsigned char *m_memory;
236
236
};
237
237
 
238
238
/**