~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/temporal.h

Merge with trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008-2009 Sun Microsystems
 
4
 *  Copyright (C) 2008-2009 Sun Microsystems, Inc.
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
72
72
#include <ostream>
73
73
 
74
74
/* Outside forward declarations */
75
 
class my_decimal;
 
75
namespace type {
 
76
class Decimal;
 
77
}
76
78
 
77
79
namespace drizzled
78
80
{
419
421
   *
420
422
   * @param Pointer to a time_t to convert to
421
423
   */
422
 
  virtual void to_time_t(time_t *to) const;
 
424
  virtual void to_time_t(time_t &to) const;
423
425
 
424
426
  /**
425
427
   * Attempts to populate the Date instance based
433
435
  virtual bool from_time_t(const time_t from);
434
436
 
435
437
  /**
436
 
   * Fills a supplied my_decimal with a representation of
 
438
   * Fills a supplied type::Decimal with a representation of
437
439
   * the Date value.
438
440
   *
439
 
   * @param Pointer to the my_decimal to fill
 
441
   * @param Pointer to the type::Decimal to fill
440
442
   */
441
 
  virtual void to_decimal(my_decimal *to) const;
 
443
  virtual void to_decimal(type::Decimal *to) const;
442
444
 
443
445
  friend class TemporalInterval;
444
446
  friend class Timestamp;
485
487
  bool is_valid_datetime() const {return false;}
486
488
  bool is_valid_time() const {return is_valid();}
487
489
  bool is_valid_timestamp() const {return false;}
 
490
 
488
491
  /** Returns whether the temporal value is valid date. */
489
492
  bool is_valid() const;
 
493
  bool is_fuzzy_valid() const;
490
494
 
491
495
  /**
492
496
   * Fills a supplied char string with a
530
534
  void to_int32_t(int32_t *to) const;
531
535
 
532
536
  /**
 
537
   * Fills a supplied 8-byte integer pointer with an
 
538
   * integer representation of the Time
 
539
   * value. It is assume seconds past unix epoch
 
540
   *
 
541
   * @param Integer to fill.
 
542
   */
 
543
  void to_uint64_t(uint64_t &to) const;
 
544
 
 
545
  /**
533
546
   * Attempts to populate the Time instance based
534
547
   * on the contents of a supplied 4-byte integer.
535
548
   *
557
570
  bool from_time_t(const time_t from);
558
571
 
559
572
  /**
560
 
   * Fills a supplied my_decimal with a representation of
 
573
   * Fills a supplied type::Decimal with a representation of
561
574
   * the Time value.
562
575
   *
563
 
   * @param Pointer to the my_decimal to fill
 
576
   * @param Pointer to the type::Decimal to fill
564
577
   */
565
 
  void to_decimal(my_decimal *to) const;
 
578
  void to_decimal(type::Decimal *to) const;
566
579
 
567
580
  friend class Date;
568
581
  friend class DateTime;
643
656
   * @param time_t to convert from
644
657
   */
645
658
  bool from_time_t(const time_t from);
 
659
  bool from_timeval(struct timeval &_timeval);
646
660
 
647
661
  /**
648
662
   * Attempts to populate the DateTime instance based
671
685
  void to_tm(struct tm *to) const;
672
686
 
673
687
  /**
674
 
   * Fills a supplied my_decimal with a representation of
 
688
   * Fills a supplied type::Decimal with a representation of
675
689
   * the DateTime value.
676
690
   *
677
 
   * @param Pointer to the my_decimal to fill
 
691
   * @param Pointer to the type::Decimal to fill
678
692
   */
679
 
  void to_decimal(my_decimal *to) const;
 
693
  void to_decimal(type::Decimal *to) const;
680
694
 
681
695
  friend class Timestamp;
682
696
};
738
752
   *
739
753
   * @param Pointer to a time_t to convert to
740
754
   */
741
 
  void to_time_t(time_t *to) const;
 
755
  void to_time_t(time_t &to) const;
742
756
};
743
757
 
744
758
/**
786
800
   *
787
801
   * @param timeval to fill.
788
802
   */
789
 
  void to_timeval(struct timeval *to) const;
 
803
  void to_timeval(struct timeval &to) const;
790
804
};
791
805
 
792
806
/**