~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/blob.cc

  • Committer: patrick crews
  • Date: 2011-02-23 17:17:25 UTC
  • mto: (2195.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 2196.
  • Revision ID: gleebix@gmail.com-20110223171725-4tgewemxhsw1m7q8
Integrated randgen with dbqp.  We now have mode=randgen and a set of randgen test suites (very basic now).  Output = same as dtr : )  We also have mode=cleanup to kill any servers we have started.  Docs updates too.  Gendata utility allows us to populate test servers 

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)
 
93
                                bool low_byte_first) const
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)
 
116
uint32_t Field_blob::get_length(uint32_t row_offset) const
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)
 
123
uint32_t Field_blob::get_length(const unsigned char *ptr_arg) const
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)
 
227
double Field_blob::val_real(void) const
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)
 
245
int64_t Field_blob::val_int(void) const
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 *,
260
 
                            String *val_ptr)
 
259
String *Field_blob::val_str(String *, String *val_ptr) const
261
260
{
262
261
  char *blob;
263
262
 
272
271
}
273
272
 
274
273
 
275
 
my_decimal *Field_blob::val_decimal(my_decimal *decimal_value)
 
274
type::Decimal *Field_blob::val_decimal(type::Decimal *decimal_value) const
276
275
{
277
276
  const char *blob;
278
277
  size_t length;
286
285
    length= 0;
287
286
  }
288
287
  else
 
288
  {
289
289
    length= get_length(ptr);
290
 
 
291
 
  str2my_decimal(E_DEC_FATAL_ERROR, blob, length, charset(),
292
 
                 decimal_value);
 
290
  }
 
291
 
 
292
  decimal_value->store(E_DEC_FATAL_ERROR, blob, length, charset());
 
293
 
293
294
  return decimal_value;
294
295
}
295
296
 
424
425
 
425
426
uint32_t Field_blob::sort_length() const
426
427
{
427
 
  return (uint32_t) (current_session->variables.max_sort_length +
 
428
  return (uint32_t) (getTable()->getSession()->variables.max_sort_length +
428
429
                     (field_charset == &my_charset_bin ? 0 : sizeof(uint32_t)));
429
430
}
430
431