~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Monty Taylor
  • Date: 2010-06-02 22:35:45 UTC
  • mto: This revision was merged to the branch mainline in revision 1586.
  • Revision ID: mordred@inaugust.com-20100602223545-q8ekf9b40a85nwuf
Rearragned unittests into a single exe because of how we need to link it
(thanks lifeless)
Link with server symbols without needing to build a library.
Added an additional atomics test which tests whatever version of the atomics
lib the running platform would actually use.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
#include "drizzled/temporal.h"
23
23
#include "drizzled/error.h"
24
24
#include "drizzled/function/time/weekday.h"
25
 
#include "drizzled/util/test.h"
26
25
 
27
26
namespace drizzled
28
27
{
58
57
        char buff[DRIZZLE_MAX_LENGTH_DATETIME_AS_STRING];
59
58
        String tmp(buff,sizeof(buff), &my_charset_utf8_bin);
60
59
        String *res= args[0]->val_str(&tmp);
61
 
 
62
 
        if (res && (res != &tmp))
63
 
        {
64
 
          tmp.copy(*res);
65
 
        }
66
 
 
67
 
        if (! temporal.from_string(tmp.c_ptr(), tmp.length()))
 
60
        if (! temporal.from_string(res->c_ptr(), res->length()))
68
61
        {
69
62
          /* 
70
63
          * Could not interpret the function argument as a temporal value, 
71
64
          * so throw an error and return 0
72
65
          */
73
 
          my_error(ER_INVALID_DATETIME_VALUE, MYF(0), tmp.c_ptr());
 
66
          my_error(ER_INVALID_DATETIME_VALUE, MYF(0), res->c_ptr());
74
67
          return 0;
75
68
        }
76
69
      }
92
85
 
93
86
        res= args[0]->val_str(&tmp);
94
87
 
95
 
        if (res && (res != &tmp))
96
 
        {
97
 
          tmp.copy(*res);
98
 
        }
99
 
 
100
 
        my_error(ER_INVALID_DATETIME_VALUE, MYF(0), tmp.c_ptr());
 
88
        my_error(ER_INVALID_DATETIME_VALUE, MYF(0), res->c_ptr());
101
89
        return 0;
102
90
      }
103
91
  }