summaryrefslogtreecommitdiff
path: root/sql/item.h
diff options
context:
space:
mode:
authorunknown <mikael/pappa@dator5.(none)>2006-09-27 06:49:25 -0400
committerunknown <mikael/pappa@dator5.(none)>2006-09-27 06:49:25 -0400
commit51b1ec1f44924d8ac6385d306ee9090575fe2386 (patch)
tree09d0a3dc67c7bf8fb68eca41ad818b5bd26bb5cf /sql/item.h
parent5529b7fb959e1d01b3699f0c347bb5e97becdc65 (diff)
parent288da1d759874293fdfdb06f15194b826d7dadb4 (diff)
downloadmariadb-git-51b1ec1f44924d8ac6385d306ee9090575fe2386.tar.gz
Merge dator5.(none):/home/pappa/clean-mysql-5.1
into dator5.(none):/home/pappa/bug18198 sql/item.h: Auto merged
Diffstat (limited to 'sql/item.h')
-rw-r--r--sql/item.h59
1 files changed, 37 insertions, 22 deletions
diff --git a/sql/item.h b/sql/item.h
index 3dd7d3d220e..1f5324f33be 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -831,7 +831,7 @@ public:
Check if a partition function is allowed
SYNOPSIS
check_partition_func_processor()
- bool_arg Return argument
+ int_arg Return argument
RETURN VALUE
0
DESCRIPTION
@@ -847,9 +847,31 @@ public:
allowed in a partition function then it is very important to consider
whether this should be inherited to the new class. If not the function
below should be defined in the new Item class.
- */
- virtual bool check_partition_func_processor(byte *bool_arg)
- { *(bool *)bool_arg= FALSE; return 0; }
+
+ The general behaviour is that most integer functions are allowed.
+ If the partition function contains any multi-byte collations then
+ the function check_part_func_fields will report an error on the
+ partition function independent of what functions are used. So the
+ only character sets allowed are single character collation and
+ even for those only a limited set of functions are allowed. The
+ problem with multi-byte collations is that almost every string
+ function has the ability to change things such that two strings
+ that are equal will not be equal after manipulated by a string
+ function. E.g. two strings one contains a double s, there is a
+ special german character that is equal to two s. Now assume a
+ string function removes one character at this place, then in
+ one the double s will be removed and in the other there will
+ still be one s remaining and the strings are no longer equal
+ and thus the partition function will not sort equal strings into
+ the same partitions.
+
+ So the check if a partition function is valid is two steps. First
+ check that the field types are valid, next check that the partition
+ function is valid. The current set of partition functions valid
+ assumes that there are no multi-byte collations amongst the partition
+ fields.
+ */
+ virtual bool check_partition_func_processor(byte *bool_arg) { return TRUE;}
virtual bool subst_argument_checker(byte **arg)
{
if (*arg)
@@ -1147,7 +1169,6 @@ public:
Item::maybe_null= TRUE;
}
- bool check_partition_func_processor(byte *bool_arg) { return 0; }
bool fix_fields(THD *, Item **);
enum Type type() const;
@@ -1193,7 +1214,7 @@ public:
Item_num() {} /* Remove gcc warning */
virtual Item_num *neg()= 0;
Item *safe_charset_converter(CHARSET_INFO *tocs);
- bool check_partition_func_processor(byte *bool_arg) { return 0;}
+ bool check_partition_func_processor(byte *int_arg) { return FALSE;}
};
#define NO_CACHED_FIELD_INDEX ((uint)(-1))
@@ -1351,7 +1372,7 @@ public:
bool collect_item_field_processor(byte * arg);
bool find_item_in_field_list_processor(byte *arg);
bool register_field_in_read_map(byte *arg);
- bool check_partition_func_processor(byte *bool_arg) { return 0; }
+ bool check_partition_func_processor(byte *int_arg) {return FALSE;}
void cleanup();
bool result_as_longlong()
{
@@ -1400,7 +1421,7 @@ public:
bool is_null() { return 1; }
void print(String *str) { str->append(STRING_WITH_LEN("NULL")); }
Item *safe_charset_converter(CHARSET_INFO *tocs);
- bool check_partition_func_processor(byte *bool_arg) { return 0;}
+ bool check_partition_func_processor(byte *int_arg) {return FALSE;}
};
class Item_null_result :public Item_null
@@ -1413,8 +1434,7 @@ public:
{
save_in_field(result_field, no_conversions);
}
- bool check_partition_func_processor(byte *bool_arg)
- { *(bool *)bool_arg= FALSE; return 0; }
+ bool check_partition_func_processor(byte *int_arg) {return TRUE;}
};
/* Item represents one placeholder ('?') of prepared statement */
@@ -1705,8 +1725,7 @@ public:
{}
void print(String *str) { str->append(func_name); }
Item *safe_charset_converter(CHARSET_INFO *tocs);
- bool check_partition_func_processor(byte *bool_arg)
- { *(bool *)bool_arg= FALSE; return 0; }
+ bool check_partition_func_processor(byte *int_arg) {return TRUE;}
};
@@ -1784,7 +1803,7 @@ public:
void print(String *str);
// to prevent drop fixed flag (no need parent cleanup call)
void cleanup() {}
- bool check_partition_func_processor(byte *bool_arg) { return 0;}
+ bool check_partition_func_processor(byte *int_arg) {return FALSE;}
};
@@ -1799,8 +1818,7 @@ public:
{}
Item *safe_charset_converter(CHARSET_INFO *tocs);
void print(String *str) { str->append(func_name); }
- bool check_partition_func_processor(byte *bool_arg)
- { *(bool *)bool_arg= FALSE; return 0; }
+ bool check_partition_func_processor(byte *int_arg) {return TRUE;}
};
@@ -1813,8 +1831,7 @@ public:
&my_charset_bin)
{ max_length=19;}
enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; }
- bool check_partition_func_processor(byte *bool_arg)
- { *(bool *)bool_arg= FALSE; return 0; }
+ bool check_partition_func_processor(byte *int_arg) {return TRUE;}
};
class Item_empty_string :public Item_string
@@ -1837,8 +1854,7 @@ public:
unsigned_flag=1;
}
enum_field_types field_type() const { return int_field_type; }
- bool check_partition_func_processor(byte *bool_arg)
- { *(bool *)bool_arg= FALSE; return 0; }
+ bool check_partition_func_processor(byte *int_arg) {return TRUE;}
};
@@ -1862,7 +1878,7 @@ public:
void cleanup() {}
bool eq(const Item *item, bool binary_cmp) const;
virtual Item *safe_charset_converter(CHARSET_INFO *tocs);
- bool check_partition_func_processor(byte *bool_arg) { return 0;}
+ bool check_partition_func_processor(byte *int_arg) {return FALSE;}
};
@@ -2089,8 +2105,7 @@ public:
}
Item *new_item();
virtual Item *real_item() { return ref; }
- bool check_partition_func_processor(byte *bool_arg)
- { *(bool *)bool_arg= FALSE; return 0; }
+ bool check_partition_func_processor(byte *int_arg) {return TRUE;}
};
#ifdef MYSQL_SERVER