diff options
author | unknown <monty@mysql.com> | 2005-08-09 00:15:27 +0300 |
---|---|---|
committer | unknown <monty@mysql.com> | 2005-08-09 00:15:27 +0300 |
commit | e6ed39b405fdbb6a83c587b7b79d5725e37ede8d (patch) | |
tree | 162d514778eba7d21acf4a9243606b912b2fb922 /sql | |
parent | 97988099eb39c580b391c51cdaf7ff33c9f20a64 (diff) | |
parent | b10670142c8f503b40f18aae736ac6bc53c75e4b (diff) | |
download | mariadb-git-e6ed39b405fdbb6a83c587b7b79d5725e37ede8d.tar.gz |
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/my/mysql-4.1
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item.cc | 12 | ||||
-rw-r--r-- | sql/item_strfunc.cc | 16 |
2 files changed, 22 insertions, 6 deletions
diff --git a/sql/item.cc b/sql/item.cc index 84dbc382a52..b3d2932acf6 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -455,14 +455,18 @@ bool DTCollation::aggregate(DTCollation &dt, uint flags) ; // Do nothing } else if ((flags & MY_COLL_ALLOW_SUPERSET_CONV) && - derivation < dt.derivation && - collation->state & MY_CS_UNICODE) + collation->state & MY_CS_UNICODE && + (derivation < dt.derivation || + (derivation == dt.derivation && + !(dt.collation->state & MY_CS_UNICODE)))) { // Do nothing } else if ((flags & MY_COLL_ALLOW_SUPERSET_CONV) && - dt.derivation < derivation && - dt.collation->state & MY_CS_UNICODE) + dt.collation->state & MY_CS_UNICODE && + (dt.derivation < derivation || + (dt.derivation == derivation && + !(collation->state & MY_CS_UNICODE)))) { set(dt); } diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index d316c7eaf72..52a2dedb67c 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -42,7 +42,7 @@ static void my_coll_agg_error(DTCollation &c1, DTCollation &c2, const char *fname) { my_error(ER_CANT_AGGREGATE_2COLLATIONS,MYF(0), - c1.collation->name,c1.derivation_name(), + c1.collation->name,c1.derivation_name(), c2.collation->name,c2.derivation_name(), fname); } @@ -1188,10 +1188,22 @@ String *Item_func_substr_index::val_str(String *str) } else { // Start counting at end - for (offset=res->length() ; ; offset-=delimeter_length-1) + /* + Negative index, start counting at the end + */ + for (offset=res->length(); offset ;) { + /* + this call will result in finding the position pointing to one + address space less than where the found substring is located + in res + */ if ((int) (offset=res->strrstr(*delimeter,offset)) < 0) return res; // Didn't find, return org string + /* + At this point, we've searched for the substring + the number of times as supplied by the index value + */ if (!++count) { offset+=delimeter_length; |