~ubuntu-branches/ubuntu/saucy/drizzle/saucy-proposed

« back to all changes in this revision

Viewing changes to drizzled/field/int64.cc

  • Committer: Package Import Robot
  • Author(s): Clint Byrum
  • Date: 2012-06-19 10:46:49 UTC
  • mfrom: (1.1.6)
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20120619104649-e2l0ggd4oz3um0f4
Tags: upstream-7.1.36-stable
ImportĀ upstreamĀ versionĀ 7.1.36-stable

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
 
33
33
using namespace std;
34
34
 
35
 
namespace drizzled
36
 
{
37
 
 
38
 
namespace field
39
 
{
 
35
namespace drizzled {
 
36
namespace field {
40
37
 
41
38
/****************************************************************************
42
39
  Field type Int64 int (8 bytes)
43
40
 ****************************************************************************/
44
41
 
45
 
int Int64::store(const char *from,uint32_t len, const CHARSET_INFO * const cs)
 
42
int Int64::store(const char *from,uint32_t len, const charset_info_st * const cs)
46
43
{
47
44
  int error= 0;
48
45
  char *end;
49
 
  uint64_t tmp;
50
46
 
51
47
  ASSERT_COLUMN_MARKED_FOR_WRITE;
52
48
 
53
 
  tmp= cs->cset->strntoull10rnd(cs, from, len, false, &end,&error);
54
 
  if (error == MY_ERRNO_ERANGE)
 
49
  uint64_t tmp= cs->cset->strntoull10rnd(cs, from, len, false, &end,&error);
 
50
  if (error == ERANGE)
55
51
  {
56
52
    set_warning(DRIZZLE_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
57
53
    error= 1;
109
105
  int error= 0;
110
106
 
111
107
  ASSERT_COLUMN_MARKED_FOR_WRITE;
112
 
  if (arg and (nr < 0)) // Only a partial fix for overflow
 
108
  if (arg && nr < 0) // Only a partial fix for overflow
113
109
  {
114
110
    set_warning(DRIZZLE_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
115
111
    error= 1;
121
117
}
122
118
 
123
119
 
124
 
double Int64::val_real(void) const
 
120
double Int64::val_real() const
125
121
{
126
122
  int64_t j;
127
123
 
134
130
}
135
131
 
136
132
 
137
 
int64_t Int64::val_int(void) const
 
133
int64_t Int64::val_int() const
138
134
{
139
135
  int64_t j;
140
136
 
148
144
 
149
145
String *Int64::val_str(String *val_buffer, String *) const
150
146
{
151
 
  const CHARSET_INFO * const cs= &my_charset_bin;
 
147
  const charset_info_st * const cs= &my_charset_bin;
152
148
  uint32_t length;
153
149
  uint32_t mlength= max(field_length+1,22*cs->mbmaxlen);
154
150
  val_buffer->alloc(mlength);
202
198
#endif
203
199
}
204
200
 
205
 
 
206
 
void Int64::sql_type(String &res) const
207
 
{
208
 
  const CHARSET_INFO * const cs=res.charset();
209
 
  res.length(cs->cset->snprintf(cs,(char*) res.ptr(),res.alloced_length(), "bigint"));
210
 
}
211
 
 
212
 
 
213
201
unsigned char *Int64::pack(unsigned char* to, const unsigned char *from, uint32_t, bool)
214
202
{
215
203
  int64_t val;