mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
Fix small bug in udf_example.cc, it was processing one char too much and thus returning junk
Add more DBUG_PRINT's in udf_handler::val_str Enable udf.test mysql-test/t/disabled.def: Enable udf.test sql/item_func.cc: Add DBUG_ printouts for easier debugging of installed udf's sql/udf_example.cc: Bug fix, break for loop when "n < n_end"
This commit is contained in:
@@ -11,4 +11,3 @@
|
|||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
ndb_load : Bug#17233
|
ndb_load : Bug#17233
|
||||||
udf : Not yet
|
|
||||||
|
@@ -2734,9 +2734,10 @@ String *udf_handler::val_str(String *str,String *save_str)
|
|||||||
{
|
{
|
||||||
uchar is_null_tmp=0;
|
uchar is_null_tmp=0;
|
||||||
ulong res_length;
|
ulong res_length;
|
||||||
|
DBUG_ENTER("udf_handler::val_str");
|
||||||
|
|
||||||
if (get_arguments())
|
if (get_arguments())
|
||||||
return 0;
|
DBUG_RETURN(0);
|
||||||
char * (*func)(UDF_INIT *, UDF_ARGS *, char *, ulong *, uchar *, uchar *)=
|
char * (*func)(UDF_INIT *, UDF_ARGS *, char *, ulong *, uchar *, uchar *)=
|
||||||
(char* (*)(UDF_INIT *, UDF_ARGS *, char *, ulong *, uchar *, uchar *))
|
(char* (*)(UDF_INIT *, UDF_ARGS *, char *, ulong *, uchar *, uchar *))
|
||||||
u_d->func;
|
u_d->func;
|
||||||
@@ -2746,22 +2747,26 @@ String *udf_handler::val_str(String *str,String *save_str)
|
|||||||
if (str->alloc(MAX_FIELD_WIDTH))
|
if (str->alloc(MAX_FIELD_WIDTH))
|
||||||
{
|
{
|
||||||
error=1;
|
error=1;
|
||||||
return 0;
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
char *res=func(&initid, &f_args, (char*) str->ptr(), &res_length,
|
char *res=func(&initid, &f_args, (char*) str->ptr(), &res_length,
|
||||||
&is_null_tmp, &error);
|
&is_null_tmp, &error);
|
||||||
|
DBUG_PRINT("info", ("udf func returned, res_length: %lu", res_length));
|
||||||
if (is_null_tmp || !res || error) // The !res is for safety
|
if (is_null_tmp || !res || error) // The !res is for safety
|
||||||
{
|
{
|
||||||
return 0;
|
DBUG_PRINT("info", ("Null or error"));
|
||||||
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
if (res == str->ptr())
|
if (res == str->ptr())
|
||||||
{
|
{
|
||||||
str->length(res_length);
|
str->length(res_length);
|
||||||
return str;
|
DBUG_PRINT("exit", ("str: %s", str->ptr()));
|
||||||
|
DBUG_RETURN(str);
|
||||||
}
|
}
|
||||||
save_str->set(res, res_length, str->charset());
|
save_str->set(res, res_length, str->charset());
|
||||||
return save_str;
|
DBUG_PRINT("exit", ("save_str: %s", save_str->ptr()));
|
||||||
|
DBUG_RETURN(save_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -344,7 +344,7 @@ char *metaphon(UDF_INIT *initid, UDF_ARGS *args, char *result,
|
|||||||
KSflag = 0; /* state flag for KS translation */
|
KSflag = 0; /* state flag for KS translation */
|
||||||
|
|
||||||
for (metaph_end = result + MAXMETAPH, n_start = n;
|
for (metaph_end = result + MAXMETAPH, n_start = n;
|
||||||
n <= n_end && result < metaph_end; n++ )
|
n < n_end && result < metaph_end; n++ )
|
||||||
{
|
{
|
||||||
|
|
||||||
if ( KSflag )
|
if ( KSflag )
|
||||||
|
Reference in New Issue
Block a user