Commit 294a36df authored by unknown's avatar unknown

Merge tulin@bk-internal.mysql.com:/home/bk/mysql-5.0

into  poseidon.ndb.mysql.com:/home/tomas/mysql-5.0

parents 869d3fff 4399da26
......@@ -44,8 +44,8 @@ set -e
export AM_MAKEFLAGS
AM_MAKEFLAGS="-j 4"
# SSL library to use. Should be changed to --with-yassl
SSL_LIBRARY=--with-openssl
# SSL library to use.
SSL_LIBRARY=--with-yassl
# If you are not using codefusion add "-Wpointer-arith" to WARNINGS
# The following warning flag will give too many warnings:
......
......@@ -373,8 +373,10 @@ const char *command_names[]=
"enable_rpl_parse",
"disable_rpl_parse",
"eval_result",
/* Enable/disable that the _query_ is logged to result file */
"enable_query_log",
"disable_query_log",
/* Enable/disable that the _result_ from a query is logged to result file */
"enable_result_log",
"disable_result_log",
"server_start",
......@@ -752,8 +754,8 @@ err:
check_result
ds - content to be checked
fname - name of file to check against
require_option - if set and check fails, the test will be aborted with the special
exit code "not supported test"
require_option - if set and check fails, the test will be aborted
with the special exit code "not supported test"
RETURN VALUES
error - the function will not return
......@@ -3708,7 +3710,17 @@ static void handle_error(const char *query, struct st_query *q,
DBUG_ENTER("handle_error");
if (q->require_file)
{
/*
The query after a "--require" failed. This is fine as long the server
returned a valid reponse. Don't allow 2013 or 2006 to trigger an
abort_not_supported_test
*/
if (err_errno == CR_SERVER_LOST ||
err_errno == CR_SERVER_GONE_ERROR)
die("require query '%s' failed: %d: %s", query, err_errno, err_error);
abort_not_supported_test();
}
if (q->abort_on_error)
die("query '%s' failed: %d: %s", query, err_errno, err_error);
......
......@@ -1547,16 +1547,37 @@ else
fi
#---END:
# Check for dlopen, needed for user definable functions
# This must be checked after threads on AIX
# We only need this for mysqld, not for the clients.
# dlopen, dlerror
case "$with_mysqld_ldflags " in
*"-static "*)
# No need to check for dlopen when mysqld is linked with
# -all-static or -static as it won't be able to load any functions.
# NOTE! It would be better if it was possible to test if dlopen
# can be used, but a good way to test it couldn't be found
;;
*)
# Check for dlopen, needed for user definable functions
# This must be checked after threads on AIX
# We only need this for mysqld, not for the clients.
my_save_LIBS="$LIBS"
LIBS=""
AC_CHECK_LIB(dl,dlopen)
LIBDL=$LIBS
LIBS="$my_save_LIBS"
AC_SUBST(LIBDL)
my_save_LIBS="$LIBS"
LIBS="$LIBS $LIBDL"
AC_CHECK_FUNCS(dlopen dlerror)
LIBS="$my_save_LIBS"
;;
esac
my_save_LIBS="$LIBS"
LIBS=""
AC_CHECK_LIB(dl,dlopen)
LIBDL=$LIBS
LIBS="$my_save_LIBS"
AC_SUBST(LIBDL)
# System characteristics
case $SYSTEM_TYPE in
......@@ -1925,11 +1946,6 @@ then
fi]
)
my_save_LIBS="$LIBS"
LIBS="$LIBS $LIBDL"
AC_CHECK_FUNCS(dlopen dlerror)
LIBS="$my_save_LIBS"
# Check definition of gethostbyaddr_r (glibc2 defines this with 8 arguments)
ac_save_CXXFLAGS="$CXXFLAGS"
AC_CACHE_CHECK([style of gethost* routines], mysql_cv_gethost_style,
......
#
# To check if the udf_example.so is available,
# try to load one function from it.
#
#
--require r/have_udf.require
--disable_abort_on_error
CREATE FUNCTION metaphon RETURNS STRING SONAME 'udf_example.so';
--disable_query_log
DROP FUNCTION metaphon;
--enable_query_log
--enable_abort_on_error
......@@ -1140,6 +1140,14 @@ sub environment_setup () {
($ENV{'DYLD_LIBRARY_PATH'} ? ":$ENV{'DYLD_LIBRARY_PATH'}" : "");
}
# --------------------------------------------------------------------------
# Add the path where mysqld will find udf_example.so
# --------------------------------------------------------------------------
$ENV{'LD_LIBRARY_PATH'}=
"$glob_basedir/sql/.libs" .
($ENV{'LD_LIBRARY_PATH'} ? ":$ENV{'LD_LIBRARY_PATH'}" : "");
# --------------------------------------------------------------------------
# Also command lines in .opt files may contain env vars
# --------------------------------------------------------------------------
......
......@@ -15,3 +15,32 @@ SELECT HEX(f1) FROM t1;
HEX(f1)
8300
DROP table t1;
CREATE TABLE t4 (s1 CHAR(50) CHARACTER SET latin1,
s2 CHAR(50) CHARACTER SET cp932,
d DECIMAL(10,2))|
CREATE PROCEDURE bug18293 (IN ins1 CHAR(50),
IN ins2 CHAR(50) CHARACTER SET cp932,
IN ind DECIMAL(10,2))
BEGIN
INSERT INTO t4 VALUES (ins1, ins2, ind);
END|
CALL bug18293("Foo's a Bar", _cp932 0xED40ED41ED42, 47.93)|
SELECT HEX(s1),HEX(s2),d FROM t4|
HEX(s1) HEX(s2) d
466F6F2773206120426172 ED40ED41ED42 47.93
DROP PROCEDURE bug18293|
DROP TABLE t4|
SHOW BINLOG EVENTS FROM 393|
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 393 Query 1 556 use `test`; CREATE TABLE t4 (s1 CHAR(50) CHARACTER SET latin1,
s2 CHAR(50) CHARACTER SET cp932,
d DECIMAL(10,2))
master-bin.000001 556 Query 1 801 use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE bug18293 (IN ins1 CHAR(50),
IN ins2 CHAR(50) CHARACTER SET cp932,
IN ind DECIMAL(10,2))
BEGIN
INSERT INTO t4 VALUES (ins1, ins2, ind);
END
master-bin.000001 801 Query 1 1006 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1'Foo\'s a Bar'), NAME_CONST('ins2',_cp932 0xED40ED41ED42), NAME_CONST('ind',47.93))
master-bin.000001 1006 Query 1 1092 use `test`; DROP PROCEDURE bug18293
master-bin.000001 1092 Query 1 1168 use `test`; DROP TABLE t4
show variables like "%character_set_ser%";
Variable_name Value
character_set_server ucs2
DROP TABLE IF EXISTS t1;
create table t1 (a int);
drop table t1;
CREATE FUNCTION metaphon RETURNS STRING SONAME 'udf_example.so';
drop table if exists t1;
CREATE FUNCTION metaphon RETURNS STRING SONAME 'udf_example.so';
CREATE FUNCTION myfunc_double RETURNS REAL SONAME 'udf_example.so';
CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME 'udf_example.so';
ERROR HY000: Can't find function 'myfunc_nonexist' in library
CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME 'udf_example.so';
CREATE FUNCTION sequence RETURNS INTEGER SONAME "udf_example.so";
CREATE FUNCTION lookup RETURNS STRING SONAME 'udf_example.so';
CREATE FUNCTION reverse_lookup
RETURNS STRING SONAME 'udf_example.so';
CREATE AGGREGATE FUNCTION avgcost
RETURNS REAL SONAME 'udf_example.so';
select myfunc_double();
ERROR HY000: myfunc_double must have at least one argument
select myfunc_double(1);
myfunc_double(1)
49.00
select myfunc_double(78654);
myfunc_double(78654)
54.00
select myfunc_nonexist();
ERROR 42000: FUNCTION test.myfunc_nonexist does not exist
select myfunc_int();
myfunc_int()
0
select lookup();
ERROR HY000: Wrong arguments to lookup; Use the source
select lookup("127.0.0.1");
lookup("127.0.0.1")
127.0.0.1
select lookup(127,0,0,1);
ERROR HY000: Wrong arguments to lookup; Use the source
select lookup("localhost");
lookup("localhost")
127.0.0.1
select reverse_lookup();
ERROR HY000: Wrong number of arguments to reverse_lookup; Use the source
select reverse_lookup("127.0.0.1");
select reverse_lookup(127,0,0,1);
select reverse_lookup("localhost");
reverse_lookup("localhost")
NULL
select avgcost();
ERROR HY000: wrong number of arguments: AVGCOST() requires two arguments
select avgcost(100,23.76);
ERROR HY000: wrong argument type: AVGCOST() requires an INT and a REAL
create table t1(sum int, price float(24));
insert into t1 values(100, 50.00), (100, 100.00);
select avgcost(sum, price) from t1;
avgcost(sum, price)
75.0000
delete from t1;
insert into t1 values(100, 54.33), (200, 199.99);
select avgcost(sum, price) from t1;
avgcost(sum, price)
151.4367
drop table t1;
select metaphon('hello');
metaphon('hello')
HL
CREATE PROCEDURE `XXX1`(in testval varchar(10))
begin
select metaphon(testval);
end//
call XXX1('hello');
metaphon(testval)
HL
drop procedure xxx1;
CREATE PROCEDURE `XXX2`()
begin
declare testval varchar(10);
set testval = 'hello';
select metaphon(testval);
end//
call XXX2();
metaphon(testval)
HL
drop procedure xxx2;
DROP FUNCTION metaphon;
DROP FUNCTION myfunc_double;
DROP FUNCTION myfunc_nonexist;
ERROR 42000: FUNCTION test.myfunc_nonexist does not exist
DROP FUNCTION myfunc_int;
DROP FUNCTION sequence;
DROP FUNCTION lookup;
DROP FUNCTION reverse_lookup;
DROP FUNCTION avgcost;
......@@ -32,3 +32,26 @@ DROP table t1;
# end test for bug#11338
# End of 4.1 tests
#
# Bug#18293: Values in stored procedure written to binlog unescaped
#
delimiter |;
CREATE TABLE t4 (s1 CHAR(50) CHARACTER SET latin1,
s2 CHAR(50) CHARACTER SET cp932,
d DECIMAL(10,2))|
CREATE PROCEDURE bug18293 (IN ins1 CHAR(50),
IN ins2 CHAR(50) CHARACTER SET cp932,
IN ind DECIMAL(10,2))
BEGIN
INSERT INTO t4 VALUES (ins1, ins2, ind);
END|
CALL bug18293("Foo's a Bar", _cp932 0xED40ED41ED42, 47.93)|
SELECT HEX(s1),HEX(s2),d FROM t4|
DROP PROCEDURE bug18293|
DROP TABLE t4|
SHOW BINLOG EVENTS FROM 393|
delimiter ;|
# End of 5.0 tests
--default-character-set=ucs2 --default-collation=ucs2_unicode_ci
#
# Bug#18004 Connecting crashes server when default charset is UCS2
#
show variables like "%character_set_ser%";
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
create table t1 (a int);
drop table t1;
--source include/have_udf.inc
#
# To run this tests the "sql/udf_example.cc" need to be compiled into
# udf_example.so and LD_LIBRARY_PATH should be setup to point out where
# the library are.
#
--disable_warnings
drop table if exists t1;
--enable_warnings
#
# Create the example functions from udf_example
#
CREATE FUNCTION metaphon RETURNS STRING SONAME 'udf_example.so';
CREATE FUNCTION myfunc_double RETURNS REAL SONAME 'udf_example.so';
--error ER_CANT_FIND_DL_ENTRY
CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME 'udf_example.so';
CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME 'udf_example.so';
CREATE FUNCTION sequence RETURNS INTEGER SONAME "udf_example.so";
CREATE FUNCTION lookup RETURNS STRING SONAME 'udf_example.so';
CREATE FUNCTION reverse_lookup
RETURNS STRING SONAME 'udf_example.so';
CREATE AGGREGATE FUNCTION avgcost
RETURNS REAL SONAME 'udf_example.so';
--error 0
select myfunc_double();
select myfunc_double(1);
select myfunc_double(78654);
--error 1305
select myfunc_nonexist();
select myfunc_int();
--error 0
select lookup();
select lookup("127.0.0.1");
--error 0
select lookup(127,0,0,1);
select lookup("localhost");
--error 0
select reverse_lookup();
# These two functions should return "localhost", but it's
# depending on configuration, so just call them and don't log the result
--disable_result_log
select reverse_lookup("127.0.0.1");
select reverse_lookup(127,0,0,1);
--enable_result_log
select reverse_lookup("localhost");
--error 0
select avgcost();
--error 0
select avgcost(100,23.76);
create table t1(sum int, price float(24));
insert into t1 values(100, 50.00), (100, 100.00);
select avgcost(sum, price) from t1;
delete from t1;
insert into t1 values(100, 54.33), (200, 199.99);
select avgcost(sum, price) from t1;
drop table t1;
#------------------------------------------------------------------------
# BUG#17261 Passing a variable from a stored procedure to UDF crashes mysqld
#------------------------------------------------------------------------
select metaphon('hello');
delimiter //;
CREATE PROCEDURE `XXX1`(in testval varchar(10))
begin
select metaphon(testval);
end//
delimiter ;//
call XXX1('hello');
drop procedure xxx1;
delimiter //;
CREATE PROCEDURE `XXX2`()
begin
declare testval varchar(10);
set testval = 'hello';
select metaphon(testval);
end//
delimiter ;//
call XXX2();
drop procedure xxx2;
#
# Drop the example functions from udf_example
#
DROP FUNCTION metaphon;
DROP FUNCTION myfunc_double;
--error ER_SP_DOES_NOT_EXIST
DROP FUNCTION myfunc_nonexist;
DROP FUNCTION myfunc_int;
DROP FUNCTION sequence;
DROP FUNCTION lookup;
DROP FUNCTION reverse_lookup;
DROP FUNCTION avgcost;
......@@ -153,10 +153,11 @@ sql_yacc.o: sql_yacc.cc sql_yacc.h $(HEADERS)
lex_hash.h: gen_lex_hash$(EXEEXT)
./gen_lex_hash$(EXEEXT) > $@
# For testing of udf_example.so; Works on platforms with gcc
# (This is not part of our build process but only provided as an example)
udf_example.so: udf_example.cc
$(CXXCOMPILE) -shared -o $@ $<
# For testing of udf_example.so
noinst_LTLIBRARIES= udf_example.la
udf_example_la_SOURCES= udf_example.cc
udf_example_la_LDFLAGS= -module -rpath $(pkglibdir)
# Don't update the files from bitkeeper
%::SCCS/s.%
......@@ -2642,25 +2642,8 @@ const String *Item_param::query_val_str(String* str) const
case STRING_VALUE:
case LONG_DATA_VALUE:
{
char *buf, *ptr;
str->length(0);
if (str->reserve(str_value.length()*2+3))
break;
buf= str->c_ptr_quick();
ptr= buf;
if (value.cs_info.character_set_client->escape_with_backslash_is_dangerous)
{
ptr= str_to_hex(ptr, str_value.ptr(), str_value.length());
}
else
{
*ptr++= '\'';
ptr+= escape_string_for_mysql(str_value.charset(), ptr, 0,
str_value.ptr(), str_value.length());
*ptr++='\'';
}
str->length((uint32) (ptr - buf));
append_query_string(value.cs_info.character_set_client, &str_value, str);
break;
}
case NULL_VALUE:
......
......@@ -2606,7 +2606,7 @@ udf_handler::fix_fields(THD *thd, Item_result_field *func,
switch(arguments[i]->type()) {
case Item::STRING_ITEM: // Constant string !
{
String *res=arguments[i]->val_str((String *) 0);
String *res=arguments[i]->val_str(&buffers[i]);
if (arguments[i]->null_value)
continue;
f_args.args[i]= (char*) res->ptr();
......
......@@ -239,6 +239,37 @@ char *str_to_hex(char *to, const char *from, uint len)
return to; // pointer to end 0 of 'to'
}
/*
Append a version of the 'from' string suitable for use in a query to
the 'to' string. To generate a correct escaping, the character set
information in 'csinfo' is used.
*/
#ifndef MYSQL_CLIENT
int
append_query_string(CHARSET_INFO *csinfo,
String const *from, String *to)
{
char *beg, *ptr;
uint32 const orig_len= to->length();
if (to->reserve(orig_len + from->length()*2+3))
return 1;
beg= to->c_ptr_quick() + to->length();
ptr= beg;
if (csinfo->escape_with_backslash_is_dangerous)
ptr= str_to_hex(ptr, from->ptr(), from->length());
else
{
*ptr++= '\'';
ptr+= escape_string_for_mysql(from->charset(), ptr, 0,
from->ptr(), from->length());
*ptr++='\'';
}
to->length(orig_len + ptr - beg);
return 0;
}
#endif
/*
Prints a "session_var=value" string. Used by mysqlbinlog to print some SET
commands just before it prints a query.
......
......@@ -529,6 +529,8 @@ bool delete_precheck(THD *thd, TABLE_LIST *tables);
bool insert_precheck(THD *thd, TABLE_LIST *tables);
bool create_table_precheck(THD *thd, TABLE_LIST *tables,
TABLE_LIST *create_table);
int append_query_string(CHARSET_INFO *csinfo,
String const *from, String *to);
void get_default_definer(THD *thd, LEX_USER *definer);
LEX_USER *create_default_definer(THD *thd);
......
......@@ -2978,23 +2978,23 @@ ER_UDF_EXISTS
swe "Funktionen '%-.64s' finns redan"
ukr "æ '%-.64s' դ"
ER_CANT_OPEN_LIBRARY
cze "Nemohu otev-Bt sdlenou knihovnu '%-.64s' (errno: %d %s)"
dan "Kan ikke bne delt bibliotek '%-.64s' (errno: %d %s)"
nla "Kan shared library '%-.64s' niet openen (Errcode: %d %s)"
eng "Can't open shared library '%-.64s' (errno: %d %-.64s)"
jps "shared library '%-.64s' Jł܂ (errno: %d %s)",
est "Ei suuda avada jagatud teeki '%-.64s' (veakood: %d %-.64s)"
fre "Impossible d'ouvrir la bibliothque partage '%-.64s' (errno: %d %s)"
ger "Kann Shared Library '%-.64s' nicht ffnen (Fehler: %d %-.64s)"
greek " shared library '%-.64s' ( : %d %s)"
hun "A(z) '%-.64s' megosztott konyvtar nem hasznalhato (hibakod: %d %s)"
ita "Impossibile aprire la libreria condivisa '%-.64s' (errno: %d %s)"
jpn "shared library '%-.64s' 򳫤Ǥޤ (errno: %d %s)"
kor "'%-.64s' ̹ ϴ.(ȣ: %d %s)"
nor "Can't open shared library '%-.64s' (errno: %d %s)"
norwegian-ny "Can't open shared library '%-.64s' (errno: %d %s)"
pol "Can't open shared library '%-.64s' (errno: %d %s)"
por "No pode abrir biblioteca compartilhada '%-.64s' (erro no. '%d' - '%-.64s')"
cze "Nemohu otev-Bt sdlenou knihovnu '%-.64s' (errno: %d %-.128s)"
dan "Kan ikke bne delt bibliotek '%-.64s' (errno: %d %-.128s)"
nla "Kan shared library '%-.64s' niet openen (Errcode: %d %-.128s)"
eng "Can't open shared library '%-.64s' (errno: %d %-.128s)"
jps "shared library '%-.64s' Jł܂ (errno: %d %-.128s)",
est "Ei suuda avada jagatud teeki '%-.64s' (veakood: %d %-.128s)"
fre "Impossible d'ouvrir la bibliothque partage '%-.64s' (errno: %d %-.128s)"
ger "Kann Shared Library '%-.64s' nicht ffnen (Fehler: %d %-.128s)"
greek " shared library '%-.64s' ( : %d %-.128s)"
hun "A(z) '%-.64s' megosztott konyvtar nem hasznalhato (hibakod: %d %-.128s)"
ita "Impossibile aprire la libreria condivisa '%-.64s' (errno: %d %-.128s)"
jpn "shared library '%-.64s' 򳫤Ǥޤ (errno: %d %-.128s)"
kor "'%-.64s' ̹ ϴ.(ȣ: %d %-.128s)"
nor "Can't open shared library '%-.64s' (errno: %d %-.128s)"
norwegian-ny "Can't open shared library '%-.64s' (errno: %d %-.128s)"
pol "Can't open shared library '%-.64s' (errno: %d %-.128s)"
por "No pode abrir biblioteca compartilhada '%-.64s' (erro no. '%d' - '%-.128s')"
rum "Nu pot deschide libraria shared '%-.64s' (Eroare: %d %-.64s)"
rus " '%-.64s' (: %d %-.64s)"
serbian "Ne mogu da otvorim share-ovanu biblioteku '%-.64s' (errno: %d %-.64s)"
......@@ -3003,27 +3003,27 @@ ER_CANT_OPEN_LIBRARY
swe "Kan inte ppna det dynamiska biblioteket '%-.64s' (Felkod: %d %s)"
ukr " צ Ħ ¦̦ '%-.64s' (: %d %-.64s)"
ER_CANT_FIND_DL_ENTRY
cze "Nemohu naj-Bt funkci '%-.64s' v knihovn"
dan "Kan ikke finde funktionen '%-.64s' i bibliotek"
nla "Kan functie '%-.64s' niet in library vinden"
eng "Can't find function '%-.64s' in library"
jps "function '%-.64s' Cu[Ɍt鎖ł܂",
est "Ei leia funktsiooni '%-.64s' antud teegis"
fre "Impossible de trouver la fonction '%-.64s' dans la bibliothque"
ger "Kann Funktion '%-.64s' in der Library nicht finden"
greek " '%-.64s' "
hun "A(z) '%-.64s' fuggveny nem talalhato a konyvtarban"
ita "Impossibile trovare la funzione '%-.64s' nella libreria"
jpn "function '%-.64s' 饤֥꡼˸դǤޤ"
kor "̹ '%-.64s' Լ ã ϴ."
por "No pode encontrar a funo '%-.64s' na biblioteca"
rum "Nu pot gasi functia '%-.64s' in libraria"
rus " '%-.64s' "
serbian "Ne mogu da pronadjem funkciju '%-.64s' u biblioteci"
slo "Nemem njs funkciu '%-.64s' v kninici"
spa "No puedo encontrar funcin '%-.64s' en libraria"
swe "Hittar inte funktionen '%-.64s' in det dynamiska biblioteket"
ukr " æ '%-.64s' ¦̦æ"
cze "Nemohu naj-Bt funkci '%-.128s' v knihovn"
dan "Kan ikke finde funktionen '%-.128s' i bibliotek"
nla "Kan functie '%-.128s' niet in library vinden"
eng "Can't find function '%-.128s' in library"
jps "function '%-.128s' Cu[Ɍt鎖ł܂",
est "Ei leia funktsiooni '%-.128s' antud teegis"
fre "Impossible de trouver la fonction '%-.128s' dans la bibliothque"
ger "Kann Funktion '%-.128s' in der Library nicht finden"
greek " '%-.128s' "
hun "A(z) '%-.128s' fuggveny nem talalhato a konyvtarban"
ita "Impossibile trovare la funzione '%-.128s' nella libreria"
jpn "function '%-.128s' 饤֥꡼˸դǤޤ"
kor "̹ '%-.128s' Լ ã ϴ."
por "No pode encontrar a funo '%-.128s' na biblioteca"
rum "Nu pot gasi functia '%-.128s' in libraria"
rus " '%-.128s' "
serbian "Ne mogu da pronadjem funkciju '%-.128s' u biblioteci"
slo "Nemem njs funkciu '%-.128s' v kninici"
spa "No puedo encontrar funcin '%-.128s' en libraria"
swe "Hittar inte funktionen '%-.128s' in det dynamiska biblioteket"
ukr " æ '%-.128s' ¦̦æ"
ER_FUNCTION_NOT_DEFINED
cze "Funkce '%-.64s' nen-B definovna"
dan "Funktionen '%-.64s' er ikke defineret"
......
......@@ -80,8 +80,8 @@ sp_map_item_type(enum enum_field_types type)
/*
Return a string representation of the Item value.
NOTE: this is a legacy-compatible implementation. It fails if the value
contains non-ordinary symbols, which should be escaped.
NOTE: If the item has a string result type, the string is escaped
according to its character set.
SYNOPSIS
item a pointer to the Item
......@@ -119,9 +119,9 @@ sp_get_item_value(Item *item, String *str)
buf.append('_');
buf.append(result->charset()->csname);
buf.append('\'');
buf.append(*result);
buf.append('\'');
if (result->charset()->escape_with_backslash_is_dangerous)
buf.append(' ');
append_query_string(result->charset(), result, &buf);
str->copy(buf);
return str;
......
......@@ -439,6 +439,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
}
if (!(dl = find_udf_dl(udf->dl)))
{
DBUG_PRINT("info", ("Calling dlopen, udf->dl: %s", udf->dl));
if (!(dl = dlopen(udf->dl, RTLD_NOW)))
{
DBUG_PRINT("error",("dlopen of %s failed, error: %d (%s)",
......
......@@ -1597,7 +1597,7 @@ bool check_db_name(char *name)
while (*name)
{
#if defined(USE_MB) && defined(USE_MB_IDENT)
last_char_is_space= my_isspace(default_charset_info, *name);
last_char_is_space= my_isspace(system_charset_info, *name);
if (use_mb(system_charset_info))
{
int len=my_ismbchar(system_charset_info, name,
......@@ -1643,7 +1643,7 @@ bool check_table_name(const char *name, uint length)
while (name != end)
{
#if defined(USE_MB) && defined(USE_MB_IDENT)
last_char_is_space= my_isspace(default_charset_info, *name);
last_char_is_space= my_isspace(system_charset_info, *name);
if (use_mb(system_charset_info))
{
int len=my_ismbchar(system_charset_info, name, end);
......@@ -1674,7 +1674,7 @@ bool check_column_name(const char *name)
while (*name)
{
#if defined(USE_MB) && defined(USE_MB_IDENT)
last_char_is_space= my_isspace(default_charset_info, *name);
last_char_is_space= my_isspace(system_charset_info, *name);
if (use_mb(system_charset_info))
{
int len=my_ismbchar(system_charset_info, name,
......
......@@ -113,6 +113,8 @@
*/
#ifdef STANDARD
/* STANDARD is defined, don't use any mysql functions */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifdef __WIN__
......@@ -125,10 +127,10 @@ typedef long long longlong;
#else
#include <my_global.h>
#include <my_sys.h>
#include <m_string.h> // To get strmov()
#endif
#include <mysql.h>
#include <m_ctype.h>
#include <m_string.h> // To get strmov()
#include <ctype.h>
static pthread_mutex_t LOCK_hostname;
......@@ -290,8 +292,8 @@ char *metaphon(UDF_INIT *initid, UDF_ARGS *args, char *result,
for (n = ntrans + 1, n_end = ntrans + sizeof(ntrans)-2;
word != w_end && n < n_end; word++ )
if ( my_isalpha ( &my_charset_latin1, *word ))
*n++ = my_toupper ( &my_charset_latin1, *word );
if ( isalpha ( *word ))
*n++ = toupper ( *word );
if ( n == ntrans + 1 ) /* return empty string if 0 bytes */
{
......@@ -519,7 +521,7 @@ my_bool myfunc_double_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
{
if (!args->arg_count)
{
strcpy(message,"myfunc_double must have at least on argument");
strcpy(message,"myfunc_double must have at least one argument");
return 1;
}
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment