~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Brian Aker
  • Date: 2011-01-25 00:51:34 UTC
  • mto: This revision was merged to the branch mainline in revision 2113.
  • Revision ID: brian@tangent.org-20110125005134-4q2lqcwpyj4xuwd0
Merge in the last of the sql_command/push it into the statement object
creation.

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>
 
20
#include "config.h"
21
21
#include <boost/lexical_cast.hpp>
22
 
#include <drizzled/function/time/from_unixtime.h>
23
 
#include <drizzled/current_session.h>
24
 
#include <drizzled/session.h>
25
 
#include <drizzled/temporal.h>
26
 
#include <drizzled/time_functions.h>
 
22
#include "drizzled/function/time/from_unixtime.h"
 
23
#include "drizzled/session.h"
 
24
#include "drizzled/temporal.h"
 
25
#include "drizzled/time_functions.h"
27
26
 
28
27
#include <sstream>
29
28
#include <string>
46
45
 
47
46
  assert(fixed == 1);
48
47
 
49
 
  if (get_date(time_tmp, 0))
 
48
  if (get_date(&time_tmp, 0))
50
49
    return 0;
51
50
 
52
51
  if (str->alloc(type::Time::MAX_STRING_LENGTH))
66
65
 
67
66
  assert(fixed == 1);
68
67
 
69
 
  if (get_date(time_tmp, 0))
 
68
  if (get_date(&time_tmp, 0))
70
69
    return 0;
71
70
 
72
71
  int64_t ret;
75
74
  return (int64_t) ret;
76
75
}
77
76
 
78
 
bool Item_func_from_unixtime::get_date(type::Time &ltime, uint32_t)
 
77
bool Item_func_from_unixtime::get_date(type::Time *ltime, uint32_t)
79
78
{
80
79
  uint64_t tmp= 0;
81
80
  type::Time::usec_t fractional_tmp= 0;
106
105
  if ((null_value= (args[0]->null_value || tmp > TIMESTAMP_MAX_VALUE)))
107
106
    return 1;
108
107
 
109
 
  ltime.reset();
110
 
  ltime.store(tmp, fractional_tmp);
 
108
  ltime->reset();
 
109
  ltime->store(tmp, fractional_tmp);
111
110
 
112
111
  return 0;
113
112
}