~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/util/test.h

  • 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:
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 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2008 Sun Microsystems
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
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
21
 
#ifndef DRIZZLED_UTIL_TEST_H
22
 
#define DRIZZLED_UTIL_TEST_H
 
21
#ifndef DRIZZLE_SERVER_UTIL_TEST
 
22
#define DRIZZLE_SERVER_UTIL_TEST
23
23
 
24
24
#if defined(__cplusplus)
25
25
 
26
 
namespace drizzled
27
 
{
28
 
 
29
26
template <class T>
30
27
inline bool test(const T a)
31
28
{
38
35
  return ((a & b) == b);
39
36
}
40
37
 
41
 
} /* namespace drizzled */
42
 
 
43
38
#else
44
39
# define test(a)    ((a) ? 1 : 0)
45
40
# define test_all_bits(a,b) (((a) & (b)) == (b))
46
41
#endif
47
42
 
48
 
#endif /* DRIZZLED_UTIL_TEST_H */
 
43
#endif