~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/epoch.cc

merge lp:~linuxjedi/drizzle/trunk-remove-drizzleadmin

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
#include <boost/lexical_cast.hpp>
23
23
#include <drizzled/field/epoch.h>
24
24
#include <drizzled/error.h>
25
 
#include <drizzled/tztime.h>
26
25
#include <drizzled/table.h>
27
26
#include <drizzled/session.h>
28
 
 
29
 
#include <math.h>
30
 
 
 
27
#include <drizzled/session/times.h>
 
28
#include <drizzled/current_session.h>
 
29
#include <drizzled/temporal.h>
 
30
#include <cmath>
31
31
#include <sstream>
32
32
 
33
 
#include "drizzled/temporal.h"
34
 
 
35
 
namespace drizzled
36
 
{
37
 
 
38
 
namespace field
39
 
{
 
33
namespace drizzled {
 
34
namespace field {
40
35
 
41
36
/**
42
37
  TIMESTAMP type holds datetime values in range from 1970-01-01 00:00:01 UTC to
154
149
 
155
150
int Epoch::store(const char *from,
156
151
                 uint32_t len,
157
 
                 const CHARSET_INFO * const )
 
152
                 const charset_info_st * const )
158
153
{
159
154
  Timestamp temporal;
160
155
 
234
229
  return 0;
235
230
}
236
231
 
237
 
double Epoch::val_real(void)
 
232
double Epoch::val_real(void) const
238
233
{
239
234
  return (double) Epoch::val_int();
240
235
}
241
236
 
242
 
int64_t Epoch::val_int(void)
 
237
int64_t Epoch::val_int(void) const
243
238
{
244
239
  uint64_t temp;
245
240
 
256
251
  return result;
257
252
}
258
253
 
259
 
String *Epoch::val_str(String *val_buffer, String *)
 
254
String *Epoch::val_str(String *val_buffer, String *) const
260
255
{
261
256
  uint64_t temp= 0;
262
257
  char *to;
280
275
  return val_buffer;
281
276
}
282
277
 
283
 
bool Epoch::get_date(type::Time &ltime, uint32_t)
 
278
bool Epoch::get_date(type::Time &ltime, uint32_t) const
284
279
{
285
280
  uint64_t temp;
286
281
  type::Time::epoch_t time_temp;
295
290
  return 0;
296
291
}
297
292
 
298
 
bool Epoch::get_time(type::Time &ltime)
 
293
bool Epoch::get_time(type::Time &ltime) const
299
294
{
300
295
  return Epoch::get_date(ltime, 0);
301
296
}
347
342
void Epoch::set_time()
348
343
{
349
344
  Session *session= getTable() ? getTable()->in_use : current_session;
350
 
  time_t tmp= session->getCurrentTimestampEpoch();
 
345
  time_t tmp= session->times.getCurrentTimestampEpoch();
351
346
 
352
347
  set_notnull();
353
348
  pack_num(static_cast<uint32_t>(tmp));
366
361
  }
367
362
}
368
363
 
369
 
long Epoch::get_timestamp(bool *null_value)
 
364
long Epoch::get_timestamp(bool *null_value) const
370
365
{
371
366
  if ((*null_value= is_null()))
372
367
    return 0;