MCPcopy Create free account
hub / github.com/MariaDB/server / udf_init

Function udf_init

sql/sql_udf.cc:146–282  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144*/
145
146void udf_init()
147{
148 udf_func *tmp;
149 TABLE_LIST tables;
150 READ_RECORD read_record_info;
151 TABLE *table;
152 int error;
153 DBUG_ENTER("ufd_init");
154
155 if (initialized || opt_noacl)
156 DBUG_VOID_RETURN;
157
158#ifdef HAVE_PSI_INTERFACE
159 init_udf_psi_keys();
160#endif
161
162 mysql_rwlock_init(key_rwlock_THR_LOCK_udf, &THR_LOCK_udf);
163
164 init_sql_alloc(key_memory_udf_mem, &mem, UDF_ALLOC_BLOCK_SIZE, 0, MYF(0));
165 THD *new_thd = new THD(0);
166 if (!new_thd ||
167 my_hash_init(key_memory_udf_mem, &udf_hash,
168 Lex_ident_routine::charset_info(),
169 32,0,0,get_hash_key, NULL, 0))
170 {
171 sql_print_error("Can't allocate memory for udf structures");
172 my_hash_free(&udf_hash);
173 free_root(&mem,MYF(0));
174 delete new_thd;
175 DBUG_VOID_RETURN;
176 }
177 initialized = 1;
178 new_thd->thread_stack= (void*) &new_thd; // Big stack
179 new_thd->store_globals();
180 new_thd->set_query_inner((char*) STRING_WITH_LEN("intern:udf_init"),
181 default_charset_info);
182 new_thd->set_db(&MYSQL_SCHEMA_NAME);
183
184 tables.init_one_table(&new_thd->db, &MYSQL_FUNC_NAME, 0, TL_READ);
185
186 if (open_and_lock_tables(new_thd, &tables, FALSE, MYSQL_LOCK_IGNORE_TIMEOUT))
187 {
188 DBUG_PRINT("error",("Can't open udf table"));
189 sql_print_error("Can't open the mysql.func table. Please "
190 "run mysql_upgrade to create it.");
191 goto end;
192 }
193
194 table= tables.table;
195 if (init_read_record(&read_record_info, new_thd, table, NULL, NULL, 1, 0,
196 FALSE))
197 {
198 sql_print_error("Could not initialize init_read_record; udf's not "
199 "loaded");
200 goto end;
201 }
202
203 table->use_all_columns();

Callers

nothing calls this directly

Calls 15

init_udf_psi_keysFunction · 0.85
init_sql_allocFunction · 0.85
my_hash_freeFunction · 0.85
free_rootFunction · 0.85
init_read_recordFunction · 0.85
check_valid_pathFunction · 0.85
check_string_char_lengthFunction · 0.85
safe_strFunction · 0.85
add_udfFunction · 0.85
find_udf_dlFunction · 0.85
strxnmovFunction · 0.85
unpack_filenameFunction · 0.85

Tested by

no test coverage detected