~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/discrete_interval.h

Replace MAX_(DATE|TIME).*_WIDTH defines in definitions.h with real (and correct) static const members to Temporal types.

This fixes the buffer overflow in https://bugs.launchpad.net/drizzle/+bug/373468

It also removes a handwritten snprintf in field/datetime.cc
However... this caused us to have to change Temporal to have a way to not
"convert" the int64_t value (so 20090101 becomes 20090101000000 etc) as it
has already been converted and we just want the Temporal type to do the
to_string conversion.

This still causes a failure in 'metadata' test due to size of timestamp type. I need feedback from Jay on when the usecond code comes into play to know the correct fix for this.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 */
19
19
 
20
20
 
21
 
#ifndef DRIZZLED_DISCRETE_INTERVAL_H
22
 
#define DRIZZLED_DISCRETE_INTERVAL_H
23
 
 
24
 
#include <cstdlib>
25
 
 
26
 
#include "drizzled/definitions.h"
27
 
 
28
 
namespace drizzled
29
 
{
 
21
#ifndef DRIZZLED_DISCRETE_INTERVALS_H
 
22
#define DRIZZLED_DISCRETE_INTERVALS_H
30
23
 
31
24
/*
32
25
  Such interval is "discrete": it is the set of
34
27
    0 <= k <= (auto_inc_interval_values-1) }
35
28
  Where "increment" is maintained separately by the user of this class (and is
36
29
  currently only session->variables.auto_increment_increment).
37
 
  It mustn't derive from memory::SqlAlloc, because SET INSERT_ID needs to
 
30
  It mustn't derive from Sql_alloc, because SET INSERT_ID needs to
38
31
  allocate memory which must stay allocated for use by the next statement.
39
32
*/
40
33
class Discrete_interval {
182
175
 
183
176
};
184
177
 
185
 
} /* namespace drizzled */
186
 
 
187
 
#endif /* DRIZZLED_DISCRETE_INTERVAL_H */
 
178
#endif /* DRIZZLED_DISCRETE_INTERVALS_H */