~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/datetime.cc

  • Committer: Monty Taylor
  • Date: 2009-02-11 04:57:40 UTC
  • mfrom: (873.1.5 temporal-new)
  • mto: This revision was merged to the branch mainline in revision 879.
  • Revision ID: mordred@inaugust.com-20090211045740-wmv6ucfj7tjr3ngg
Merged from Jay.

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 "drizzled/server_includes.h"
 
22
#include "drizzled/field/datetime.h"
 
23
#include "drizzled/error.h"
 
24
#include "drizzled/table.h"
 
25
#include "drizzled/temporal.h"
 
26
#include "drizzled/session.h"
21
27
 
22
 
#include <drizzled/server_includes.h>
23
 
#include <drizzled/field/datetime.h>
24
 
#include <drizzled/error.h>
25
 
#include <drizzled/table.h>
26
 
#include <drizzled/session.h>
27
28
#include CMATH_H
28
29
 
29
30
#if defined(CMATH_NAMESPACE)
41
42
                          uint32_t len,
42
43
                          const CHARSET_INFO * const )
43
44
{
 
45
#ifdef NOTDEFINED
44
46
  DRIZZLE_TIME time_tmp;
45
47
  int error;
46
48
  uint64_t tmp= 0;
70
72
  else
71
73
#endif
72
74
    int64_tstore(ptr,tmp);
73
 
  return error;
 
75
#endif /* NOTDEFINED */
 
76
  /* 
 
77
   * Try to create a DateTime from the supplied string.  Throw an error
 
78
   * if unable to create a valid DateTime.  
 
79
   */
 
80
  drizzled::DateTime temporal;
 
81
  if (! temporal.from_string(from, (size_t) len))
 
82
  {
 
83
    my_error(ER_INVALID_DATETIME_VALUE, MYF(ME_FATALERROR), from);
 
84
    return 2;
 
85
  }
 
86
  /* Create the stored integer format. @TODO This should go away. Should be up to engine... */
 
87
  int64_t int_value;
 
88
  temporal.to_int64_t(&int_value);
 
89
#ifdef WORDS_BIGENDIAN
 
90
  if (table && table->s->db_low_byte_first)
 
91
  {
 
92
    int8store(ptr, int_value);
 
93
  }
 
94
  else
 
95
#endif
 
96
    int64_tstore(ptr, int_value);
 
97
  return 0;
74
98
}
75
99
 
76
 
 
77
100
int Field_datetime::store(double nr)
78
101
{
79
102
  int error= 0;