71
int32_t match_vector[OUT_VECTOR_SIZE]; /**< Stores match substring indexes */
73
/* Make sure we've got no junk in the match_vector. */
74
memset(match_vector, 0, sizeof(match_vector));
75
76
/* Simply check the subject against the compiled regular expression */
76
77
int32_t result= pcre_exec(_re
77
78
, NULL /* No extra data */
120
121
if (_year_part_index > 1)
122
size_t year_start= _match_vector[_year_part_index];
123
size_t year_len= _match_vector[_year_part_index + 1] - _match_vector[_year_part_index];
123
size_t year_start= match_vector[_year_part_index];
124
size_t year_len= match_vector[_year_part_index + 1] - match_vector[_year_part_index];
124
125
to->_years= atoi(copy_data.substr(year_start, year_len).c_str());
125
126
if (year_len == 2)
126
127
to->_years+= (to->_years >= DRIZZLE_YY_PART_YEAR ? 1900 : 2000);
128
129
if (_month_part_index > 1)
130
size_t month_start= _match_vector[_month_part_index];
131
size_t month_len= _match_vector[_month_part_index + 1] - _match_vector[_month_part_index];
131
size_t month_start= match_vector[_month_part_index];
132
size_t month_len= match_vector[_month_part_index + 1] - match_vector[_month_part_index];
132
133
to->_months= atoi(copy_data.substr(month_start, month_len).c_str());
134
135
if (_day_part_index > 1)
136
size_t day_start= _match_vector[_day_part_index];
137
size_t day_len= _match_vector[_day_part_index + 1] - _match_vector[_day_part_index];
137
size_t day_start= match_vector[_day_part_index];
138
size_t day_len= match_vector[_day_part_index + 1] - match_vector[_day_part_index];
138
139
to->_days= atoi(copy_data.substr(day_start, day_len).c_str());
140
141
if (_hour_part_index > 1)
142
size_t hour_start= _match_vector[_hour_part_index];
143
size_t hour_len= _match_vector[_hour_part_index + 1] - _match_vector[_hour_part_index];
143
size_t hour_start= match_vector[_hour_part_index];
144
size_t hour_len= match_vector[_hour_part_index + 1] - match_vector[_hour_part_index];
144
145
to->_hours= atoi(copy_data.substr(hour_start, hour_len).c_str());
146
147
if (_minute_part_index > 1)
148
size_t minute_start= _match_vector[_minute_part_index];
149
size_t minute_len= _match_vector[_minute_part_index + 1] - _match_vector[_minute_part_index];
149
size_t minute_start= match_vector[_minute_part_index];
150
size_t minute_len= match_vector[_minute_part_index + 1] - match_vector[_minute_part_index];
150
151
to->_minutes= atoi(copy_data.substr(minute_start, minute_len).c_str());
152
153
if (_second_part_index > 1)
154
size_t second_start= _match_vector[_second_part_index];
155
size_t second_len= _match_vector[_second_part_index + 1] - _match_vector[_second_part_index];
155
size_t second_start= match_vector[_second_part_index];
156
size_t second_len= match_vector[_second_part_index + 1] - match_vector[_second_part_index];
156
157
to->_seconds= atoi(copy_data.substr(second_start, second_len).c_str());
158
159
if (_usecond_part_index > 1)
160
size_t usecond_start= _match_vector[_usecond_part_index];
161
size_t usecond_len= _match_vector[_usecond_part_index + 1] - _match_vector[_usecond_part_index];
161
size_t usecond_start= match_vector[_usecond_part_index];
162
size_t usecond_len= match_vector[_usecond_part_index + 1] - match_vector[_usecond_part_index];
163
164
* For microseconds, which are millionth of 1 second,
164
165
* we must ensure that we produce a correct result,
177
178
if (_nsecond_part_index > 1)
179
size_t nsecond_start= _match_vector[_nsecond_part_index];
180
size_t nsecond_len= _match_vector[_nsecond_part_index + 1] - _match_vector[_nsecond_part_index];
180
size_t nsecond_start= match_vector[_nsecond_part_index];
181
size_t nsecond_len= match_vector[_nsecond_part_index + 1] - match_vector[_nsecond_part_index];
182
183
* For nanoseconds, which are 1 billionth of a second,
183
184
* we must ensure that we produce a correct result,