summaryrefslogtreecommitdiffstats
path: root/sql/item_strfunc.cc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 13:22:53 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 13:22:53 +0000
commit347c164c35eddab388009470e6848cb361ac93f8 (patch)
tree2c0c44eac690f510bb0a35b2a13b36d606b77b6b /sql/item_strfunc.cc
parentReleasing progress-linux version 1:10.11.7-4~progress7.99u1. (diff)
downloadmariadb-347c164c35eddab388009470e6848cb361ac93f8.tar.xz
mariadb-347c164c35eddab388009470e6848cb361ac93f8.zip
Merging upstream version 1:10.11.8.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r--sql/item_strfunc.cc55
1 files changed, 36 insertions, 19 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index ce094bec..19e011d5 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -748,7 +748,7 @@ bool Item_func_des_encrypt::fix_length_and_dec(THD *thd)
String *Item_func_des_encrypt::val_str(String *str)
{
DBUG_ASSERT(fixed());
-#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
+#if defined(HAVE_des) && !defined(EMBEDDED_LIBRARY)
uint code= ER_WRONG_PARAMETERS_TO_PROCEDURE;
DES_cblock ivec;
struct st_des_keyblock keyblock;
@@ -837,8 +837,8 @@ error:
THD *thd= current_thd;
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_FEATURE_DISABLED, ER_THD(thd, ER_FEATURE_DISABLED),
- "des_encrypt", "--with-ssl");
-#endif /* defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) */
+ "des_encrypt", "openssl des cipher (HAVE_des)");
+#endif /* defined(HAVE_des) && !defined(EMBEDDED_LIBRARY) */
null_value=1;
return 0;
}
@@ -861,7 +861,7 @@ bool Item_func_des_decrypt::fix_length_and_dec(THD *thd)
String *Item_func_des_decrypt::val_str(String *str)
{
DBUG_ASSERT(fixed());
-#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
+#if defined(HAVE_des) && !defined(EMBEDDED_LIBRARY)
uint code= ER_WRONG_PARAMETERS_TO_PROCEDURE;
DES_cblock ivec;
struct st_des_keyblock keyblock;
@@ -936,9 +936,9 @@ wrong_key:
THD *thd= current_thd;
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_FEATURE_DISABLED, ER_THD(thd, ER_FEATURE_DISABLED),
- "des_decrypt", "--with-ssl");
+ "des_decrypt", "openssl des cipher (HAVE_des)");
}
-#endif /* defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) */
+#endif /* defined(HAVE_des) && !defined(EMBEDDED_LIBRARY) */
null_value=1;
return 0;
}
@@ -1499,6 +1499,7 @@ String *Item_func_sformat::val_str(String *res)
bool Item_func_random_bytes::fix_length_and_dec(THD *thd)
{
+ set_maybe_null();
used_tables_cache|= RAND_TABLE_BIT;
if (args[0]->can_eval_in_optimize())
{
@@ -1640,15 +1641,16 @@ String *Item_func_regexp_replace::val_str_internal(String *str,
LEX_CSTRING src, rpl;
size_t startoffset= 0;
- if ((null_value=
- (!(source= args[0]->val_str(&tmp0)) ||
- !(replace= args[2]->val_str_null_to_empty(&tmp2, null_to_empty)) ||
- re.recompile(args[1]))))
- return (String *) 0;
-
+ source= args[0]->val_str(&tmp0);
+ if (!source)
+ goto err;
+ replace= args[2]->val_str_null_to_empty(&tmp2, null_to_empty);
+ if (!replace || re.recompile(args[1]))
+ goto err;
if (!(source= re.convert_if_needed(source, &re.subject_converter)) ||
!(replace= re.convert_if_needed(replace, &re.replace_converter)))
goto err;
+ null_value= false;
source->get_value(&src);
replace->get_value(&rpl);
@@ -1694,7 +1696,7 @@ String *Item_func_regexp_replace::val_str_internal(String *str,
err:
null_value= true;
- return (String *) 0;
+ return nullptr;
}
@@ -1830,13 +1832,21 @@ bool Item_func_insert::fix_length_and_dec(THD *thd)
String *Item_str_conv::val_str(String *str)
{
DBUG_ASSERT(fixed());
- String *res;
- size_t alloced_length, len;
+ String *res= args[0]->val_str(&tmp_value);
- if ((null_value= (!(res= args[0]->val_str(&tmp_value)) ||
- str->alloc((alloced_length= res->length() * multiply)))))
- return 0;
+ if (!res)
+ {
+ err:
+ null_value= true;
+ return nullptr;
+ }
+
+ size_t alloced_length= res->length() * multiply, len;
+
+ if (str->alloc((alloced_length)))
+ goto err;
+ null_value= false;
len= converter(collation.collation, (char*) res->ptr(), res->length(),
(char*) str->ptr(), alloced_length);
DBUG_ASSERT(len <= alloced_length);
@@ -3877,7 +3887,9 @@ bool Item_func_set_collation::fix_length_and_dec(THD *thd)
return true;
collation.set(cl.collation().charset_info(), DERIVATION_EXPLICIT,
args[0]->collation.repertoire);
- max_length= args[0]->max_length;
+ ulonglong max_char_length= (ulonglong) args[0]->max_char_length();
+ fix_char_length_ulonglong(max_char_length * collation.collation->mbmaxlen);
+
return FALSE;
}
@@ -4961,6 +4973,11 @@ void Item_func_dyncol_create::print_arguments(String *str,
{
str->append(STRING_WITH_LEN(" charset "));
str->append(defs[i].cs->cs_name);
+ if (Charset(defs[i].cs).can_have_collate_clause())
+ {
+ str->append(STRING_WITH_LEN(" collate "));
+ str->append(defs[i].cs->coll_name);
+ }
str->append(' ');
}
break;