~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/function/time/curdate.cc

  • Committer: Jay Pipes
  • Date: 2009-02-21 16:00:06 UTC
  • mto: (907.1.1 trunk-with-temporal)
  • mto: This revision was merged to the branch mainline in revision 908.
  • Revision ID: jpipes@serialcoder-20090221160006-vnk3wt4qbcz62eru
Removes the TIME column type and related time functions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#include "config.h"
21
 
 
 
20
#include "drizzled/server_includes.h"
 
21
#include CSTDINT_H
22
22
#include "drizzled/function/time/curdate.h"
23
23
#include "drizzled/tztime.h"
24
24
#include "drizzled/temporal.h"
25
25
#include "drizzled/session.h"
26
26
 
27
 
namespace drizzled
28
 
{
29
 
 
30
27
void Item_func_curdate::fix_length_and_dec()
31
28
{
32
29
  collation.set(&my_charset_bin);
33
30
  decimals=0;
34
 
  max_length=Date::MAX_STRING_LENGTH*MY_CHARSET_BIN_MB_MAXLEN;
 
31
  max_length=MAX_DATE_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
35
32
 
36
33
  store_now_in_TIME(&ltime);
37
34
 
55
52
void Item_func_curdate_local::store_now_in_TIME(DRIZZLE_TIME *now_time)
56
53
{
57
54
  Session *session= current_session;
58
 
  time_t tmp= session->query_start();
59
 
 
60
 
  (void) cached_temporal.from_time_t(tmp);
61
 
 
62
 
  now_time->year= cached_temporal.years();
63
 
  now_time->month= cached_temporal.months();
64
 
  now_time->day= cached_temporal.days();
65
 
  now_time->hour= 0;
66
 
  now_time->minute= 0;
67
 
  now_time->second= 0;
 
55
  session->variables.time_zone->gmt_sec_to_TIME(now_time,
 
56
                                                (time_t)session->query_start());
68
57
}
69
58
 
70
59
/**
73
62
*/
74
63
void Item_func_curdate_utc::store_now_in_TIME(DRIZZLE_TIME *now_time)
75
64
{
76
 
  Session *session= current_session;
77
 
  time_t tmp= session->query_start();
78
 
 
79
 
  (void) cached_temporal.from_time_t(tmp);
80
 
 
81
 
  now_time->year= cached_temporal.years();
82
 
  now_time->month= cached_temporal.months();
83
 
  now_time->day= cached_temporal.days();
84
 
  now_time->hour= 0;
85
 
  now_time->minute= 0;
86
 
  now_time->second= 0;
 
65
  my_tz_UTC->gmt_sec_to_TIME(now_time,
 
66
                             (time_t)(current_session->query_start()));
 
67
  /*
 
68
    We are not flagging this query as using time zone, since it uses fixed
 
69
    UTC-SYSTEM time-zone.
 
70
  */
87
71
}
88
72
 
89
 
bool Item_func_curdate::get_temporal(Date &to)
 
73
bool Item_func_curdate::get_temporal(drizzled::Date &to)
90
74
{
91
75
  to= cached_temporal;
92
76
  return true;
93
77
}
94
 
 
95
 
} /* namespace drizzled */