~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-10-02 14:17:48 UTC
  • mfrom: (1.1.1 upstream)
  • mto: (2.1.17 sid)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20101002141748-m6vbfbfjhrw1153e
Tags: 2010.09.1802-1
* New upstream release.
* Removed pid-file argument hack.
* Updated GPL-2 address to be new address.
* Directly copy in drizzledump.1 since debian doesn't have sphinx 1.0 yet.
* Link to jquery from libjs-jquery. Add it as a depend.
* Add drizzled.8 symlink to the install files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
  char time_buff[DRIZZLE_MAX_LENGTH_DATETIME_AS_STRING];
58
58
  String tmp_time(time_buff,sizeof(time_buff), &my_charset_utf8_bin);
59
59
  String *time_res= args[0]->val_str(&tmp_time);
60
 
  if (! temporal_time.from_string(time_res->c_ptr(), time_res->length()))
 
60
 
 
61
  if (time_res && (time_res != &tmp_time))
 
62
  {
 
63
    tmp_time.copy(*time_res);
 
64
  }
 
65
 
 
66
  if (! temporal_time.from_string(tmp_time.c_ptr(), tmp_time.length()))
61
67
  {
62
68
    /* 
63
69
     * OK, we failed to match the first argument as a string
83
89
          char buff[DRIZZLE_MAX_LENGTH_DATETIME_AS_STRING];
84
90
          String tmp(buff,sizeof(buff), &my_charset_utf8_bin);
85
91
          String *res= args[0]->val_str(&tmp);
86
 
          if (! temporal_datetime.from_string(res->c_ptr(), res->length()))
 
92
 
 
93
          if (res && (res != &tmp))
 
94
          {
 
95
            tmp.copy(*res);
 
96
          }
 
97
 
 
98
          if (! temporal_datetime.from_string(tmp.c_ptr(), tmp.length()))
87
99
          {
88
100
            /* 
89
101
            * Could not interpret the function argument as a temporal value, 
90
102
            * so throw an error and return 0
91
103
            */
92
 
            my_error(ER_INVALID_DATETIME_VALUE, MYF(0), res->c_ptr());
 
104
            my_error(ER_INVALID_DATETIME_VALUE, MYF(0), tmp.c_ptr());
93
105
            return 0;
94
106
          }
95
107
        }
111
123
 
112
124
          res= args[0]->val_str(&tmp);
113
125
 
114
 
          my_error(ER_INVALID_DATETIME_VALUE, MYF(0), res->c_ptr());
 
126
          if (res && (res != &tmp))
 
127
          {
 
128
            tmp.copy(*res);
 
129
          }
 
130
 
 
131
          my_error(ER_INVALID_DATETIME_VALUE, MYF(0), tmp.c_ptr());
115
132
          return 0;
116
133
        }
117
134
    }