~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/double.cc

  • Committer: Joe Daly
  • Date: 2010-04-29 03:08:04 UTC
  • mto: This revision was merged to the branch mainline in revision 1523.
  • Revision ID: skinny.moey@gmail.com-20100429030804-ppssp19xwyrgm5of
remove com_stat_vars and rework lock in scoreboard to not lock on Sessions locating a slot they previously owned

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
 
24
24
#include <float.h>
25
25
#include <math.h>
30
30
#include <drizzled/error.h>
31
31
#include <drizzled/table.h>
32
32
#include <drizzled/session.h>
33
 
#include <drizzled/current_session.h>
34
 
#include <drizzled/internal/m_string.h>
 
33
#include "drizzled/internal/m_string.h"
35
34
 
36
35
using namespace std;
37
36
 
49
48
  double nr= my_strntod(cs,(char*) from, len, &end, &error);
50
49
 
51
50
  ASSERT_COLUMN_MARKED_FOR_WRITE;
52
 
  if (error || (!len || (((uint32_t) (end-from) != len) && getTable()->in_use->count_cuted_fields)))
 
51
  if (error || (!len || (((uint32_t) (end-from) != len) && table->in_use->count_cuted_fields)))
53
52
  {
54
53
    set_warning(DRIZZLE_ERROR::WARN_LEVEL_WARN,
55
54
                (error ? ER_WARN_DATA_OUT_OF_RANGE : ER_WARN_DATA_TRUNCATED), 1);
67
66
  ASSERT_COLUMN_MARKED_FOR_WRITE;
68
67
 
69
68
#ifdef WORDS_BIGENDIAN
70
 
  if (getTable()->getShare()->db_low_byte_first)
 
69
  if (table->s->db_low_byte_first)
71
70
  {
72
71
    float8store(ptr,nr);
73
72
  }
84
83
                             (double) nr);
85
84
}
86
85
 
87
 
double Field_double::val_real(void) const
 
86
double Field_double::val_real(void)
88
87
{
89
88
  double j;
90
89
 
91
90
  ASSERT_COLUMN_MARKED_FOR_READ;
92
91
 
93
92
#ifdef WORDS_BIGENDIAN
94
 
  if (getTable()->getShare()->db_low_byte_first)
 
93
  if (table->s->db_low_byte_first)
95
94
  {
96
95
    float8get(j,ptr);
97
96
  }
101
100
  return j;
102
101
}
103
102
 
104
 
int64_t Field_double::val_int(void) const
 
103
int64_t Field_double::val_int(void)
105
104
{
106
105
  double j;
107
106
  int64_t res;
109
108
  ASSERT_COLUMN_MARKED_FOR_READ;
110
109
 
111
110
#ifdef WORDS_BIGENDIAN
112
 
  if (getTable()->getShare()->db_low_byte_first)
 
111
  if (table->s->db_low_byte_first)
113
112
  {
114
113
    float8get(j,ptr);
115
114
  }
134
133
    char buf[DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE];
135
134
    String tmp(buf, sizeof(buf), &my_charset_utf8_general_ci), *str;
136
135
    str= val_str(&tmp, &tmp);
137
 
    Session *session= getTable() ? getTable()->in_use : current_session;
138
 
    push_warning_printf(session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
 
136
    push_warning_printf(current_session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
139
137
                        ER_TRUNCATED_WRONG_VALUE,
140
138
                        ER(ER_TRUNCATED_WRONG_VALUE), "INTEGER",
141
139
                        str->c_ptr());
144
142
}
145
143
 
146
144
 
147
 
String *Field_double::val_str(String *val_buffer, String *) const
 
145
String *Field_double::val_str(String *val_buffer,
 
146
                              String *)
148
147
{
149
148
  double nr;
150
149
 
151
150
  ASSERT_COLUMN_MARKED_FOR_READ;
152
151
 
153
152
#ifdef WORDS_BIGENDIAN
154
 
  if (getTable()->getShare()->db_low_byte_first)
 
153
  if (table->s->db_low_byte_first)
155
154
  {
156
155
    float8get(nr,ptr);
157
156
  }
178
177
{
179
178
  double a,b;
180
179
#ifdef WORDS_BIGENDIAN
181
 
  if (getTable()->getShare()->db_low_byte_first)
 
180
  if (table->s->db_low_byte_first)
182
181
  {
183
182
    float8get(a,a_ptr);
184
183
    float8get(b,b_ptr);
199
198
{
200
199
  double nr;
201
200
#ifdef WORDS_BIGENDIAN
202
 
  if (getTable()->getShare()->db_low_byte_first)
 
201
  if (table->s->db_low_byte_first)
203
202
  {
204
203
    float8get(nr,ptr);
205
204
  }