diff options
author | unknown <monty@mysql.com> | 2005-10-12 00:58:22 +0300 |
---|---|---|
committer | unknown <monty@mysql.com> | 2005-10-12 00:58:22 +0300 |
commit | 0ce12f70ed2eee1b92e2af27e7dda30db544f492 (patch) | |
tree | ce0e98ba05247bbe755ac299d0ceaa8c42d63b7a /sql/item_strfunc.cc | |
parent | c2621f3dcb785e5f78734e20dabbd98bff4fd844 (diff) | |
download | mariadb-git-0ce12f70ed2eee1b92e2af27e7dda30db544f492.tar.gz |
Reviewing new pushed code
- CHAR() now returns binary string as default
- CHAR(X*65536+Y*256+Z) is now equal to CHAR(X,Y,Z) independent of the character set for CHAR()
- Test for both ETIMEDOUT and ETIME from pthread_cond_timedwait()
(Some old systems returns ETIME and it's safer to test for both values
than to try to write a wrapper for each old system)
- Fixed new introduced bug in NOT BETWEEN X and X
- Ensure we call commit_by_xid or rollback_by_xid for all engines, even if one engine has failed
- Use octet2hex() for all conversion of string to hex
- Simplify and optimize code
client/mysqldump.c:
Simple optimizations of new code
Indentation fixes
client/mysqltest.c:
Removed not needed variable
include/mysql_com.h:
Made octec2hex() more usable
mysql-test/r/ctype_utf8.result:
CHAR() now returns binary string as default
mysql-test/r/func_str.result:
CHAR() now returns binary string as default
mysql-test/r/range.result:
Added test to verify new introduced bug in NOT BETWEEN X and X
mysql-test/r/user_var-binlog.result:
CHAR() now returns binary string as default
mysql-test/r/view.result:
More tests of view rename
mysql-test/t/ctype_utf8.test:
CHAR() now returns binary string as default
mysql-test/t/func_str.test:
CHAR() now returns binary string as default
mysql-test/t/range.test:
Added test to verify new introduced bug in NOT BETWEEN X and X
mysql-test/t/view.test:
More tests of view rename
mysys/mf_keycache.c:
Indentation changes
Test for both ETIMEDOUT and ETIME from pthread_cond_timedwait()
mysys/my_os2cond.c:
Fix to MySQL coding style
Optimized functions
mysys/thr_lock.c:
Test for both ETIMEDOUT and ETIME from pthread_cond_timedwait()
mysys/thr_mutex.c:
Test for both ETIMEDOUT and ETIME from pthread_cond_timedwait()
server-tools/instance-manager/instance.cc:
Test for both ETIMEDOUT and ETIME from pthread_cond_timedwait()
server-tools/instance-manager/thread_registry.cc:
Test for both ETIMEDOUT and ETIME from pthread_cond_timedwait()
sql/ha_federated.cc:
Use octet2hex()
sql/ha_ndbcluster.cc:
Removed not used variable
sql/handler.cc:
Simplify code
Use *NONE* instead of 'none' for not existing storage engine
Ensure we call commit_by_xid or rollback_by_xid for all engines, even if one engine has failed
sql/item.h:
Remove not needed test for *ref. (If ref is set, it should never point at 0)
sql/item_func.cc:
Test for both ETIMEDOUT and ETIME from pthread_cond_timedwait()
Simplify code
More comments
Require that last argument to find_and_check_access() is given
(Made code shorter and faster)
sql/item_strfunc.cc:
Changed CHAR() to return result in binary collation
CHAR(X*65536+Y*256+Z) is now equal to CHAR(X,Y,Z) independent of the character set for CHAR()
Bar will shortly add the following syntax:
CHAR(.... USING character_set)
and ensure that
CONVERT(CHAR(....) USING utf8) cuts not legal utf8 strings
Use ocet2hex()
sql/item_strfunc.h:
CHAR() now returns a binary string
sql/log_event.cc:
Use octet2hex()
Simplify code
sql/parse_file.cc:
Indentation fixes
Use for() instead of while()
sql/password.c:
Make octet2hex() more generally usable by returning pointer to end 0
sql/slave.cc:
Test for both ETIMEDOUT and ETIME from pthread_cond_timedwait()
sql/sql_base.cc:
Indentation fixes
sql/sql_insert.cc:
Test for both ETIMEDOUT and ETIME from pthread_cond_timedwait()
sql/sql_manager.cc:
Test for both ETIMEDOUT and ETIME from pthread_cond_timedwait()
sql/sql_parse.cc:
Don't check thd->db when checking for function privileges
sql/sql_prepare.cc:
Fixed wrong merge
sql/sql_select.cc:
Fixed new bug for NOT BETWEEN X and X
sql/sql_show.cc:
Removed not used variable
sql/sql_table.cc:
Indentation fixed
Removed DBUG_PRINT that is obvious from context
sql/sql_view.cc:
Simplify code
sql/unireg.cc:
Use octet2hex()
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r-- | sql/item_strfunc.cc | 42 |
1 files changed, 15 insertions, 27 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 018afac3812..1812256d532 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -1964,21 +1964,16 @@ String *Item_func_char::val_str(String *str) int32 num=(int32) args[i]->val_int(); if (!args[i]->null_value) { -#ifdef USE_MB - if (use_mb(collation.collation)) - { - if (num&0xFF000000L) { - str->append((char)(num>>24)); - goto b2; - } else if (num&0xFF0000L) { -b2: str->append((char)(num>>16)); - goto b1; - } else if (num&0xFF00L) { -b1: str->append((char)(num>>8)); - } + if (num&0xFF000000L) { + str->append((char)(num>>24)); + goto b2; + } else if (num&0xFF0000L) { + b2: str->append((char)(num>>16)); + goto b1; + } else if (num&0xFF00L) { + b1: str->append((char)(num>>8)); } -#endif - str->append((char)num); + str->append((char) num); } } str->set_charset(collation.collation); @@ -1997,7 +1992,7 @@ b1: str->append((char)(num>>8)); enum MYSQL_ERROR::enum_warning_level level; uint diff= str->length() - wlen; set_if_smaller(diff, 3); - octet2hex(hexbuf, (const uchar*) str->ptr() + wlen, diff); + octet2hex(hexbuf, str->ptr() + wlen, diff); if (thd->variables.sql_mode & (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES)) { @@ -2436,6 +2431,7 @@ String *Item_func_collation::val_str(String *str) String *Item_func_hex::val_str(String *str) { + String *res; DBUG_ASSERT(fixed == 1); if (args[0]->result_type() != STRING_RESULT) { @@ -2464,24 +2460,16 @@ String *Item_func_hex::val_str(String *str) } /* Convert given string to a hex string, character by character */ - String *res= args[0]->val_str(str); - const char *from, *end; - char *to; - if (!res || tmp_value.alloc(res->length()*2)) + res= args[0]->val_str(str); + if (!res || tmp_value.alloc(res->length()*2+1)) { null_value=1; return 0; } null_value=0; tmp_value.length(res->length()*2); - for (from=res->ptr(), end=from+res->length(), to= (char*) tmp_value.ptr(); - from < end ; - from++, to+=2) - { - uint tmp=(uint) (uchar) *from; - to[0]=_dig_vec_upper[tmp >> 4]; - to[1]=_dig_vec_upper[tmp & 15]; - } + + octet2hex((char*) tmp_value.ptr(), res->ptr(), res->length()); return &tmp_value; } |