~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Jay Pipes
  • Date: 2009-01-30 04:01:12 UTC
  • mto: This revision was merged to the branch mainline in revision 830.
  • Revision ID: jpipes@serialcoder-20090130040112-svbn774guj98pwi4
To remain in compatibility with MySQL, added ability to interpret
decimal arguments as datetime strings for temporal functions.

Fixed YEAR(), MONTH(), DAYOFMONTH(), DAYOFYEAR(), HOUR(), MINUTE(), SECOND(), and MICROSECOND()
to accept decimal parameters and interpret them the same way as MySQL.

Fixed an issue with the TemporalFormat::matches() method which was 
incorrectly assuming all microsecond arguments were specified as 6 digits.
Added power of 10 multiplier to usecond calculation. This fixes issues with
failures in type_date and func_sapdb test cases.

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"
21
 
 
22
 
#include "drizzled/function/time/makedate.h"
23
 
#include "drizzled/time_functions.h"
24
 
 
25
 
namespace drizzled
26
 
{
 
20
#include <drizzled/server_includes.h>
 
21
#include CSTDINT_H
 
22
#include <drizzled/function/time/makedate.h>
27
23
 
28
24
/**
29
25
  MAKEDATE(a,b) is a date function that creates a date value
58
54
    get_date_from_daynr(days,&l_time.year,&l_time.month,&l_time.day);
59
55
    if (str->alloc(MAX_DATE_STRING_REP_LENGTH))
60
56
      goto err;
61
 
    make_date(&l_time, str);
 
57
    make_date((DATE_TIME_FORMAT *) 0, &l_time, str);
62
58
    return str;
63
59
  }
64
60
 
107
103
  return 0;
108
104
}
109
105
 
110
 
} /* namespace drizzled */