~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/enum.cc

  • Committer: Brian Aker
  • Date: 2010-12-17 00:08:06 UTC
  • mfrom: (2002.1.4 clean)
  • Revision ID: brian@tangent.org-20101217000806-fa6kmggjnhsl4q85
Rollup for field encapsulation, monty fix for bzrignore, and Andrew bug
fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
21
 
#include <config.h>
 
21
#include "config.h"
22
22
#include <boost/lexical_cast.hpp>
23
 
#include <drizzled/field/enum.h>
24
 
#include <drizzled/error.h>
25
 
#include <drizzled/table.h>
26
 
#include <drizzled/session.h>
27
 
#include <drizzled/strfunc.h>
28
 
#include <drizzled/typelib.h>
 
23
#include "drizzled/field/enum.h"
 
24
#include "drizzled/error.h"
 
25
#include "drizzled/table.h"
 
26
#include "drizzled/session.h"
 
27
#include "drizzled/strfunc.h"
29
28
 
30
29
#include <sstream>
31
30
#include <string>
66
65
 
67
66
  /* Remove end space */
68
67
  length= field_charset->cset->lengthsp(field_charset, from, length);
69
 
  tmp= typelib->find_type2(from, length, field_charset);
 
68
  tmp= find_type2(typelib, from, length, field_charset);
70
69
  if (! tmp)
71
70
  {
72
71
    if (length < 6) /* Can't be more than 99999 enums */
121
120
  return 0;
122
121
}
123
122
 
124
 
double Field_enum::val_real(void) const
 
123
double Field_enum::val_real(void)
125
124
{
126
125
  return (double) Field_enum::val_int();
127
126
}
128
127
 
129
 
int64_t Field_enum::val_int(void) const
 
128
int64_t Field_enum::val_int(void)
130
129
{
131
130
  ASSERT_COLUMN_MARKED_FOR_READ;
132
131
 
140
139
  return ((int64_t) tmp) + 1; /* SQL is from 1, we store from 0 */
141
140
}
142
141
 
143
 
String *Field_enum::val_str(String *, String *val_ptr) const
 
142
String *Field_enum::val_str(String *, String *val_ptr)
144
143
{
145
144
  uint32_t tmp=(uint32_t) Field_enum::val_int();
146
145
 
209
208
  Field_enum *res= (Field_enum*) Field::new_field(root, new_table, keep_type);
210
209
  if (res)
211
210
  {
212
 
    res->typelib= typelib->copy_typelib(root);
 
211
    res->typelib= copy_typelib(root, typelib);
213
212
  }
214
213
  return res;
215
214
}