~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field.cc

  • Committer: Eric Day
  • Date: 2010-01-07 20:02:38 UTC
  • mfrom: (1259.4.2 staging)
  • mto: This revision was merged to the branch mainline in revision 1271.
  • Revision ID: eday@oddments.org-20100107200238-uqw8v6kv9pl7nny5
Merged trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 * @file This file implements the Field class and API
23
23
 */
24
24
 
25
 
#include "drizzled/server_includes.h"
 
25
#include "config.h"
26
26
#include <errno.h>
 
27
#include <float.h>
27
28
#include "drizzled/sql_select.h"
28
29
#include "drizzled/error.h"
29
30
#include "drizzled/field/str.h"
42
43
#include "drizzled/field/datetime.h"
43
44
#include "drizzled/field/varstring.h"
44
45
#include "drizzled/time_functions.h"
 
46
#include "drizzled/internal/m_string.h"
 
47
 
 
48
using namespace drizzled;
45
49
 
46
50
/*****************************************************************************
47
51
  Instansiate templates and static variables
48
52
*****************************************************************************/
49
53
 
50
 
#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
51
 
template class List<CreateField>;
52
 
template class List_iterator<CreateField>;
53
 
#endif
54
 
 
55
54
static enum_field_types
56
55
field_types_merge_rules [DRIZZLE_TYPE_MAX+1][DRIZZLE_TYPE_MAX+1]=
57
56
{
366
365
  return (str < strend);
367
366
}
368
367
 
 
368
void *Field::operator new(size_t size)
 
369
{
 
370
  return memory::sql_alloc(size);
 
371
}
 
372
 
 
373
void *Field::operator new(size_t size, memory::Root *mem_root)
 
374
{
 
375
  return alloc_root(mem_root, static_cast<uint32_t>(size));
 
376
}
 
377
 
369
378
enum_field_types Field::field_type_merge(enum_field_types a,
370
379
                                         enum_field_types b)
371
380
{
831
840
  return test(table->index_flags(idx) & HA_READ_RANGE);
832
841
}
833
842
 
834
 
Field *Field::new_field(MEM_ROOT *root, Table *new_table, bool)
 
843
Field *Field::new_field(memory::Root *root, Table *new_table, bool)
835
844
{
836
845
  Field *tmp;
837
846
  if (!(tmp= (Field*) memdup_root(root,(char*) this,size_of())))
849
858
  return tmp;
850
859
}
851
860
 
852
 
Field *Field::new_key_field(MEM_ROOT *root, Table *new_table,
 
861
Field *Field::new_key_field(memory::Root *root, Table *new_table,
853
862
                            unsigned char *new_ptr,
854
863
                            unsigned char *new_null_ptr,
855
864
                            uint32_t new_null_bit)
864
873
  return tmp;
865
874
}
866
875
 
867
 
Field *Field::clone(MEM_ROOT *root, Table *new_table)
 
876
Field *Field::clone(memory::Root *root, Table *new_table)
868
877
{
869
878
  Field *tmp;
870
879
  if ((tmp= (Field*) memdup_root(root,(char*) this,size_of())))
944
953
}
945
954
 
946
955
Field *make_field(TableShare *share,
947
 
                  MEM_ROOT *root,
 
956
                  memory::Root *root,
948
957
                  unsigned char *ptr,
949
958
                  uint32_t field_length,
950
959
                  bool is_nullable,