574.3.16
by Lee
moving functions from item_timefunc to functions/time directory |
1 |
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
3 |
*
|
|
1999.6.1
by kalebral at gmail
update Copyright strings to a more common format to help with creating the master debian copyright file |
4 |
* Copyright (C) 2008 Sun Microsystems, Inc.
|
574.3.16
by Lee
moving functions from item_timefunc to functions/time directory |
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or modify
|
|
7 |
* it under the terms of the GNU General Public License as published by
|
|
8 |
* the Free Software Foundation; version 2 of the License.
|
|
9 |
*
|
|
10 |
* This program is distributed in the hope that it will be useful,
|
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 |
* GNU General Public License for more details.
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License
|
|
16 |
* along with this program; if not, write to the Free Software
|
|
17 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
18 |
*/
|
|
19 |
||
2173.2.1
by Monty Taylor
Fixes incorrect usage of include |
20 |
#include <config.h> |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
21 |
|
670.1.20
by Monty Taylor
Renamed functions to function... everything else is singular. |
22 |
#include <drizzled/function/time/now.h> |
2154.2.24
by Brian Aker
Merge in all changes for current_session, etc. |
23 |
#include <drizzled/current_session.h> |
584.1.15
by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes. |
24 |
#include <drizzled/session.h> |
2269.1.5
by Olaf van der Spek
Session Times |
25 |
#include <drizzled/session/times.h> |
2173.2.1
by Monty Taylor
Fixes incorrect usage of include |
26 |
#include <drizzled/temporal.h> |
2234.1.3
by Olaf van der Spek
Refactor includes |
27 |
#include <drizzled/field.h> |
907.1.8
by Jay Pipes
Final removal of timezones |
28 |
|
2234.1.3
by Olaf van der Spek
Refactor includes |
29 |
namespace drizzled { |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
30 |
|
735
by Brian Aker
Refactor session. |
31 |
String *Item_func_now::val_str(String *) |
574.3.16
by Lee
moving functions from item_timefunc to functions/time directory |
32 |
{
|
33 |
assert(fixed == 1); |
|
735
by Brian Aker
Refactor session. |
34 |
str_value.set(buff, buff_length, &my_charset_bin); |
2069.2.2
by Brian Aker
Small refactoring around type::Time |
35 |
|
574.3.16
by Lee
moving functions from item_timefunc to functions/time directory |
36 |
return &str_value; |
37 |
}
|
|
38 |
||
39 |
||
40 |
void Item_func_now::fix_length_and_dec() |
|
41 |
{
|
|
42 |
decimals= DATETIME_DEC; |
|
43 |
collation.set(&my_charset_bin); |
|
907.1.7
by Jay Pipes
Merged in remove-timezone work |
44 |
|
2069.2.2
by Brian Aker
Small refactoring around type::Time |
45 |
ltime.reset(); |
907.1.7
by Jay Pipes
Merged in remove-timezone work |
46 |
|
2088.8.9
by Brian Aker
Merge in namespace of enum. |
47 |
ltime.time_type= type::DRIZZLE_TIMESTAMP_DATETIME; |
574.3.16
by Lee
moving functions from item_timefunc to functions/time directory |
48 |
|
2104.2.8
by Brian Aker
Merge in reference from pointer. |
49 |
store_now_in_TIME(ltime); |
2088.8.11
by Brian Aker
Fix additional output, swaps for the valus. |
50 |
|
2098.3.2
by Brian Aker
Merge in uint to int fixes in time type. |
51 |
ltime.convert(value); |
574.3.16
by Lee
moving functions from item_timefunc to functions/time directory |
52 |
|
2088.8.11
by Brian Aker
Fix additional output, swaps for the valus. |
53 |
size_t length= type::Time::MAX_STRING_LENGTH; |
54 |
ltime.convert(buff, length); |
|
55 |
||
56 |
max_length= buff_length= length; |
|
574.3.16
by Lee
moving functions from item_timefunc to functions/time directory |
57 |
}
|
58 |
||
59 |
/**
|
|
2030.1.5
by Brian Aker
Update for moving DRIZZLE_TIME to type::Time |
60 |
Converts current time in time_t to type::Time represenatation for local
|
574.3.16
by Lee
moving functions from item_timefunc to functions/time directory |
61 |
time zone. Defines time zone (local) used for whole NOW function.
|
62 |
*/
|
|
2104.2.8
by Brian Aker
Merge in reference from pointer. |
63 |
void Item_func_now_local::store_now_in_TIME(type::Time &now_time) |
574.3.16
by Lee
moving functions from item_timefunc to functions/time directory |
64 |
{
|
65 |
Session *session= current_session; |
|
2057.2.5
by Brian Aker
Fixed now() to return fractional seconds. |
66 |
uint32_t fractional_seconds= 0; |
2269.1.5
by Olaf van der Spek
Session Times |
67 |
time_t tmp= session->times.getCurrentTimestampEpoch(fractional_seconds); |
907.1.8
by Jay Pipes
Final removal of timezones |
68 |
|
2082.4.2
by Brian Aker
Merge in changes for factor on type::Time |
69 |
#if 0
|
70 |
now_time->store(tmp, fractional_seconds, true);
|
|
71 |
#endif
|
|
2104.2.8
by Brian Aker
Merge in reference from pointer. |
72 |
now_time.store(tmp, fractional_seconds); |
574.3.16
by Lee
moving functions from item_timefunc to functions/time directory |
73 |
}
|
74 |
||
75 |
||
76 |
/**
|
|
2030.1.5
by Brian Aker
Update for moving DRIZZLE_TIME to type::Time |
77 |
Converts current time in time_t to type::Time represenatation for UTC
|
574.3.16
by Lee
moving functions from item_timefunc to functions/time directory |
78 |
time zone. Defines time zone (UTC) used for whole UTC_TIMESTAMP function.
|
79 |
*/
|
|
2104.2.8
by Brian Aker
Merge in reference from pointer. |
80 |
void Item_func_now_utc::store_now_in_TIME(type::Time &now_time) |
574.3.16
by Lee
moving functions from item_timefunc to functions/time directory |
81 |
{
|
2057.2.5
by Brian Aker
Fixed now() to return fractional seconds. |
82 |
uint32_t fractional_seconds= 0; |
2269.1.5
by Olaf van der Spek
Session Times |
83 |
time_t tmp= current_session->times.getCurrentTimestampEpoch(fractional_seconds); |
2104.2.8
by Brian Aker
Merge in reference from pointer. |
84 |
now_time.store(tmp, fractional_seconds); |
907.1.8
by Jay Pipes
Final removal of timezones |
85 |
}
|
86 |
||
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
87 |
bool Item_func_now::get_temporal(DateTime &to) |
907.1.8
by Jay Pipes
Final removal of timezones |
88 |
{
|
89 |
to= cached_temporal; |
|
90 |
return true; |
|
574.3.16
by Lee
moving functions from item_timefunc to functions/time directory |
91 |
}
|
92 |
||
2104.2.8
by Brian Aker
Merge in reference from pointer. |
93 |
bool Item_func_now::get_date(type::Time &res, uint32_t ) |
574.3.16
by Lee
moving functions from item_timefunc to functions/time directory |
94 |
{
|
2104.2.8
by Brian Aker
Merge in reference from pointer. |
95 |
res= ltime; |
574.3.16
by Lee
moving functions from item_timefunc to functions/time directory |
96 |
return 0; |
97 |
}
|
|
98 |
||
99 |
||
779.1.27
by Monty Taylor
Got rid of __attribute__((unused)) and the like from the .cc files. |
100 |
int Item_func_now::save_in_field(Field *to, bool ) |
574.3.16
by Lee
moving functions from item_timefunc to functions/time directory |
101 |
{
|
102 |
to->set_notnull(); |
|
2104.2.7
by Brian Aker
Fix store_time to take reference. |
103 |
return to->store_time(ltime, type::DRIZZLE_TIMESTAMP_DATETIME); |
574.3.16
by Lee
moving functions from item_timefunc to functions/time directory |
104 |
}
|
105 |
||
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
106 |
} /* namespace drizzled */ |