~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/temporal.h

  • Committer: patrick crews
  • Date: 2011-01-30 23:02:12 UTC
  • mto: This revision was merged to the branch mainline in revision 2131.
  • Revision ID: gleebix@gmail.com-20110130230212-nnts892jsc0oiurv
Added initial docs for dbqp.py

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
{
285
287
 
286
288
 
287
289
  /**
288
 
   * Operator overload for adding/subtracting a TemporalInterval
289
 
   * instance to this temporal.
290
 
   *
291
 
   * @param TemporalInterval instance to add/subtract to/from
292
 
   */
293
 
  Date& operator+=(const TemporalIntervalYear &rhs);
294
 
  Date& operator+=(const TemporalIntervalDayOrLess &rhs);
295
 
  Date& operator+=(const TemporalIntervalDayOrWeek &rhs);
296
 
  Date& operator+=(const TemporalIntervalYearMonth &rhs);
297
 
  Date& operator-=(const TemporalIntervalYear &rhs);
298
 
  Date& operator-=(const TemporalIntervalDayOrLess &rhs);
299
 
  Date& operator-=(const TemporalIntervalDayOrWeek &rhs);
300
 
  Date& operator-=(const TemporalIntervalYearMonth &rhs);
301
 
 
302
 
 
303
 
  /**
304
290
   * Operator overload for when a DateTime instance is
305
291
   * assigned to a Date.  We do a copy of the DateTime's
306
292
   * date-related components.
329
315
   *
330
316
   * @param C-String to fill.
331
317
   * @param Length of to C-String
332
 
   * @returns length of string written (not including trailing '\0').
 
318
   * @returns length of string written (including trailing '\0').
333
319
   *          If output was truncated, returns length that would have
334
320
   *          been outputted.
335
321
   */
349
335
   * successful.
350
336
   *
351
337
   * @param String to convert from
352
 
   * @param Length of supplied string
 
338
   * @param Length of supplied string (not including trailing '\0').
353
339
   */
354
340
  virtual bool from_string(const char *from, size_t from_len);
355
341
 
435
421
   *
436
422
   * @param Pointer to a time_t to convert to
437
423
   */
438
 
  virtual void to_time_t(time_t *to) const;
 
424
  virtual void to_time_t(time_t &to) const;
439
425
 
440
426
  /**
441
427
   * Attempts to populate the Date instance based
449
435
  virtual bool from_time_t(const time_t from);
450
436
 
451
437
  /**
452
 
   * Fills a supplied my_decimal with a representation of
 
438
   * Fills a supplied type::Decimal with a representation of
453
439
   * the Date value.
454
440
   *
455
 
   * @param Pointer to the my_decimal to fill
 
441
   * @param Pointer to the type::Decimal to fill
456
442
   */
457
 
  virtual void to_decimal(my_decimal *to) const;
 
443
  virtual void to_decimal(type::Decimal *to) const;
458
444
 
459
445
  friend class TemporalInterval;
460
446
  friend class Timestamp;
501
487
  bool is_valid_datetime() const {return false;}
502
488
  bool is_valid_time() const {return is_valid();}
503
489
  bool is_valid_timestamp() const {return false;}
 
490
 
504
491
  /** Returns whether the temporal value is valid date. */
505
492
  bool is_valid() const;
 
493
  bool is_fuzzy_valid() const;
506
494
 
507
495
  /**
508
496
   * Fills a supplied char string with a
546
534
  void to_int32_t(int32_t *to) const;
547
535
 
548
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
  /**
549
546
   * Attempts to populate the Time instance based
550
547
   * on the contents of a supplied 4-byte integer.
551
548
   *
573
570
  bool from_time_t(const time_t from);
574
571
 
575
572
  /**
576
 
   * Fills a supplied my_decimal with a representation of
 
573
   * Fills a supplied type::Decimal with a representation of
577
574
   * the Time value.
578
575
   *
579
 
   * @param Pointer to the my_decimal to fill
 
576
   * @param Pointer to the type::Decimal to fill
580
577
   */
581
 
  void to_decimal(my_decimal *to) const;
 
578
  void to_decimal(type::Decimal *to) const;
582
579
 
583
580
  friend class Date;
584
581
  friend class DateTime;
659
656
   * @param time_t to convert from
660
657
   */
661
658
  bool from_time_t(const time_t from);
 
659
  bool from_timeval(struct timeval &_timeval);
662
660
 
663
661
  /**
664
662
   * Attempts to populate the DateTime instance based
687
685
  void to_tm(struct tm *to) const;
688
686
 
689
687
  /**
690
 
   * Fills a supplied my_decimal with a representation of
 
688
   * Fills a supplied type::Decimal with a representation of
691
689
   * the DateTime value.
692
690
   *
693
 
   * @param Pointer to the my_decimal to fill
 
691
   * @param Pointer to the type::Decimal to fill
694
692
   */
695
 
  void to_decimal(my_decimal *to) const;
 
693
  void to_decimal(type::Decimal *to) const;
696
694
 
697
695
  friend class Timestamp;
698
696
};
754
752
   *
755
753
   * @param Pointer to a time_t to convert to
756
754
   */
757
 
  void to_time_t(time_t *to) const;
 
755
  void to_time_t(time_t &to) const;
758
756
};
759
757
 
760
758
/**
802
800
   *
803
801
   * @param timeval to fill.
804
802
   */
805
 
  void to_timeval(struct timeval *to) const;
 
803
  void to_timeval(struct timeval &to) const;
806
804
};
807
805
 
808
806
/**