78 pcre2_match_data *match_data= pcre2_match_data_create_from_pattern(
_re, NULL);
79 if (match_data == NULL)
83 int32_t result= pcre2_match(
_re,
84 reinterpret_cast<PCRE2_SPTR
>(data),
92 pcre2_match_data_free(match_data);
95 case PCRE2_ERROR_NOMATCH:
103 int32_t expected_match_count= (_year_part_index > 1 ? 1 : 0)
104 + (_month_part_index > 1 ? 1 : 0)
105 + (_day_part_index > 1 ? 1 : 0)
106 + (_hour_part_index > 1 ? 1 : 0)
107 + (_minute_part_index > 1 ? 1 : 0)
108 + (_second_part_index > 1 ? 1 : 0)
109 + (_usecond_part_index > 1 ? 1 : 0)
110 + (_nsecond_part_index > 1 ? 1 : 0)
112 if (result != expected_match_count)
114 pcre2_match_data_free(match_data);
119 string copy_data(data, data_len);
120 PCRE2_SIZE *match_vector= pcre2_get_ovector_pointer(match_data);
130 if (_year_part_index > 1)
132 size_t year_start= match_vector[_year_part_index];
133 size_t year_len= match_vector[_year_part_index + 1] - match_vector[_year_part_index];
134 to->_years= atoi(copy_data.substr(year_start, year_len).c_str());
136 to->_years+= (to->_years >= DRIZZLE_YY_PART_YEAR ? 1900 : 2000);
138 if (_month_part_index > 1)
140 size_t month_start= match_vector[_month_part_index];
141 size_t month_len= match_vector[_month_part_index + 1] - match_vector[_month_part_index];
142 to->_months= atoi(copy_data.substr(month_start, month_len).c_str());
144 if (_day_part_index > 1)
146 size_t day_start= match_vector[_day_part_index];
147 size_t day_len= match_vector[_day_part_index + 1] - match_vector[_day_part_index];
148 to->_days= atoi(copy_data.substr(day_start, day_len).c_str());
150 if (_hour_part_index > 1)
152 size_t hour_start= match_vector[_hour_part_index];
153 size_t hour_len= match_vector[_hour_part_index + 1] - match_vector[_hour_part_index];
154 to->_hours= atoi(copy_data.substr(hour_start, hour_len).c_str());
156 if (_minute_part_index > 1)
158 size_t minute_start= match_vector[_minute_part_index];
159 size_t minute_len= match_vector[_minute_part_index + 1] - match_vector[_minute_part_index];
160 to->_minutes= atoi(copy_data.substr(minute_start, minute_len).c_str());
162 if (_second_part_index > 1)
164 size_t second_start= match_vector[_second_part_index];
165 size_t second_len= match_vector[_second_part_index + 1] - match_vector[_second_part_index];
166 to->_seconds= atoi(copy_data.substr(second_start, second_len).c_str());
168 if (_usecond_part_index > 1)
170 size_t usecond_start= match_vector[_usecond_part_index];
171 size_t usecond_len= match_vector[_usecond_part_index + 1] - match_vector[_usecond_part_index];
178 uint32_t multiplier= 1;
179 int32_t x= usecond_len;
185 to->_useconds= atoi(copy_data.substr(usecond_start, usecond_len).c_str()) * multiplier;
187 if (_nsecond_part_index > 1)
189 size_t nsecond_start= match_vector[_nsecond_part_index];
190 size_t nsecond_len= match_vector[_nsecond_part_index + 1] - match_vector[_nsecond_part_index];
197 uint32_t multiplier= 1;
198 int32_t x= nsecond_len;
204 to->_nseconds= atoi(copy_data.substr(nsecond_start, nsecond_len).c_str()) * multiplier;
206 pcre2_match_data_free(match_data);
240 {
"^(\\d{4})(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})\\.(\\d{1,6})$", 1, 2, 3, 4, 5, 6, 7, 0}
241, {
"^(\\d{4})(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})$", 1, 2, 3, 4, 5, 6, 0, 0}
242, {
"^(\\d{4})[-/.](\\d{1,2})[-/.](\\d{1,2})[T|\\s+](\\d{2}):(\\d{2}):(\\d{2})\\.(\\d{1,6})$", 1, 2, 3, 4, 5, 6, 7, 0}
243, {
"^(\\d{4})[-/.](\\d{1,2})[-/.](\\d{1,2})[T|\\s+](\\d{2}):(\\d{2}):(\\d{2})$", 1, 2, 3, 4, 5, 6, 0, 0}
244, {
"^(\\d{2})[-/.](\\d{1,2})[-/.](\\d{1,2})[\\s+](\\d{2}):(\\d{2}):(\\d{2})$", 1, 2, 3, 4, 5, 6, 0, 0}
245, {
"^(\\d{2})[-/.](\\d{1,2})[-/.](\\d{1,2})[\\s+](\\d{2}):(\\d{2})$", 1, 2, 3, 4, 5, 0, 0, 0}
246, {
"^(\\d{4})[-/.](\\d{1,2})[-/.](\\d{1,2})[\\s+](\\d{2}):(\\d{2})$", 1, 2, 3, 4, 5, 0, 0, 0}
247, {
"^(\\d{4})[-/.](\\d{1,2})[-/.](\\d{1,2})$", 1, 2, 3, 0, 0, 0, 0, 0}
248, {
"^(\\d{4})(\\d{2})(\\d{2})$", 1, 2, 3, 0, 0, 0, 0, 0}
249, {
"^(\\d{2})[-/.]*(\\d{2})[-/.]*(\\d{4})$", 3, 1, 2, 0, 0, 0, 0, 0}
250, {
"^(\\d{2})[-/.]*(\\d{2})[-/.]*(\\d{2})$", 1, 2, 3, 0, 0, 0, 0, 0}
251, {
"^(\\d{2})[-/.]*(\\d{1,2})[-/.]*(\\d{1,2})$", 1, 2, 3, 0, 0, 0, 0, 0}
252, {
"^(\\d{4})[-/.]*(\\d{1,2})[-/.]*(\\d{1,2})$", 1, 2, 3, 0, 0, 0, 0, 0}
253, {
"^(\\d{2}):*(\\d{2}):*(\\d{2})\\.(\\d{1,6})$", 0, 0, 0, 1, 2, 3, 4, 0}
254, {
"^(\\d{1,2}):*(\\d{2}):*(\\d{2})$", 0, 0, 0, 1, 2, 3, 0, 0}
255, {
"^(\\d{1,2}):(\\d{1,2}):(\\d{1,2})$", 0, 0, 0, 1, 2, 3, 0, 0}
256, {
"^(\\d{1,2}):*(\\d{2})$", 0, 0, 0, 0, 1, 2, 0, 0}
257, {
"^(\\d{1,2})$", 0, 0, 0, 0, 0, 1, 0, 0}
258, {
"^(\\d{1,2})\\.(\\d{1,6})$", 0, 0, 0, 0, 0, 1, 2, 0}
277 for (int32_t x= 0; x < COUNT_KNOWN_FORMATS; ++x)
294 all_temporal_formats.push_back(tmp);
296 if (current_format_args.year_part_index > 0)
298 known_datetime_formats.push_back(tmp);
299 if (current_format_args.second_part_index == 0)
300 known_date_formats.push_back(tmp);
303 if (current_format_args.second_part_index > 0)
304 known_time_formats.push_back(tmp);