~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: lbieber
  • Date: 2010-09-10 16:06:15 UTC
  • mfrom: (1754.1.1 build)
  • Revision ID: lbieber@orisndriz03-20100910160615-i9y0hqsnnl7atdky
Merge Shrews - fix bug 562349 - date and time functions corrupt blob data in pbxt engine

Show diffs side-by-side

added added

removed removed

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