~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/date.cc

  • Committer: Brian Aker
  • Date: 2011-02-04 09:29:39 UTC
  • mfrom: (2139.3.6 catalogs)
  • mto: This revision was merged to the branch mainline in revision 2144.
  • Revision ID: brian@tangent.org-20110204092939-nlwrimamw0fxxhgl
Main bit of this patch is that Inno now just uses the identifier so we only
have one spot to make changes for paths.

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
23
 
24
 
#include <drizzled/field/date.h>
25
 
#include <drizzled/error.h>
26
 
#include <drizzled/table.h>
27
 
#include <drizzled/temporal.h>
28
 
#include <drizzled/session.h>
29
 
#include <drizzled/time_functions.h>
30
 
#include <drizzled/current_session.h>
 
24
#include "drizzled/field/date.h"
 
25
#include "drizzled/error.h"
 
26
#include "drizzled/table.h"
 
27
#include "drizzled/temporal.h"
 
28
#include "drizzled/session.h"
 
29
#include "drizzled/time_functions.h"
31
30
 
32
31
#include <math.h>
33
32
 
134
133
  {
135
134
    tmp= ltime.year*10000 + ltime.month*100 + ltime.day;
136
135
 
137
 
    Session *session= getTable() ? getTable()->in_use : current_session;
138
136
    type::cut_t cut_error= type::VALID;
139
137
    if (ltime.check(tmp != 0,
140
138
                     (TIME_FUZZY_DATE |
141
 
                      (session->variables.sql_mode & (MODE_NO_ZERO_DATE | MODE_INVALID_DATES))), cut_error))
 
139
                      (current_session->variables.sql_mode &
 
140
                       (MODE_NO_ZERO_DATE | MODE_INVALID_DATES))), cut_error))
142
141
    {
143
142
      char buff[type::Time::MAX_STRING_LENGTH];
144
143
      String str(buff, sizeof(buff), &my_charset_utf8_general_ci);
173
172
  return error;
174
173
}
175
174
 
176
 
double Field_date::val_real(void) const
 
175
double Field_date::val_real(void)
177
176
{
178
177
  return (double) Field_date::val_int();
179
178
}
180
179
 
181
 
int64_t Field_date::val_int(void) const
 
180
int64_t Field_date::val_int(void)
182
181
{
183
182
  uint32_t j;
184
183
 
189
188
  return (int64_t) j;
190
189
}
191
190
 
192
 
String *Field_date::val_str(String *val_buffer, String *) const
 
191
String *Field_date::val_str(String *val_buffer, String *)
193
192
{
194
193
  val_buffer->alloc(field_length);
195
194
  val_buffer->length(field_length);
217
216
  return val_buffer;
218
217
}
219
218
 
220
 
bool Field_date::get_date(type::Time &ltime, uint32_t fuzzydate) const
 
219
bool Field_date::get_date(type::Time &ltime, uint32_t fuzzydate)
221
220
{
222
221
  uint32_t tmp=(uint32_t) uint4korr(ptr);
223
222
  ltime.day=            (int) (tmp%100);
230
229
          1 : 0);
231
230
}
232
231
 
233
 
bool Field_date::get_time(type::Time &ltime) const
 
232
bool Field_date::get_time(type::Time &ltime)
234
233
{
235
234
  return Field_date::get_date(ltime ,0);
236
235
}