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

« back to all changes in this revision

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