~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/blob.cc

  • Committer: Stewart Smith
  • Author(s): Vasil Dimov, Stewart Smith
  • Date: 2010-12-20 02:24:00 UTC
  • mto: (2021.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 2022.
  • Revision ID: stewart@flamingspork.com-20101220022400-0p9lvvppwgaowdju
Merge Revision revid:vasil.dimov@oracle.com-20101102165720-164z3666y3tut4c2 from MySQL InnoDB

Original revid:vasil.dimov@oracle.com-20101102165720-164z3666y3tut4c2

Original Authors: Vasil Dimov <vasil.dimov@oracle.com>
Original commit message:
Fix Bug#53046 dict_update_statistics_low can still be run concurrently on same table

Replace the array of mutexes that used to protect
dict_index_t::stat_n_diff_key_vals[] with an array of rw locks that protects
all the stats related members in dict_table_t and all of its indexes.

Approved by:    Jimmy (rb://503)

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 */
20
20
 
21
21
 
22
 
#include <config.h>
 
22
#include "config.h"
23
23
#include <drizzled/field/blob.h>
24
24
#include <drizzled/table.h>
25
25
#include <drizzled/session.h>
26
 
#include <plugin/myisam/myisam.h>
 
26
#include "plugin/myisam/myisam.h"
27
27
 
28
28
#include <string>
29
29
#include <algorithm>
90
90
 
91
91
 
92
92
uint32_t Field_blob::get_length(const unsigned char *pos,
93
 
                                bool low_byte_first) const
 
93
                                bool low_byte_first)
94
94
{
95
95
#ifndef WORDS_BIGENDIAN
96
96
  (void)low_byte_first;
113
113
}
114
114
 
115
115
 
116
 
uint32_t Field_blob::get_length(uint32_t row_offset) const
 
116
uint32_t Field_blob::get_length(uint32_t row_offset)
117
117
{
118
118
  return get_length(ptr+row_offset,
119
119
                    getTable()->getShare()->db_low_byte_first);
120
120
}
121
121
 
122
122
 
123
 
uint32_t Field_blob::get_length(const unsigned char *ptr_arg) const
 
123
uint32_t Field_blob::get_length(const unsigned char *ptr_arg)
124
124
{
125
125
  return get_length(ptr_arg, getTable()->getShare()->db_low_byte_first);
126
126
}
224
224
}
225
225
 
226
226
 
227
 
double Field_blob::val_real(void) const
 
227
double Field_blob::val_real(void)
228
228
{
229
229
  int not_used;
230
230
  char *end_not_used, *blob;
242
242
}
243
243
 
244
244
 
245
 
int64_t Field_blob::val_int(void) const
 
245
int64_t Field_blob::val_int(void)
246
246
{
247
247
  int not_used;
248
248
  char *blob;
252
252
  memcpy(&blob,ptr+sizeof(uint32_t),sizeof(char*));
253
253
  if (!blob)
254
254
    return 0;
255
 
  uint32_t length= get_length(ptr);
 
255
  uint32_t length=get_length(ptr);
256
256
  return my_strntoll(charset(),blob,length,10,NULL,&not_used);
257
257
}
258
258
 
259
 
String *Field_blob::val_str(String *, String *val_ptr) const
 
259
String *Field_blob::val_str(String *,
 
260
                            String *val_ptr)
260
261
{
261
262
  char *blob;
262
263
 
271
272
}
272
273
 
273
274
 
274
 
type::Decimal *Field_blob::val_decimal(type::Decimal *decimal_value) const
 
275
my_decimal *Field_blob::val_decimal(my_decimal *decimal_value)
275
276
{
276
277
  const char *blob;
277
278
  size_t length;
285
286
    length= 0;
286
287
  }
287
288
  else
288
 
  {
289
289
    length= get_length(ptr);
290
 
  }
291
 
 
292
 
  decimal_value->store(E_DEC_FATAL_ERROR, blob, length, charset());
293
 
 
 
290
 
 
291
  str2my_decimal(E_DEC_FATAL_ERROR, blob, length, charset(),
 
292
                 decimal_value);
294
293
  return decimal_value;
295
294
}
296
295
 
425
424
 
426
425
uint32_t Field_blob::sort_length() const
427
426
{
428
 
  return (uint32_t) (getTable()->getSession()->variables.max_sort_length +
 
427
  return (uint32_t) (current_session->variables.max_sort_length +
429
428
                     (field_charset == &my_charset_bin ? 0 : sizeof(uint32_t)));
430
429
}
431
430
 
521
520
                                        bool low_byte_first)
522
521
{
523
522
  uint32_t const length= get_length(from, low_byte_first);
524
 
  getTable()->setWriteSet(position());
 
523
  getTable()->setWriteSet(field_index);
525
524
  store(reinterpret_cast<const char*>(from) + sizeof(uint32_t),
526
525
        length, field_charset);
527
526
  return(from + sizeof(uint32_t) + length);