158
159
size_t usecond_start= _match_vector[_usecond_part_index];
159
160
size_t usecond_len= _match_vector[_usecond_part_index + 1] - _match_vector[_usecond_part_index];
160
to->_useconds= atoi(copy_data.substr(usecond_start, usecond_len).c_str());
162
* For microseconds, which are millionth of 1 second,
163
* we must ensure that we produce a correct result,
164
* even if < 6 places were specified. For instance, if we get .1,
165
* we must produce 100000. .11 should produce 110000, etc.
167
uint32_t multiplier= 1;
168
int32_t x= usecond_len;
174
to->_useconds= atoi(copy_data.substr(usecond_start, usecond_len).c_str()) * multiplier;
162
176
if (_nsecond_part_index > 1)
164
178
size_t nsecond_start= _match_vector[_nsecond_part_index];
165
179
size_t nsecond_len= _match_vector[_nsecond_part_index + 1] - _match_vector[_nsecond_part_index];
166
to->_nseconds= atoi(copy_data.substr(nsecond_start, nsecond_len).c_str());
181
* For nanoseconds, which are 1 billionth of a second,
182
* we must ensure that we produce a correct result,
183
* even if < 9 places were specified. For instance, if we get .1,
184
* we must produce 100000000. .11 should produce 110000000, etc.
186
uint32_t multiplier= 1;
187
int32_t x= nsecond_len;
193
to->_nseconds= atoi(copy_data.substr(nsecond_start, nsecond_len).c_str()) * multiplier;
171
198
} /* end namespace drizzled */
173
#define COUNT_KNOWN_FORMATS 13
200
#define COUNT_KNOWN_FORMATS 14
175
202
struct temporal_format_args
200
227
static struct temporal_format_args __format_args[COUNT_KNOWN_FORMATS]=
202
{"^(\\d{4})(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})\\.(\\d{6})$", 1, 2, 3, 4, 5, 6, 7, 0} /* YYYYMMDDHHmmSS.uuuuuu */
229
{"^(\\d{4})(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})\\.(\\d{1,6})$", 1, 2, 3, 4, 5, 6, 7, 0} /* YYYYMMDDHHmmSS.uuuuuu */
203
230
, {"^(\\d{4})(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})$", 1, 2, 3, 4, 5, 6, 0, 0} /* YYYYMMDDHHmmSS */
204
, {"^(\\d{4})[-/.](\\d{1,2})[-/.](\\d{1,2})[T|\\s+](\\d{2}):(\\d{2}):(\\d{2})\\.(\\d{6})$", 1, 2, 3, 4, 5, 6, 7, 0} /* YYYY[/-.]MM[/-.]DD[T]HH:mm:SS.uuuuuu */
231
, {"^(\\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} /* YYYY[/-.]MM[/-.]DD[T]HH:mm:SS.uuuuuu */
205
232
, {"^(\\d{4})[-/.](\\d{1,2})[-/.](\\d{1,2})[T|\\s+](\\d{2}):(\\d{2}):(\\d{2})$", 1, 2, 3, 4, 5, 6, 0, 0} /* YYYY[/-.]MM[/-.]DD[T]HH:mm:SS */
206
233
, {"^(\\d{4})[-/.](\\d{1,2})[-/.](\\d{1,2})$", 1, 2, 3, 0, 0, 0, 0, 0} /* YYYY-MM-DD, YYYY.MM.DD, YYYY/MM/DD */
207
234
, {"^(\\d{4})(\\d{2})(\\d{2})$", 1, 2, 3, 0, 0, 0, 0, 0} /* YYYYMMDD */
208
235
, {"^(\\d{2})[-/.]*(\\d{2})[-/.]*(\\d{4})$", 3, 1, 2, 0, 0, 0, 0, 0} /* MM[-/.]DD[-/.]YYYY (US common format)*/
209
236
, {"^(\\d{2})[-/.]*(\\d{2})[-/.]*(\\d{2})$", 1, 2, 3, 0, 0, 0, 0, 0} /* YY[-/.]MM[-/.]DD */
210
237
, {"^(\\d{2})[-/.]*(\\d{1,2})[-/.]*(\\d{1,2})$", 1, 2, 3, 0, 0, 0, 0, 0} /* YY[-/.][M]M[-/.][D]D */
211
, {"^(\\d{2}):*(\\d{2}):*(\\d{2})\\.(\\d{6})$", 0, 0, 0, 1, 2, 3, 4, 0} /* HHmmSS.uuuuuu, HH:mm:SS.uuuuuu */
238
, {"^(\\d{2}):*(\\d{2}):*(\\d{2})\\.(\\d{1,6})$", 0, 0, 0, 1, 2, 3, 4, 0} /* HHmmSS.uuuuuu, HH:mm:SS.uuuuuu */
212
239
, {"^(\\d{1,2}):*(\\d{2}):*(\\d{2})$", 0, 0, 0, 1, 2, 3, 0, 0} /* [H]HmmSS, [H]H:mm:SS */
213
240
, {"^(\\d{1,2}):*(\\d{2})$", 0, 0, 0, 0, 1, 2, 0, 0} /* [m]mSS, [m]m:SS */
214
241
, {"^(\\d{1,2})$", 0, 0, 0, 0, 0, 1, 0, 0} /* SS, S */
242
, {"^(\\d{1,2})\\.(\\d{1,6})$", 0, 0, 0, 0, 0, 1, 2, 0} /* [S]S.uuuuuu */
217
245
std::vector<drizzled::TemporalFormat*> known_datetime_formats;