~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/temporal_format.cc

  • Committer: Tim Penhey
  • Date: 2010-02-11 00:28:04 UTC
  • mfrom: (1271.6.2 unify_error)
  • mto: This revision was merged to the branch mainline in revision 1348.
  • Revision ID: tim@penhey.net-20100211002804-l37rv3exdak25taw
Merge prev pipe and resolve conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
#include "drizzled/temporal_format.h"
34
34
#include "drizzled/temporal.h"
35
35
 
36
 
#include <string> /** C++ string class used */
37
36
#include <string.h>
 
37
#include PCRE_HEADER
 
38
 
 
39
#include <string>
38
40
#include <vector>
39
 
#include PCRE_HEADER
 
41
 
 
42
using namespace std;
40
43
 
41
44
namespace drizzled
42
45
{
108
111
    return false;
109
112
 
110
113
  /* C++ string class easy to use substr() method is very useful here */
111
 
  std::string copy_data(data, data_len);
 
114
  string copy_data(data, data_len);
112
115
  /* 
113
116
   * OK, we have the expected substring matches, so grab
114
117
   * the various temporal parts from the subject string
197
200
  return true;
198
201
}
199
202
 
200
 
} /* end namespace drizzled */
201
203
 
202
204
#define COUNT_KNOWN_FORMATS 19
203
205
 
249
251
, {"^(\\d{1,2})\\.(\\d{1,6})$", 0, 0, 0, 0, 0, 1, 2, 0} /* [S]S.uuuuuu */
250
252
};
251
253
 
252
 
std::vector<drizzled::TemporalFormat *> known_datetime_formats;
253
 
std::vector<drizzled::TemporalFormat *> known_date_formats;
254
 
std::vector<drizzled::TemporalFormat *> known_time_formats;
255
 
std::vector<drizzled::TemporalFormat *> all_temporal_formats;
 
254
vector<TemporalFormat *> known_datetime_formats;
 
255
vector<TemporalFormat *> known_date_formats;
 
256
vector<TemporalFormat *> known_time_formats;
 
257
vector<TemporalFormat *> all_temporal_formats;
256
258
 
257
259
/**
258
260
 * We allocate and initialize all known date/time formats.
262
264
bool init_temporal_formats()
263
265
{
264
266
  /* Compile all the regular expressions for the datetime formats */
265
 
  drizzled::TemporalFormat *tmp;
 
267
  TemporalFormat *tmp;
266
268
  struct temporal_format_args current_format_args;
267
269
  int32_t x;
268
270
  
269
271
  for (x= 0; x<COUNT_KNOWN_FORMATS; ++x)
270
272
  {
271
273
    current_format_args= __format_args[x];
272
 
    tmp= new drizzled::TemporalFormat(current_format_args.pattern);
 
274
    tmp= new TemporalFormat(current_format_args.pattern);
273
275
    tmp->set_year_part_index(current_format_args.year_part_index);
274
276
    tmp->set_month_part_index(current_format_args.month_part_index);
275
277
    tmp->set_day_part_index(current_format_args.day_part_index);
301
303
/** Free all allocated temporal formats */
302
304
void deinit_temporal_formats()
303
305
{
304
 
  std::vector<drizzled::TemporalFormat *>::iterator p= all_temporal_formats.begin();
 
306
  vector<TemporalFormat *>::iterator p= all_temporal_formats.begin();
305
307
  while (p != all_temporal_formats.end())
306
308
  {
307
309
    delete *p;
312
314
  known_time_formats.clear();
313
315
  all_temporal_formats.clear();
314
316
}
 
317
 
 
318
} /* end namespace drizzled */