~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/double.cc

Added the testsuite location finding code to support in-plugin-dir test suites.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 */
20
20
 
21
21
 
22
 
#include "config.h"
23
 
 
24
 
#include <float.h>
25
 
#include <math.h>
26
 
 
27
 
#include <algorithm>
28
 
 
 
22
#include <drizzled/server_includes.h>
29
23
#include <drizzled/field/double.h>
30
24
#include <drizzled/error.h>
31
25
#include <drizzled/table.h>
32
26
#include <drizzled/session.h>
33
 
#include "drizzled/internal/m_string.h"
 
27
 
 
28
#include <algorithm>
34
29
 
35
30
using namespace std;
36
31
 
37
 
namespace drizzled
38
 
{
39
32
 
40
33
/****************************************************************************
41
34
  double precision floating point numbers
48
41
  double nr= my_strntod(cs,(char*) from, len, &end, &error);
49
42
 
50
43
  ASSERT_COLUMN_MARKED_FOR_WRITE;
51
 
  if (error || (!len || (((uint32_t) (end-from) != len) && getTable()->in_use->count_cuted_fields)))
 
44
  if (error || (!len || (((uint32_t) (end-from) != len) && table->in_use->count_cuted_fields)))
52
45
  {
53
46
    set_warning(DRIZZLE_ERROR::WARN_LEVEL_WARN,
54
47
                (error ? ER_WARN_DATA_OUT_OF_RANGE : ER_WARN_DATA_TRUNCATED), 1);
66
59
  ASSERT_COLUMN_MARKED_FOR_WRITE;
67
60
 
68
61
#ifdef WORDS_BIGENDIAN
69
 
  if (getTable()->getShare()->db_low_byte_first)
 
62
  if (table->s->db_low_byte_first)
70
63
  {
71
64
    float8store(ptr,nr);
72
65
  }
90
83
  ASSERT_COLUMN_MARKED_FOR_READ;
91
84
 
92
85
#ifdef WORDS_BIGENDIAN
93
 
  if (getTable()->getShare()->db_low_byte_first)
 
86
  if (table->s->db_low_byte_first)
94
87
  {
95
88
    float8get(j,ptr);
96
89
  }
108
101
  ASSERT_COLUMN_MARKED_FOR_READ;
109
102
 
110
103
#ifdef WORDS_BIGENDIAN
111
 
  if (getTable()->getShare()->db_low_byte_first)
 
104
  if (table->s->db_low_byte_first)
112
105
  {
113
106
    float8get(j,ptr);
114
107
  }
150
143
  ASSERT_COLUMN_MARKED_FOR_READ;
151
144
 
152
145
#ifdef WORDS_BIGENDIAN
153
 
  if (getTable()->getShare()->db_low_byte_first)
 
146
  if (table->s->db_low_byte_first)
154
147
  {
155
148
    float8get(nr,ptr);
156
149
  }
164
157
  size_t len;
165
158
 
166
159
  if (dec >= NOT_FIXED_DEC)
167
 
    len= internal::my_gcvt(nr, internal::MY_GCVT_ARG_DOUBLE, to_length - 1, to, NULL);
 
160
    len= my_gcvt(nr, MY_GCVT_ARG_DOUBLE, to_length - 1, to, NULL);
168
161
  else
169
 
    len= internal::my_fcvt(nr, dec, to, NULL);
 
162
    len= my_fcvt(nr, dec, to, NULL);
170
163
 
171
164
  val_buffer->length((uint32_t) len);
172
165
 
177
170
{
178
171
  double a,b;
179
172
#ifdef WORDS_BIGENDIAN
180
 
  if (getTable()->getShare()->db_low_byte_first)
 
173
  if (table->s->db_low_byte_first)
181
174
  {
182
175
    float8get(a,a_ptr);
183
176
    float8get(b,b_ptr);
198
191
{
199
192
  double nr;
200
193
#ifdef WORDS_BIGENDIAN
201
 
  if (getTable()->getShare()->db_low_byte_first)
 
194
  if (table->s->db_low_byte_first)
202
195
  {
203
196
    float8get(nr,ptr);
204
197
  }
209
202
}
210
203
 
211
204
 
 
205
/**
 
206
   Save the field metadata for double fields.
 
207
 
 
208
   Saves the pack length in the first byte of the field metadata array
 
209
   at index of *metadata_ptr.
 
210
 
 
211
   @param   metadata_ptr   First byte of field metadata
 
212
 
 
213
   @returns number of bytes written to metadata_ptr
 
214
*/
 
215
int Field_double::do_save_field_metadata(unsigned char *metadata_ptr)
 
216
{
 
217
  *metadata_ptr= pack_length();
 
218
  return 1;
 
219
}
 
220
 
 
221
 
212
222
void Field_double::sql_type(String &res) const
213
223
{
214
224
  const CHARSET_INFO * const cs=res.charset();
223
233
  }
224
234
}
225
235
 
226
 
} /* namespace drizzled */