~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/double.cc

  • Committer: Monty Taylor
  • Date: 2010-08-12 20:27:32 UTC
  • mto: (1720.1.5 build)
  • mto: This revision was merged to the branch mainline in revision 1722.
  • Revision ID: mordred@inaugust.com-20100812202732-9kzchbkvkyki4n3u
Merged libdrizzle directly into tree.

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
 
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 (getTable()->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 (getTable()->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 (getTable()->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 (getTable()->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 (getTable()->s->db_low_byte_first)
203
202
  {
204
203
    float8get(nr,ptr);
205
204
  }