~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/long.cc

  • Committer: Brian Aker
  • Date: 2008-08-12 03:12:57 UTC
  • Revision ID: brian@tangent.org-20080812031257-ln3uk87y1r22byeg
First pass of new sql_db.cc work

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* - mode: c++ c-basic-offset: 2; indent-tabs-mode: nil; -*-
 
1
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
4
 *  Copyright (C) 2008 MySQL
29
29
** long int
30
30
****************************************************************************/
31
31
 
32
 
int Field_long::store(const char *from,uint32_t len, const CHARSET_INFO * const cs)
 
32
int Field_long::store(const char *from,uint len, const CHARSET_INFO * const cs)
33
33
{
34
34
  long store_tmp;
35
35
  int error;
112
112
      res=0;
113
113
      error= 1;
114
114
    }
115
 
    else if (nr > INT32_MAX)
 
115
    else if ((uint64_t) nr >= (1LL << 32))
116
116
    {
117
 
      res= INT32_MAX;
 
117
      res=(int32_t) (uint32_t) ~0L;
118
118
      error= 1;
119
119
    }
120
120
    else
182
182
                            String *val_ptr __attribute__((unused)))
183
183
{
184
184
  const CHARSET_INFO * const cs= &my_charset_bin;
185
 
  uint32_t length;
186
 
  uint32_t mlength=cmax(field_length+1,12*cs->mbmaxlen);
 
185
  uint length;
 
186
  uint mlength=max(field_length+1,12*cs->mbmaxlen);
187
187
  val_buffer->alloc(mlength);
188
188
  char *to=(char*) val_buffer->ptr();
189
189
  int32_t j;
209
209
  return protocol->store_long(Field_long::val_int());
210
210
}
211
211
 
212
 
int Field_long::cmp(const unsigned char *a_ptr, const unsigned char *b_ptr)
 
212
int Field_long::cmp(const uchar *a_ptr, const uchar *b_ptr)
213
213
{
214
214
  int32_t a,b;
215
215
#ifdef WORDS_BIGENDIAN
229
229
  return (a < b) ? -1 : (a > b) ? 1 : 0;
230
230
}
231
231
 
232
 
void Field_long::sort_string(unsigned char *to,uint32_t length __attribute__((unused)))
 
232
void Field_long::sort_string(uchar *to,uint length __attribute__((unused)))
233
233
{
234
234
#ifdef WORDS_BIGENDIAN
235
235
  if (!table->s->db_low_byte_first)