summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <ingo@mysql.com>2004-03-19 15:02:26 +0100
committerunknown <ingo@mysql.com>2004-03-19 15:02:26 +0100
commit85c7ce36879f0dfc68e26a13b384dc48d79d8100 (patch)
tree7949740f89abf4c0263d7fb7746a727c89459a0d /sql
parent5b540f0555f556009fd64e4bb48147435785cc25 (diff)
parent1653cdde1900af87a2b43f52c4889c8885ba2e2b (diff)
downloadmariadb-git-85c7ce36879f0dfc68e26a13b384dc48d79d8100.tar.gz
Merge mysql.com:/home/mydev/mysql-4.1
into mysql.com:/home/mydev/mysql-4.1-wl1648
Diffstat (limited to 'sql')
-rw-r--r--sql/item_func.cc4
-rw-r--r--sql/item_strfunc.cc2
-rw-r--r--sql/sql_table.cc6
-rw-r--r--sql/sql_udf.cc8
4 files changed, 14 insertions, 6 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 04e3452c1f7..f24891dfa6b 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -1489,11 +1489,11 @@ udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func,
arg++,i++)
{
if ((*arg)->fix_fields(thd, tables, arg))
- return 1;
+ DBUG_RETURN(1);
// we can't assign 'item' before, because fix_fields() can change arg
Item *item= *arg;
if (item->check_cols(1))
- return 1;
+ DBUG_RETURN(1);
/*
TODO: We should think about this. It is not always
right way just to set an UDF result to return my_charset_bin
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 2833e1ca016..06131950ec3 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -628,9 +628,11 @@ void Item_func_concat_ws::fix_length_and_dec()
max_length=separator->max_length*(arg_count-1);
for (uint i=0 ; i < arg_count ; i++)
{
+ DTCollation tmp(collation.collation, collation.derivation);
max_length+=args[i]->max_length;
if (collation.aggregate(args[i]->collation))
{
+ collation.set(tmp); // Restore the previous value
my_coll_agg_error(collation, args[i]->collation, func_name());
break;
}
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index f4440f27945..8011809d6ab 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -470,9 +470,11 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
sql_field->charset= create_info->default_table_charset;
/*
table_charset is set in ALTER TABLE if we want change character set
- for all varchar/char columns
+ for all varchar/char columns.
+ But the table charset must not affect the BLOB fields, so don't
+ allow to change my_charset_bin to somethig else.
*/
- if (create_info->table_charset)
+ if (create_info->table_charset && sql_field->charset != &my_charset_bin)
sql_field->charset= create_info->table_charset;
sql_field->create_length_to_internal_length();
diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc
index a4461beed29..561f79f9de1 100644
--- a/sql/sql_udf.cc
+++ b/sql/sql_udf.cc
@@ -298,7 +298,11 @@ udf_func *find_udf(const char *name,uint length,bool mark_used)
DBUG_ENTER("find_udf");
/* TODO: This should be changed to reader locks someday! */
- rw_rdlock(&THR_LOCK_udf);
+ if (mark_used)
+ rw_wrlock(&THR_LOCK_udf); /* Called during fix_fields */
+ else
+ rw_rdlock(&THR_LOCK_udf); /* Called during parsing */
+
if ((udf=(udf_func*) hash_search(&udf_hash,(byte*) name,
length ? length : (uint) strlen(name))))
{
@@ -474,7 +478,7 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name)
if (!(udf=(udf_func*) hash_search(&udf_hash,(byte*) udf_name->str,
(uint) udf_name->length)))
{
- net_printf(thd, ER_FUNCTION_NOT_DEFINED, udf_name);
+ net_printf(thd, ER_FUNCTION_NOT_DEFINED, udf_name->str);
goto err;
}
del_udf(udf);