#At file:///home/mikael/mysql_clones/mysql-6.0-codebase-wl3352/
3657 Mikael Ronstrom 2009-10-30 [merge]
Merge
modified:
sql/sql_partition.cc
=== modified file 'sql/sql_partition.cc'
--- a/sql/sql_partition.cc 2009-10-30 21:12:20 +0000
+++ b/sql/sql_partition.cc 2009-10-30 21:37:32 +0000
@@ -2070,6 +2070,23 @@ static int add_partition_options(File fp
return err + add_engine(fptr,p_elem->engine_type);
}
+
+/*
+ Check partition fields for result type and if they need
+ to check the character set.
+
+ SYNOPSIS
+ check_part_field()
+ sql_type Type provided by user
+ field_name Name of field, used for error handling
+ result_type Out value: Result type of field
+ need_cs_check Out value: Do we need character set check
+
+ RETURN VALUES
+ TRUE Error
+ FALSE Ok
+*/
+
static int check_part_field(enum_field_types sql_type,
const char *field_name,
Item_result *result_type,
@@ -2124,6 +2141,20 @@ error:
return TRUE;
}
+
+/*
+ Find the given field's Create_field object using name of field
+
+ SYNOPSIS
+ get_sql_field()
+ field_name Field name
+ alter_info Info from ALTER TABLE/CREATE TABLE
+
+ RETURN VALUE
+ sql_field Object filled in by parser about field
+ NULL No field found
+*/
+
static Create_field* get_sql_field(char *field_name,
Alter_info *alter_info)
{
@@ -2143,6 +2174,30 @@ static Create_field* get_sql_field(char
DBUG_RETURN(NULL);
}
+
+/*
+ Convert a string in a given character set to a string which can be
+ used for FRM file storage in which case use_hex is TRUE and we store
+ the character constants as hex strings in the character set encoding
+ their field have. In the case of SHOW CREATE TABLE and the
+ PARTITIONS information schema table we instead provide utf8 strings
+ to the user and convert to the utf8 character set.
+
+ SYNOPSIS
+ get_converted_part_value_from_string()
+ item Item from which constant comes
+ res String as provided by val_str after
+ conversion to character set
+ field_cs Character set string is encoded in
+ NULL for INT_RESULT's here
+ val_conv Out value: The string created
+ use_hex TRUE => hex string created
+ FALSE => utf8 constant string created
+ RETURN VALUES
+ TRUE Error
+ FALSE Ok
+*/
+
int get_converted_part_value_from_string(Item *item,
String *res,
CHARSET_INFO *field_cs,
@@ -2155,16 +2210,16 @@ int get_converted_part_value_from_string
const char *ptr;
char buf[3];
- if (!res)
- {
- my_error(ER_PARTITION_FUNCTION_IS_NOT_ALLOWED, MYF(0));
- return 1;
- }
if (item->result_type() == INT_RESULT)
{
longlong value= item->val_int();
val_conv->set(value, system_charset_info);
- return 0;
+ return FALSE;
+ }
+ if (!res)
+ {
+ my_error(ER_PARTITION_FUNCTION_IS_NOT_ALLOWED, MYF(0));
+ return TRUE;
}
val_conv->length(0);
if (!field_cs || res->length() == 0)
@@ -2173,7 +2228,7 @@ int get_converted_part_value_from_string
if (res->length() != 0)
val_conv->append(*res);
val_conv->append("'");
- return 0;
+ return FALSE;
}
if (field_cs && use_hex)
{
@@ -2203,7 +2258,7 @@ int get_converted_part_value_from_string
system_charset_info, &dummy_errors);
append_unescaped(val_conv, val.ptr(), val.length());
}
- return 0;
+ return FALSE;
}
static int add_column_list_values(File fptr, partition_info *part_info,
| Thread |
|---|
| • bzr commit into mysql-6.0-codebase branch (mikael:3657) | Mikael Ronstrom | 30 Oct |