diff options
author | unknown <monty@mysql.com> | 2004-07-09 10:55:16 +0300 |
---|---|---|
committer | unknown <monty@mysql.com> | 2004-07-09 10:55:16 +0300 |
commit | b42209774aa80452bee797238fbe9bd4006fffce (patch) | |
tree | 7e2ff70f1febc7a09674e0680a73d7c941c2a9ff /sql/item_strfunc.cc | |
parent | 53ca595451d53fccd60b1112c444e5278021c1ee (diff) | |
download | mariadb-git-b42209774aa80452bee797238fbe9bd4006fffce.tar.gz |
Cleanup of db option cacheing
Some bug fixes to last pushed code
mysql-test/mysql-test-run.sh:
Fix for new valgrind (2.1.1)
mysql-test/r/bdb.result:
Updated results
mysql-test/t/ps_1general.test:
removed wrong error condition
sql/ha_berkeley.cc:
Fix for index_flags() in new code
sql/item_strfunc.cc:
Cleanup (fixed indentation, removed short variable names)
sql/mysql_priv.h:
Cleanup of db option cacheing
sql/mysqld.cc:
Cleanup of db option cacheing
sql/sql_db.cc:
Cleanup of db option cacheing
sql/sql_parse.cc:
Cleanup of db option cacheing
sql/sql_table.cc:
sprintf -> strxmov
sql/table.cc:
key_read should be tested on key parts, not the whole key
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r-- | sql/item_strfunc.cc | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index b5b08a04f88..a8805be7854 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -2294,43 +2294,49 @@ inline int hexchar_to_int(char c) return -1; } + + /* Convert given hex string to a binary string */ + String *Item_func_unhex::val_str(String *str) { + const char *from, *end; + char *to; + String *res; + uint length; DBUG_ASSERT(fixed == 1); - /* Convert given hex string to a binary string */ - String *res= args[0]->val_str(str); - if (!res || tmp_value.alloc((1+res->length())/2)) + res= args[0]->val_str(str); + if (!res || tmp_value.alloc(length= (1+res->length())/2)) { null_value=1; return 0; } - const char *from=res->ptr(), *end; - char *to; - int r; - - null_value=0; - tmp_value.length((1+res->length())/2); + from= res->ptr(); + null_value= 0; + tmp_value.length(length); to= (char*) tmp_value.ptr(); if (res->length() % 2) { - *to++= r= hexchar_to_int(*from++); - if ((null_value= (r == -1))) + int hex_char; + *to++= hex_char= hexchar_to_int(*from++); + if ((null_value= (hex_char == -1))) return 0; } for (end=res->ptr()+res->length(); from < end ; from+=2, to++) { - *to= (r= hexchar_to_int(from[0])) << 4; - if ((null_value= (r == -1))) + int hex_char; + *to= (hex_char= hexchar_to_int(from[0])) << 4; + if ((null_value= (hex_char == -1))) return 0; - *to|= r= hexchar_to_int(from[1]); - if ((null_value= (r == -1))) + *to|= hex_char= hexchar_to_int(from[1]); + if ((null_value= (hex_char == -1))) return 0; } return &tmp_value; } + void Item_func_binary::print(String *str) { str->append("cast(", 5); |