summaryrefslogtreecommitdiffstats
path: root/sql/sql_udf.cc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-07-01 18:15:00 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-07-01 18:15:00 +0000
commita2a2e32c02643a0cec111511220227703fda1cd5 (patch)
tree69cc2b631234c2a8e026b9cd4d72676c61c594df /sql/sql_udf.cc
parentReleasing progress-linux version 1:10.11.8-1~progress7.99u1. (diff)
downloadmariadb-a2a2e32c02643a0cec111511220227703fda1cd5.tar.xz
mariadb-a2a2e32c02643a0cec111511220227703fda1cd5.zip
Merging upstream version 1:11.4.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sql/sql_udf.cc')
-rw-r--r--sql/sql_udf.cc16
1 files changed, 10 insertions, 6 deletions
diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc
index 02f068e9..db7f6483 100644
--- a/sql/sql_udf.cc
+++ b/sql/sql_udf.cc
@@ -181,6 +181,8 @@ void udf_init()
initialized = 1;
new_thd->thread_stack= (char*) &new_thd;
new_thd->store_globals();
+ new_thd->set_query_inner((char*) STRING_WITH_LEN("intern:udf_init"),
+ default_charset_info);
new_thd->set_db(&MYSQL_SCHEMA_NAME);
tables.init_one_table(&new_thd->db, &MYSQL_FUNC_NAME, 0, TL_READ);
@@ -206,10 +208,11 @@ void udf_init()
while (!(error= read_record_info.read_record()))
{
DBUG_PRINT("info",("init udf record"));
- LEX_CSTRING name;
- name.str=get_field(&mem, table->field[0]);
- name.length = (uint) safe_strlen(name.str);
- char *dl_name= get_field(&mem, table->field[2]);
+ DBUG_ASSERT(!(new_thd->variables.sql_mode & MODE_PAD_CHAR_TO_FULL_LENGTH));
+ DBUG_ASSERT(table->field[0]->get_thd() == new_thd);
+ DBUG_ASSERT(table->field[2]->get_thd() == new_thd);
+ LEX_CSTRING name= table->field[0]->val_lex_string_strmake(&mem);
+ LEX_CSTRING dl_name= table->field[2]->val_lex_string_strmake(&mem);
bool new_dl=0;
Item_udftype udftype=UDFTYPE_FUNCTION;
if (table->s->fields >= 4) // New func table
@@ -222,7 +225,8 @@ void udf_init()
On windows we must check both FN_LIBCHAR and '/'.
*/
- if (!name.str || !dl_name || check_valid_path(dl_name, strlen(dl_name)) ||
+ if (!name.length || !dl_name.length ||
+ check_valid_path(dl_name.str, dl_name.length) ||
check_string_char_length(&name, 0, NAME_CHAR_LEN,
system_charset_info, 1))
{
@@ -232,7 +236,7 @@ void udf_init()
}
if (!(tmp= add_udf(&name,(Item_result) table->field[1]->val_int(),
- dl_name, udftype)))
+ dl_name.str, udftype)))
{
sql_print_error("Can't alloc memory for udf function: '%.64s'", name.str);
continue;