~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/handler/mysql_addons.cc

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:
1
 
/*****************************************************************************
2
 
 
3
 
Copyright (c) 2007, 2009, Innobase Oy. All Rights Reserved.
4
 
 
5
 
This program is free software; you can redistribute it and/or modify it under
6
 
the terms of the GNU General Public License as published by the Free Software
7
 
Foundation; version 2 of the License.
8
 
 
9
 
This program is distributed in the hope that it will be useful, but WITHOUT
10
 
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
 
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
 
 
13
 
You should have received a copy of the GNU General Public License along with
14
 
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15
 
Place, Suite 330, Boston, MA 02111-1307 USA
16
 
 
17
 
*****************************************************************************/
18
 
 
19
 
/**************************************************//**
20
 
@file handler/mysql_addons.cc
21
 
This file contains functions that need to be added to
22
 
MySQL code but have not been added yet.
23
 
 
24
 
Whenever you add a function here submit a MySQL bug
25
 
report (feature request) with the implementation. Then
26
 
write the bug number in the comment before the
27
 
function in this file.
28
 
 
29
 
When MySQL commits the function it can be deleted from
30
 
here. In a perfect world this file exists but is empty.
31
 
 
32
 
Created November 07, 2007 Vasil Dimov
33
 
*******************************************************/
34
 
 
35
 
#ifndef MYSQL_SERVER
36
 
#define MYSQL_SERVER
37
 
#endif /* MYSQL_SERVER */
38
 
 
39
 
#include "config.h"
40
 
 
41
 
#include "mysql_addons.h"
42
 
#include "univ.i"