~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Stewart Smith
  • Date: 2011-01-14 05:15:23 UTC
  • mto: (2086.1.3 build)
  • mto: This revision was merged to the branch mainline in revision 2087.
  • Revision ID: stewart@flamingspork.com-20110114051523-n57f99sr3qzs9ijw
rearrange explanation of absence of old weird types in numeric data types doc to be after explanation of what we do have. I think it reads better that way

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
 
23
 
#include <drizzled/function/cast/time.h>
24
 
#include <drizzled/time_functions.h>
 
23
#include "drizzled/function/cast/time.h"
 
24
#include "drizzled/time_functions.h"
25
25
 
26
26
namespace drizzled {
27
27
namespace function {
28
28
namespace cast {
29
29
 
30
 
bool Time::get_time(type::Time &ltime)
 
30
bool Time::get_time(type::Time *ltime)
31
31
{
32
32
  bool res= get_arg0_time(ltime);
33
33
 
34
 
  ltime.truncate(type::DRIZZLE_TIMESTAMP_TIME);
 
34
  if (ltime->time_type == DRIZZLE_TIMESTAMP_DATETIME)
 
35
    ltime->year= ltime->month= ltime->day= 0;
 
36
 
 
37
  ltime->time_type= DRIZZLE_TIMESTAMP_TIME;
35
38
 
36
39
  return res;
37
40
}
41
44
  assert(fixed == 1);
42
45
  type::Time ltime;
43
46
 
44
 
  if (not get_arg0_time(ltime))
 
47
  if (not get_arg0_time(&ltime))
45
48
  {
46
49
    null_value= 0;
47
 
    ltime.convert(*str, type::DRIZZLE_TIMESTAMP_TIME);
48
 
 
 
50
    make_time(&ltime, str);
49
51
    return str;
50
52
  }
51
53
 
58
60
  assert(fixed == 1);
59
61
  type::Time ltime;
60
62
 
61
 
  if (get_time(ltime))
 
63
  if (get_time(&ltime))
62
64
    return 0;
63
65
 
64
66
  return (ltime.neg ? -1 : 1) * (int64_t)((ltime.hour)*10000 + ltime.minute*100 + ltime.second);