summaryrefslogtreecommitdiff
path: root/sql/field.cc
diff options
context:
space:
mode:
authormalff/marcsql@weblab.(none) <>2007-06-11 15:57:59 -0600
committermalff/marcsql@weblab.(none) <>2007-06-11 15:57:59 -0600
commite6f9d712aa1f167ffc38c6b6102daad6ae20c5f9 (patch)
tree727483fa8379480249287861113bba713dc46a69 /sql/field.cc
parentee116570dc44bdb95a95fc04b27dfb1171ec85d7 (diff)
parent041c7797a9e2ba7d17ff6da15bfc452fd8ab5324 (diff)
downloadmariadb-git-e6f9d712aa1f167ffc38c6b6102daad6ae20c5f9.tar.gz
Merge weblab.(none):/home/marcsql/TREE/mysql-5.1-base
into weblab.(none):/home/marcsql/TREE/mysql-5.1-rt-merge
Diffstat (limited to 'sql/field.cc')
-rw-r--r--sql/field.cc60
1 files changed, 32 insertions, 28 deletions
diff --git a/sql/field.cc b/sql/field.cc
index 82fe63ea78a..9f412e99223 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -38,8 +38,8 @@
*****************************************************************************/
#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
-template class List<create_field>;
-template class List_iterator<create_field>;
+template class List<Create_field>;
+template class List_iterator<Create_field>;
#endif
uchar Field_null::null[1]={1};
@@ -2631,7 +2631,7 @@ void Field_new_decimal::sql_type(String &str) const
}
-uint Field_new_decimal::is_equal(create_field *new_field)
+uint Field_new_decimal::is_equal(Create_field *new_field)
{
return ((new_field->sql_type == real_type()) &&
((new_field->flags & UNSIGNED_FLAG) ==
@@ -4366,7 +4366,7 @@ Field_timestamp::Field_timestamp(uchar *ptr_arg, uint32 len_arg,
const char *field_name_arg,
TABLE_SHARE *share,
CHARSET_INFO *cs)
- :Field_str(ptr_arg, 19, null_ptr_arg, null_bit_arg,
+ :Field_str(ptr_arg, MAX_DATETIME_WIDTH, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg, cs)
{
/* For 4.0 MYD and 4.0 InnoDB compatibility */
@@ -4383,7 +4383,8 @@ Field_timestamp::Field_timestamp(uchar *ptr_arg, uint32 len_arg,
Field_timestamp::Field_timestamp(bool maybe_null_arg,
const char *field_name_arg,
CHARSET_INFO *cs)
- :Field_str((uchar*) 0, 19, maybe_null_arg ? (uchar*) "": 0, 0,
+ :Field_str((uchar*) 0, MAX_DATETIME_WIDTH,
+ maybe_null_arg ? (uchar*) "": 0, 0,
NONE, field_name_arg, cs)
{
/* For 4.0 MYD and 4.0 InnoDB compatibility */
@@ -4916,7 +4917,7 @@ String *Field_time::val_str(String *val_buffer,
{
ASSERT_COLUMN_MARKED_FOR_READ;
MYSQL_TIME ltime;
- val_buffer->alloc(19);
+ val_buffer->alloc(MAX_DATE_STRING_REP_LENGTH);
long tmp=(long) sint3korr(ptr);
ltime.neg= 0;
if (tmp < 0)
@@ -5464,7 +5465,7 @@ int Field_newdate::store_time(MYSQL_TIME *ltime,timestamp_type time_type)
(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
MODE_INVALID_DATES))), &error))
{
- char buff[12];
+ char buff[MAX_DATE_STRING_REP_LENGTH];
String str(buff, sizeof(buff), &my_charset_latin1);
make_date((DATE_TIME_FORMAT *) 0, ltime, &str);
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED,
@@ -5695,7 +5696,7 @@ int Field_datetime::store_time(MYSQL_TIME *ltime,timestamp_type time_type)
(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
MODE_INVALID_DATES))), &error))
{
- char buff[19];
+ char buff[MAX_DATE_STRING_REP_LENGTH];
String str(buff, sizeof(buff), &my_charset_latin1);
make_datetime((DATE_TIME_FORMAT *) 0, ltime, &str);
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED,
@@ -5771,7 +5772,7 @@ String *Field_datetime::val_str(String *val_buffer,
part1=(long) (tmp/LL(1000000));
part2=(long) (tmp - (ulonglong) part1*LL(1000000));
- pos=(char*) val_buffer->ptr()+19;
+ pos=(char*) val_buffer->ptr() + MAX_DATETIME_WIDTH;
*pos--=0;
*pos--= (char) ('0'+(char) (part2%10)); part2/=10;
*pos--= (char) ('0'+(char) (part2%10)); part3= (int) (part2 / 10);
@@ -6069,7 +6070,7 @@ int Field_str::store(double nr)
}
-uint Field::is_equal(create_field *new_field)
+uint Field::is_equal(Create_field *new_field)
{
return (new_field->sql_type == real_type());
}
@@ -6077,7 +6078,7 @@ uint Field::is_equal(create_field *new_field)
/* If one of the fields is binary and the other one isn't return 1 else 0 */
-bool Field_str::compare_str_field_flags(create_field *new_field, uint32 flags)
+bool Field_str::compare_str_field_flags(Create_field *new_field, uint32 flags)
{
return (((new_field->flags & (BINCMP_FLAG | BINARY_FLAG)) &&
!(flags & (BINCMP_FLAG | BINARY_FLAG))) ||
@@ -6086,7 +6087,7 @@ bool Field_str::compare_str_field_flags(create_field *new_field, uint32 flags)
}
-uint Field_str::is_equal(create_field *new_field)
+uint Field_str::is_equal(Create_field *new_field)
{
if (compare_str_field_flags(new_field, flags))
return 0;
@@ -6938,7 +6939,7 @@ Field *Field_varstring::new_key_field(MEM_ROOT *root,
}
-uint Field_varstring::is_equal(create_field *new_field)
+uint Field_varstring::is_equal(Create_field *new_field)
{
if (new_field->sql_type == real_type() &&
new_field->charset == field_charset)
@@ -7620,7 +7621,7 @@ uint Field_blob::max_packed_col_length(uint max_length)
}
-uint Field_blob::is_equal(create_field *new_field)
+uint Field_blob::is_equal(Create_field *new_field)
{
if (compare_str_field_flags(new_field, flags))
return 0;
@@ -8158,7 +8159,7 @@ bool Field_num::eq_def(Field *field)
}
-uint Field_num::is_equal(create_field *new_field)
+uint Field_num::is_equal(Create_field *new_field)
{
return ((new_field->sql_type == real_type()) &&
((new_field->flags & UNSIGNED_FLAG) == (uint) (flags &
@@ -8594,20 +8595,20 @@ void Field_bit_as_char::sql_type(String &res) const
/*****************************************************************************
- Handling of field and create_field
+ Handling of field and Create_field
*****************************************************************************/
/*
- Convert create_field::length from number of characters to number of bytes
+ Convert Create_field::length from number of characters to number of bytes
SYNOPSIS
- create_field::create_length_to_internal_length()
+ Create_field::create_length_to_internal_length()
DESCRIPTION
- Convert create_field::length from number of characters to number of bytes.
+ Convert Create_field::length from number of characters to number of bytes.
*/
-void create_field::create_length_to_internal_length(void)
+void Create_field::create_length_to_internal_length(void)
{
switch (sql_type) {
case MYSQL_TYPE_TINY_BLOB:
@@ -8654,7 +8655,7 @@ void create_field::create_length_to_internal_length(void)
}
-void create_field::init_for_tmp_table(enum_field_types sql_type_arg,
+void Create_field::init_for_tmp_table(enum_field_types sql_type_arg,
uint32 length_arg, uint32 decimals_arg,
bool maybe_null, bool is_unsigned)
{
@@ -8695,7 +8696,7 @@ void create_field::init_for_tmp_table(enum_field_types sql_type_arg,
TRUE on error
*/
-bool create_field::init(THD *thd, char *fld_name, enum_field_types fld_type,
+bool Create_field::init(THD *thd, char *fld_name, enum_field_types fld_type,
char *fld_length, char *fld_decimals,
uint fld_type_modifier, Item *fld_default_value,
Item *fld_on_update_value, LEX_STRING *fld_comment,
@@ -8705,7 +8706,7 @@ bool create_field::init(THD *thd, char *fld_name, enum_field_types fld_type,
uint sign_len, allowed_type_modifier= 0;
ulong max_field_charlength= MAX_FIELD_CHARLENGTH;
- DBUG_ENTER("create_field::init()");
+ DBUG_ENTER("Create_field::init()");
field= 0;
field_name= fld_name;
@@ -8889,15 +8890,18 @@ bool create_field::init(THD *thd, char *fld_name, enum_field_types fld_type,
break;
case MYSQL_TYPE_TIMESTAMP:
if (!fld_length)
- length= 14; /* Full date YYYYMMDDHHMMSS */
- else if (length != 19)
+ {
+ /* Compressed date YYYYMMDDHHMMSS */
+ length= MAX_DATETIME_COMPRESSED_WIDTH;
+ }
+ else if (length != MAX_DATETIME_WIDTH)
{
/*
We support only even TIMESTAMP lengths less or equal than 14
and 19 as length of 4.1 compatible representation.
*/
length= ((length+1)/2)*2; /* purecov: inspected */
- length= min(length,14); /* purecov: inspected */
+ length= min(length, MAX_DATETIME_COMPRESSED_WIDTH); /* purecov: inspected */
}
flags|= ZEROFILL_FLAG | UNSIGNED_FLAG;
if (fld_default_value)
@@ -8950,7 +8954,7 @@ bool create_field::init(THD *thd, char *fld_name, enum_field_types fld_type,
length= 10;
break;
case MYSQL_TYPE_DATETIME:
- length= 19;
+ length= MAX_DATETIME_WIDTH;
break;
case MYSQL_TYPE_SET:
{
@@ -9278,7 +9282,7 @@ Field *make_field(TABLE_SHARE *share, uchar *ptr, uint32 field_length,
/* Create a field suitable for create of table */
-create_field::create_field(Field *old_field,Field *orig_field)
+Create_field::Create_field(Field *old_field,Field *orig_field)
{
field= old_field;
field_name=change=old_field->field_name;