mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Fixes and code cleanups after merge with 4.0.3
Warning handling and initial prepared statement handling (last not complete yet) Changed a lot of functions that returned 0/1 to my_bool type. GRANT handling now uses read/write locks instead of mutex Change basic net functions to use THD instead of NET (needed for 4.1 protocol) Use my_sprintf instead of sprintf() + strlen() Added alloc_query() to be able to chare query initialization code with prepared statements. Cleanup handling of SHOW COUNT(*) WARNINGS and SELECT LAST_INSERT_ID() Note that the following test fails (will be fixed ASAP): sub_select, union, rpl_rotate_logs and rpl_mystery22
This commit is contained in:
@@ -342,7 +342,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
|
||||
|
||||
if (!initialized)
|
||||
{
|
||||
send_error(&thd->net, ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES));
|
||||
send_error(thd, ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
@@ -353,19 +353,19 @@ int mysql_create_function(THD *thd,udf_func *udf)
|
||||
*/
|
||||
if (strchr(udf->dl, '/'))
|
||||
{
|
||||
send_error(&thd->net, ER_UDF_NO_PATHS,ER(ER_UDF_NO_PATHS));
|
||||
send_error(thd, ER_UDF_NO_PATHS,ER(ER_UDF_NO_PATHS));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
if (udf->name_length > NAME_LEN)
|
||||
{
|
||||
net_printf(&thd->net, ER_TOO_LONG_IDENT,udf->name);
|
||||
net_printf(thd, ER_TOO_LONG_IDENT,udf->name);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&THR_LOCK_udf);
|
||||
if (hash_search(&udf_hash,(byte*) udf->name, udf->name_length))
|
||||
{
|
||||
net_printf(&thd->net, ER_UDF_EXISTS, udf->name);
|
||||
net_printf(thd, ER_UDF_EXISTS, udf->name);
|
||||
goto err;
|
||||
}
|
||||
if (!(dl = find_udf_dl(udf->dl)))
|
||||
@@ -374,7 +374,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
|
||||
{
|
||||
DBUG_PRINT("error",("dlopen of %s failed, error: %d (%s)",
|
||||
udf->dl,errno,dlerror()));
|
||||
net_printf(&thd->net, ER_CANT_OPEN_LIBRARY, udf->dl, errno, dlerror());
|
||||
net_printf(thd, ER_CANT_OPEN_LIBRARY, udf->dl, errno, dlerror());
|
||||
goto err;
|
||||
}
|
||||
new_dl=1;
|
||||
@@ -384,7 +384,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
|
||||
|
||||
if (udf->func == NULL)
|
||||
{
|
||||
net_printf(&thd->net, ER_CANT_FIND_DL_ENTRY, udf->name);
|
||||
net_printf(thd, ER_CANT_FIND_DL_ENTRY, udf->name);
|
||||
goto err;
|
||||
}
|
||||
udf->name=strdup_root(&mem,udf->name);
|
||||
@@ -392,7 +392,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
|
||||
if (!udf->name || !udf->dl ||
|
||||
!(u_d=add_udf(udf->name,udf->returns,udf->dl,udf->type)))
|
||||
{
|
||||
send_error(&thd->net,0); // End of memory
|
||||
send_error(thd,0); // End of memory
|
||||
goto err;
|
||||
}
|
||||
u_d->dlhandle = dl;
|
||||
@@ -422,7 +422,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
|
||||
close_thread_tables(thd);
|
||||
if (error)
|
||||
{
|
||||
net_printf(&thd->net, ER_ERROR_ON_WRITE, "func@mysql",error);
|
||||
net_printf(thd, ER_ERROR_ON_WRITE, "func@mysql",error);
|
||||
del_udf(u_d);
|
||||
goto err;
|
||||
}
|
||||
@@ -445,13 +445,13 @@ int mysql_drop_function(THD *thd,const char *udf_name)
|
||||
DBUG_ENTER("mysql_drop_function");
|
||||
if (!initialized)
|
||||
{
|
||||
send_error(&thd->net, ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES));
|
||||
send_error(thd, ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
pthread_mutex_lock(&THR_LOCK_udf);
|
||||
if (!(udf=(udf_func*) hash_search(&udf_hash,(byte*) udf_name, (uint) strlen(udf_name))))
|
||||
{
|
||||
net_printf(&thd->net, ER_FUNCTION_NOT_DEFINED, udf_name);
|
||||
net_printf(thd, ER_FUNCTION_NOT_DEFINED, udf_name);
|
||||
goto err;
|
||||
}
|
||||
del_udf(udf);
|
||||
|
||||
Reference in New Issue
Block a user