diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2005-11-22 23:16:38 +0000 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2005-11-22 23:16:38 +0000 |
commit | a034b35397dbbd2b390ca91ad37571f44eaa3b4c (patch) | |
tree | cd421a9b6e5734dbf0eb86733af6566d1d9ee7d4 | |
parent | Imported from /home/gentoo/distfiles/mysql-extras-20050920.tar.bz2. (diff) | |
download | mysql-extras-a034b35397dbbd2b390ca91ad37571f44eaa3b4c.tar.gz mysql-extras-a034b35397dbbd2b390ca91ad37571f44eaa3b4c.tar.bz2 mysql-extras-a034b35397dbbd2b390ca91ad37571f44eaa3b4c.zip |
Imported from /home/gentoo/distfiles/mysql-extras-20051122.tar.bz2.mysql-extras-20051122
51 files changed, 2223 insertions, 9000 deletions
diff --git a/005_all_tmp-5.1.patch b/005_all_tmp-5.1.patch deleted file mode 100644 index 6694c55..0000000 --- a/005_all_tmp-5.1.patch +++ /dev/null @@ -1,11 +0,0 @@ -###MY_VER_RANGE [5.1.0_alpha,mysql-5.1.0_alpha20050606) ---- mysql-5.1.0-alpha-nightly-20050531/sql/Makefile.am 2005-05-31 08:39:53.000000000 +0200 -+++ mysql-5.1.0-bitvector/sql/Makefile.am 2005-06-02 13:15:49.000000000 +0200 -@@ -91,7 +91,6 @@ - sql_udf.cc sql_analyse.cc sql_analyse.h sql_cache.cc \ - slave.cc sql_repl.cc rpl_filter.cc \ - sql_union.cc sql_derived.cc \ -- bitvector.cc \ - client.c sql_client.cc mini_client_errors.c pack.c\ - stacktrace.c repl_failsafe.h repl_failsafe.cc \ - sql_olap.cc sql_view.cc \ diff --git a/010_all_my-print-defaults-r0.patch b/010_all_my-print-defaults-r0.patch deleted file mode 100644 index 890f3f8..0000000 --- a/010_all_my-print-defaults-r0.patch +++ /dev/null @@ -1,15 +0,0 @@ -###MY_VER_RANGE [4.0_alpha,5.0_alpha) [5.0_alpha,5.0.5_beta) - -# for correct hardcoded sysconf directory - ---- mysql-4.1.8/mysys/default.c 2004-12-14 13:40:36.000000000 +0100 -+++ bbb/mysys/default.c 2005-01-09 17:57:00.407231408 +0100 -@@ -48,7 +48,7 @@ - #elif defined(__NETWARE__) - "sys:/etc/", - #else --"/etc/", -+"/etc/mysql/", - #endif - #ifdef DATADIR - DATADIR, diff --git a/010_all_my-print-defaults-r1.patch b/010_all_my-print-defaults-r1.patch deleted file mode 100644 index 831e6c8..0000000 --- a/010_all_my-print-defaults-r1.patch +++ /dev/null @@ -1,29 +0,0 @@ -###MY_VER_RANGE [5.0.5_beta,5.0.6_beta) -+++ mysql/mysys/default.c 2005-05-09 14:29:29.783506560 +0200 -@@ -844,25 +844,8 @@ - { - const char *env, **ptr= default_directories; - --#ifdef __WIN__ -- *ptr++= "C:/"; -+ *ptr++= "/etc/mysql/"; - -- if (GetWindowsDirectory(system_dir,sizeof(system_dir))) -- *ptr++= &system_dir; -- /* Only add shared system directory if different from default. */ -- if (GetSystemWindowsDirectory(shared_system_dir,sizeof(shared_system_dir)) && -- strcmp(system_dir, shared_system_dir)) -- *ptr++= &shared_system_dir; -- --#elif defined(__NETWARE__) -- *ptr++= "sys:/etc/"; --#else --#if defined(__EMX__) || defined(OS2) -- if ((env= getenv("ETC"))) -- *ptr++= env; --#endif -- *ptr++= "/etc/"; --#endif - if ((env= getenv(STRINGIFY_ARG(DEFAULT_HOME_ENV)))) - *ptr++= env; - *ptr++= ""; /* Place for defaults_extra_file */ diff --git a/010_all_my-print-defaults-r2.patch b/010_all_my-print-defaults-r2.patch deleted file mode 100644 index 656930d..0000000 --- a/010_all_my-print-defaults-r2.patch +++ /dev/null @@ -1,42 +0,0 @@ -###MY_VER_RANGE [5.0.6_beta,) ---- mysql.old/mysys/default.c 2005-05-22 02:35:25.000000000 +0200 -+++ mysql/mysys/default.c 2005-05-22 02:36:17.000000000 +0200 -@@ -823,19 +823,19 @@ - 5. "" - - On Novell NetWare, this is: -- 1. sys:/etc/ -+ 1. sys:/etc/mysql/ - 2. getenv(DEFAULT_HOME_ENV) - 3. "" - - On OS/2, this is: - 1. getenv(ETC) -- 2. /etc/ -+ 2. /etc/mysql/ - 3. getenv(DEFAULT_HOME_ENV) - 4. "" - 5. "~/" - - Everywhere else, this is: -- 1. /etc/ -+ 1. /etc/mysql/ - 2. getenv(DEFAULT_HOME_ENV) - 3. "" - 4. "~/" -@@ -860,13 +860,13 @@ - #endif - - #elif defined(__NETWARE__) -- *ptr++= "sys:/etc/"; -+ *ptr++= "sys:/etc/mysql/"; - #else - #if defined(__EMX__) || defined(OS2) - if ((env= getenv("ETC"))) - *ptr++= env; - #endif -- *ptr++= "/etc/"; -+ *ptr++= "/etc/mysql/"; - #endif - if ((env= getenv(STRINGIFY_ARG(DEFAULT_HOME_ENV)))) - *ptr++= env; diff --git a/010_all_slot-my-print-default-r1.patch b/010_all_slot-my-print-default-r1.patch new file mode 100644 index 0000000..e64880f --- /dev/null +++ b/010_all_slot-my-print-default-r1.patch @@ -0,0 +1,24 @@ +diff -Naur mysql-4.1.15/mysys/Makefile.am mysql-4.1.15.new/mysys/Makefile.am +--- mysql-4.1.15/mysys/Makefile.am 2005-10-09 22:46:29.000000000 +0000 ++++ mysql-4.1.15.new/mysys/Makefile.am 2005-11-21 13:48:31.000000000 +0000 +@@ -68,6 +68,7 @@ + -DDATADIR="\"$(MYSQLDATAdir)\"" \ + -DDEFAULT_CHARSET_HOME="\"$(MYSQLBASEdir)\"" \ + -DSHAREDIR="\"$(MYSQLSHAREdir)\"" \ ++ -DDEFAULT_SYSCONFDIR="\"$(sysconfdir)\"" \ + @DEFS@ + + libmysys_a_DEPENDENCIES= @THREAD_LOBJECTS@ +diff -Naur mysql-4.1.15/mysys/default.c mysql-4.1.15.new/mysys/default.c +--- mysql-4.1.15/mysys/default.c 2005-10-09 22:46:25.000000000 +0000 ++++ mysql-4.1.15.new/mysys/default.c 2005-11-21 13:47:11.000000000 +0000 +@@ -43,6 +43,9 @@ + /* Which directories are searched for options (and in which order) */ + + const char *default_directories[]= { ++#ifdef DEFAULT_SYSCONFDIR ++DEFAULT_SYSCONFDIR, ++#endif + #ifdef __WIN__ + "C:/", + #elif defined(__NETWARE__) diff --git a/010_all_slot-my-print-default-r2.patch b/010_all_slot-my-print-default-r2.patch new file mode 100644 index 0000000..5dc6fef --- /dev/null +++ b/010_all_slot-my-print-default-r2.patch @@ -0,0 +1,25 @@ +diff -Naur -Naur mysql-5.0.15/mysys/Makefile.am mysql-5.0.15.new/mysys/Makefile.am +--- mysql-5.0.15/mysys/Makefile.am 2005-10-17 01:27:43.000000000 +0000 ++++ mysql-5.0.15.new/mysys/Makefile.am 2005-11-16 15:27:02.000000000 +0000 +@@ -70,6 +70,7 @@ + -DSHAREDIR="\"$(MYSQLSHAREdir)\"" \ + -DDEFAULT_HOME_ENV=MYSQL_HOME \ + -DDEFAULT_GROUP_SUFFIX_ENV=MYSQL_GROUP_SUFFIX \ ++ -DDEFAULT_SYSCONFDIR="\"$(sysconfdir)\"" \ + @DEFS@ + + libmysys_a_DEPENDENCIES= @THREAD_LOBJECTS@ +diff -Naur -Naur mysql-5.0.15/mysys/default.c mysql-5.0.15.new/mysys/default.c +--- mysql-5.0.15/mysys/default.c 2005-10-17 01:27:31.000000000 +0000 ++++ mysql-5.0.15.new/mysys/default.c 2005-11-16 15:28:43.000000000 +0000 +@@ -984,6 +984,10 @@ + { + const char *env, **ptr= default_directories; + ++#ifdef DEFAULT_SYSCONFDIR ++ *ptr++= DEFAULT_SYSCONFDIR; ++#endif ++ + #ifdef __WIN__ + *ptr++= "C:/"; + diff --git a/020_all_gentoo-nptl.patch b/020_all_gentoo-nptl.patch index 6432d9a..80f1235 100644 --- a/020_all_gentoo-nptl.patch +++ b/020_all_gentoo-nptl.patch @@ -1,7 +1,3 @@ -###MY_VER_RANGE [4.0.18,4.1.12) [5.0.0_alpha,5.0.4_beta) - -# NPTL support - --- mysql-4.1.8/configure.in 2004-12-14 13:40:38.000000000 +0100 +++ bbb/configure.in 2005-01-09 17:57:57.451559352 +0100 @@ -1269,7 +1269,10 @@ diff --git a/030_all_thrssl-r0.patch b/030_all_thrssl-r0.patch index a4db917..e180572 100644 --- a/030_all_thrssl-r0.patch +++ b/030_all_thrssl-r0.patch @@ -1,14 +1,8 @@ -###MY_VER_RANGE [4.0.21,4.1.11_alpha20050215) [5.0_alpha,5.0.3_alpha) - -# attempt to get libmysqlclient_r linked against ssl if USE="ssl" enabled -# i would really prefer to fix this at the Makefile.am level, but can't -# get the software to autoreconf as distributed - too many missing files - ---- mysql-4.1.8/libmysql_r/Makefile.in 2004-12-14 13:41:13.000000000 +0100 -+++ bbb/libmysql_r/Makefile.in 2005-01-09 17:57:27.156164952 +0100 -@@ -242,7 +242,7 @@ +--- mysql-4.0.21/libmysql_r/Makefile.in.orig ++++ mysql-4.0.21/libmysql_r/Makefile.in +@@ -135,7 +135,7 @@ + LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ - LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@ LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ @openssl_libs@ +LIBS = @CLIENT_LIBS@ @openssl_libs@ diff --git a/030_all_thrssl-r1.patch b/030_all_thrssl-r1.patch index adbd84d..2e6c893 100644 --- a/030_all_thrssl-r1.patch +++ b/030_all_thrssl-r1.patch @@ -1,18 +1,12 @@ -###MY_VER_RANGE [4.1.11_alpha20050215,5.0_alpha) [5.0.3_alpha,5.0.4_beta) - -# attempt to get libmysqlclient_r linked against ssl if USE="ssl" enabled -# i would really prefer to fix this at the Makefile.am level, but can't -# get the software to autoreconf as distributed - too many missing files - --- mysql-4.1.11_alpha20050216.orig/libmysql_r/Makefile.am 2005-02-19 15:58:34.000000000 +0100 +++ mysql-4.1.10/libmysql_r/Makefile.am 2005-02-19 15:59:02.000000000 +0100 @@ -22,7 +22,7 @@ - + target = libmysqlclient_r.la target_defs = -DDONT_USE_RAID -DMYSQL_CLIENT @LIB_EXTRA_CCFLAGS@ -LIBS = @LIBS@ @ZLIB_LIBS@ @openssl_libs@ +LIBS = @CLIENT_LIBS@ @ZLIB_LIBS@ @openssl_libs@ - + INCLUDES = @MT_INCLUDES@ \ -I$(top_srcdir)/include $(openssl_includes) @ZLIB_INCLUDES@ --- mysql-4.1.11_alpha20050216.orig/libmysql_r/Makefile.in 2005-02-19 15:58:34.000000000 +0100 diff --git a/035_x86_asm-pic-fixes-r0.patch b/035_x86_asm-pic-fixes-r0.patch deleted file mode 100644 index 300756f..0000000 --- a/035_x86_asm-pic-fixes-r0.patch +++ /dev/null @@ -1,99 +0,0 @@ -###MY_VER_RANGE [4.0.24,4.1_alpha) ---- mysql-4.0.24/strings/longlong2str-x86.s 2005-03-05 00:38:14.000000000 +0000 -+++ mysql-4.0.24-fixed/strings/longlong2str-x86.s 2005-05-17 01:37:52.000000000 +0100 -@@ -19,6 +19,13 @@ - .file "longlong2str.s" - .version "1.01" - -+ .section .rodata -+ .align 32 -+ .type _dig_vec, @object -+ .size _dig_vec, 37 -+_dig_vec: -+ .string "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" -+ - .text - .align 4 - -@@ -31,11 +38,14 @@ longlong2str: - pushl %esi - pushl %edi - pushl %ebx -+ -+ call __i686.get_pc_thunk.bx -+ addl $_GLOBAL_OFFSET_TABLE_,%ebx -+ - movl 100(%esp),%esi # Lower part of val - movl 104(%esp),%ebp # Higher part of val - movl 108(%esp),%edi # get dst -- movl 112(%esp),%ebx # Radix -- movl %ebx,%eax -+ movl 112(%esp),%eax # Radix - testl %eax,%eax - jge .L144 - -@@ -50,7 +60,7 @@ longlong2str: - adcl $0,%ebp - negl %ebp - .L146: -- negl %ebx # Change radix to positive -+ negl 112(%esp) # Change radix to positive - jmp .L148 - .align 4 - .L144: -@@ -77,12 +87,12 @@ longlong2str: - - movl %ebp,%eax # High part of value - xorl %edx,%edx -- divl %ebx -+ divl 112(%esp) - movl %eax,%ebp - movl %esi,%eax -- divl %ebx -+ divl 112(%esp) - movl %eax,%esi # quotent in ebp:esi -- movb _dig_vec(%edx),%al # al is faster than dl -+ movb _dig_vec@GOTOFF(%ebx,%edx),%al # al is faster than dl - decl %ecx - movb %al,(%ecx) # store value in buff - .align 4 -@@ -93,14 +103,13 @@ longlong2str: - jl .L153 - je .L160 # Ready - movl %esi,%eax -- movl $_dig_vec,%ebp - .align 4 - - .L154: # Do rest with integer precision - cltd -- divl %ebx -+ divl 112(%esp) - decl %ecx -- movb (%edx,%ebp),%dl # bh is always zero as ebx=radix < 36 -+ movb _dig_vec@GOTOFF(%ebx,%edx),%dl - testl %eax,%eax - movb %dl,(%ecx) - jne .L154 -@@ -138,3 +147,13 @@ longlong10_to_str: - - .L10end: - .size longlong10_to_str,.L10end-longlong10_to_str -+ -+ .section .gnu.linkonce.t.__i686.get_pc_thunk.bx,"ax",@progbits -+.globl __i686.get_pc_thunk.bx -+ .hidden __i686.get_pc_thunk.bx -+ .type __i686.get_pc_thunk.bx, @function -+__i686.get_pc_thunk.bx: -+ movl (%esp), %ebx -+ ret -+ -+ .section .note.GNU-stack,"",@progbits -diff -Nurp mysql-4.0.24/strings/strings-x86.s mysql-4.0.24-fixed/strings/strings-x86.s ---- mysql-4.0.24/strings/strings-x86.s 2005-03-05 00:38:15.000000000 +0000 -+++ mysql-4.0.24-fixed/strings/strings-x86.s 2005-05-17 01:37:47.000000000 +0100 -@@ -403,3 +403,5 @@ next_str: - ret - .strxmov_end: - .size strxmov,.strxmov_end-strxmov -+ -+ .section .note.GNU-stack,"",@progbits diff --git a/035_x86_asm-pic-fixes-r1.patch b/035_x86_asm-pic-fixes-r1.patch deleted file mode 100644 index 6d6293d..0000000 --- a/035_x86_asm-pic-fixes-r1.patch +++ /dev/null @@ -1,159 +0,0 @@ -###MY_VER_RANGE [4.1,4.1.13-r1) -diff -Nurp mysql/strings/longlong2str-x86.s mysql-fixed/strings/longlong2str-x86.s ---- mysql/strings/longlong2str-x86.s 2005-05-13 12:32:11.000000000 +0100 -+++ mysql-fixed/strings/longlong2str-x86.s 2005-05-25 01:19:32.000000000 +0100 -@@ -19,6 +19,13 @@ - .file "longlong2str.s" - .version "1.01" - -+ .section .rodata -+ .align 32 -+ .type _dig_vec_upper, @object -+ .size _dig_vec_upper, 37 -+_dig_vec_upper: -+ .string "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" -+ - .text - .align 4 - -@@ -31,11 +38,14 @@ longlong2str: - pushl %esi - pushl %edi - pushl %ebx -+ -+ call __i686.get_pc_thunk.bx -+ addl $_GLOBAL_OFFSET_TABLE_,%ebx -+ - movl 100(%esp),%esi # Lower part of val - movl 104(%esp),%ebp # Higher part of val - movl 108(%esp),%edi # get dst -- movl 112(%esp),%ebx # Radix -- movl %ebx,%eax -+ movl 112(%esp),%eax # Radix - testl %eax,%eax - jge .L144 - -@@ -50,7 +60,7 @@ longlong2str: - adcl $0,%ebp - negl %ebp - .L146: -- negl %ebx # Change radix to positive -+ negl 112(%esp) # Change radix to positive - jmp .L148 - .align 4 - .L144: -@@ -77,13 +87,13 @@ longlong2str: - - movl %ebp,%eax # High part of value - xorl %edx,%edx -- divl %ebx -+ divl 112(%esp) - movl %eax,%ebp - movl %esi,%eax -- divl %ebx -+ divl 112(%esp) - decl %ecx - movl %eax,%esi # quotent in ebp:esi -- movb _dig_vec_upper(%edx),%al # al is faster than dl -+ movb _dig_vec_upper@GOTOFF(%ebx,%edx),%al # al is faster than dl - movb %al,(%ecx) # store value in buff - .align 4 - .L155: -@@ -93,14 +103,13 @@ longlong2str: - jl .L153 - je .L10_mov # Ready - movl %esi,%eax -- movl $_dig_vec_upper,%ebp - .align 4 - - .L154: # Do rest with integer precision - cltd -- divl %ebx -+ divl 112(%esp) - decl %ecx -- movb (%edx,%ebp),%dl # bh is always zero as ebx=radix < 36 -+ movb _dig_vec_upper@GOTOFF(%ebx,%edx),%dl - testl %eax,%eax - movb %dl,(%ecx) - jne .L154 -@@ -137,9 +146,6 @@ longlong2str: - # - - .align 4 --.Ltmp: -- .long 0xcccccccd -- .align 4 - - .globl longlong10_to_str - .type longlong10_to_str,@function -@@ -202,7 +208,7 @@ longlong10_to_str: - - # The following code uses some tricks to change division by 10 to - # multiplication and shifts -- movl .Ltmp,%esi # set %esi to 0xcccccccd -+ movl $0xcccccccd,%esi # set %esi to 0xcccccccd - - .L10_40: - movl %ebx,%eax -@@ -221,3 +227,13 @@ longlong10_to_str: - - .L10end: - .size longlong10_to_str,.L10end-longlong10_to_str -+ -+ .section .gnu.linkonce.t.__i686.get_pc_thunk.bx,"ax",@progbits -+.globl __i686.get_pc_thunk.bx -+ .hidden __i686.get_pc_thunk.bx -+ .type __i686.get_pc_thunk.bx, @function -+__i686.get_pc_thunk.bx: -+ movl (%esp), %ebx -+ ret -+ -+ .section .note.GNU-stack,"",@progbits -diff -Nurp mysql/strings/my_strtoll10-x86.s mysql-fixed/strings/my_strtoll10-x86.s ---- mysql/strings/my_strtoll10-x86.s 2005-05-13 12:32:22.000000000 +0100 -+++ mysql-fixed/strings/my_strtoll10-x86.s 2005-05-25 01:13:23.000000000 +0100 -@@ -18,7 +18,7 @@ - - .file "my_strtoll10-x86.s" - .version "01.01" --.data -+.section .rodata - .align 32 - .type lfactor,@object - .size lfactor,36 -@@ -315,7 +315,11 @@ my_strtoll10: - .Lend_i_and_j: - movl %esi,%ecx - subl -12(%ebp),%ecx # ecx= number of digits in second part -- movl lfactor(,%ecx,4),%eax -+ -+ call __i686.get_pc_thunk.bx -+ addl $_GLOBAL_OFFSET_TABLE_,%ebx -+ -+ movl lfactor@GOTOFF(%ebx,%ecx,4),%eax - jmp .L523 - - # Return -8(%ebp) * $1000000000 + edi -@@ -400,3 +404,13 @@ my_strtoll10: - .comm end_ptr,120,32 - .comm error,120,32 - .ident "Monty" -+ -+ .section .gnu.linkonce.t.__i686.get_pc_thunk.bx,"ax",@progbits -+.globl __i686.get_pc_thunk.bx -+ .hidden __i686.get_pc_thunk.bx -+ .type __i686.get_pc_thunk.bx, @function -+__i686.get_pc_thunk.bx: -+ movl (%esp), %ebx -+ ret -+ -+ .section .note.GNU-stack,"",@progbits -diff -Nurp mysql/strings/strings-x86.s mysql-fixed/strings/strings-x86.s ---- mysql/strings/strings-x86.s 2005-05-13 12:32:40.000000000 +0100 -+++ mysql-fixed/strings/strings-x86.s 2005-05-23 23:19:13.000000000 +0100 -@@ -415,3 +415,5 @@ next_str: - ret - .strxmov_end: - .size strxmov,.strxmov_end-strxmov -+ -+ .section .note.GNU-stack,"",@progbits diff --git a/035_x86_asm-pic-fixes-r2.patch b/035_x86_asm-pic-fixes-r2.patch deleted file mode 100644 index 4a089a3..0000000 --- a/035_x86_asm-pic-fixes-r2.patch +++ /dev/null @@ -1,343 +0,0 @@ -###MY_VER_RANGE [4.1.13-r1,4.1.13-r1] [5.0.9_beta-r2,5.0.9_beta-r2] -diff -aur mysql.orig/strings/longlong2str-x86.s mysql.notextrel/strings/longlong2str-x86.s ---- mysql.orig/strings/longlong2str-x86.s 2005-07-26 17:52:18.000000000 +0200 -+++ mysql.notextrel/strings/longlong2str-x86.s 2005-07-26 19:29:23.000000000 +0200 -@@ -13,8 +13,9 @@ - # along with this program; if not, write to the Free Software - # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - --# Optimized longlong2str function for Intel 80x86 (gcc/gas syntax) --# Some set sequences are optimized for pentuimpro II -+# longlong2str function for Intel 80x86 (gcc/gas syntax) -+ -+# See longlong2str(dst,radix,val) description in longlong2str.c. - - .file "longlong2str.s" - .version "1.01" -@@ -24,99 +25,88 @@ - - .globl longlong2str - .type longlong2str,@function -- -+ - longlong2str: -- subl $80,%esp -+ subl $80,%esp # Temporary buffer for up to 64 radix-2 digits - pushl %ebp - pushl %esi - pushl %edi - pushl %ebx -- movl 100(%esp),%esi # Lower part of val -- movl 104(%esp),%ebp # Higher part of val -- movl 108(%esp),%edi # get dst -- movl 112(%esp),%ebx # Radix -- movl %ebx,%eax -- testl %eax,%eax -- jge .L144 -- -- addl $36,%eax -- cmpl $34,%eax -- ja .Lerror # Wrong radix -+ -+ movl 100(%esp),%esi # esi = Lower part of val -+ movl 112(%esp),%ebx # ebx = Radix -+ movl 104(%esp),%ebp # ebp = Higher part of val -+ movl 108(%esp),%edi # edi -> dst -+ -+ testl %ebx,%ebx -+ jge .L144 # (Radix >= 0) -+ - testl %ebp,%ebp -- jge .L146 -- movb $45,(%edi) # Add sign -- incl %edi # Change sign of val -- negl %esi -- adcl $0,%ebp -- negl %ebp -+ jge .L146 # (Higher part of val >= 0) -+ movb $45,(%edi) # Add '-' sign -+ incl %edi -+ negl %esi # Change val to positive -+ adcl $0,%ebp -+ negl %ebp - .L146: -- negl %ebx # Change radix to positive -- jmp .L148 -- .align 4 -+ negl %ebx # Change radix to positive - .L144: -- addl $-2,%eax -- cmpl $34,%eax -- ja .Lerror # Radix in range -+ cmpl $36,%ebx # Radix must be between 2 and 36 -+ ja .Lerror # (Radix not in range) -+ cmpl $2,%ebx -+ jb .Lerror # (Radix not in range) -+ -+ movl %esi,%eax # eax = lower part of val ... -+ orl %ebp,%eax # and it stays thus if ebp=0 -+ je Lzero # (Treat zero as special case) - --.L148: -- movl %esi,%eax # Test if zero (for easy loop) -- orl %ebp,%eax -- jne .L150 -- movb $48,(%edi) -- incl %edi -- jmp .L10_end -- .align 4 -- --.L150: -- leal 92(%esp),%ecx # End of buffer -- jmp .L155 -- .align 4 -- --.L153: -- # val is stored in in ebp:esi -- -- movl %ebp,%eax # High part of value -- xorl %edx,%edx -- divl %ebx -- movl %eax,%ebp -- movl %esi,%eax -- divl %ebx -- decl %ecx -- movl %eax,%esi # quotent in ebp:esi -- movb _dig_vec_upper(%edx),%al # al is faster than dl -- movb %al,(%ecx) # store value in buff -- .align 4 --.L155: -+ leal 92(%esp),%ecx # ecx -> End of temporary buffer -+ - testl %ebp,%ebp -- ja .L153 -- testl %esi,%esi # rest value -- jl .L153 -- je .L10_mov # Ready -- movl %esi,%eax -- movl $_dig_vec_upper,%ebp -- .align 4 -- --.L154: # Do rest with integer precision -- cltd -- divl %ebx -- decl %ecx -- movb (%edx,%ebp),%dl # bh is always zero as ebx=radix < 36 -- testl %eax,%eax -- movb %dl,(%ecx) -- jne .L154 -- --.L10_mov: -- movl %ecx,%esi -- leal 92(%esp),%ecx # End of buffer -- subl %esi,%ecx -- rep -- movsb -- --.L10_end: -- movl %edi,%eax # Pointer to end null -- movb $0,(%edi) # Store the end null -- --.L165: -+ je Llow # (Higher part of val = 0) -+ -+Lhigh: -+ #val in ebp:esi. div the high part by the radix, -+ #then div remainder + low part by the radix. -+ movl %ebp,%eax # edx=0,eax=high(from ebp) -+ xorl %edx,%edx -+ decl %ecx -+ divl %ebx -+ movl %eax,%ebp # edx=result of last, eax=low(from esi) -+ movl %esi,%eax -+ divl %ebx -+ movl %eax,%esi # ebp:esi = quotient -+ movb %dl,(%ecx) # store byte in temporary buffer -+ testl %ebp,%ebp -+ jne Lhigh # (Higher part of val still > 0) -+ -+Llow: -+ #val in 0:eax. div 0 + low part by the radix. -+ xorl %edx,%edx -+ decl %ecx -+ divl %ebx -+ movb %dl,(%ecx) # store byte in temporary buffer -+ testl %eax,%eax -+ jne Llow # (Lower part of val still <> 0) -+ -+ leal 92(%esp),%esi # esi -> End of temporary buffer -+ -+Lmov: -+ movb (%ecx),%dl # dl = byte from temporary buffer -+ movb $-1,%bl -+ cmpb $10,%dl # add 7 if dl > '9' -+ adcb $0,%bl -+ addb $48,%dl # add '0' -+ andb $7,%bl -+ addb %bl,%dl -+ incl %ecx -+ movb %dl,(%edi) # put dl in dst -+ incl %edi -+ cmpl %ecx,%esi -+ ja Lmov # (more bytes exist in temporary buffer) -+ movb $0,(%edi) # trailing '\0' in dst -+ movl %edi,%eax # eax = return value = pointer to '\0' -+.Lret: - popl %ebx - popl %edi - popl %esi -@@ -126,20 +116,28 @@ - - .Lerror: - xorl %eax,%eax # Wrong radix -- jmp .L165 -+ jmp .Lret - --.Lfe3: -- .size longlong2str,.Lfe3-longlong2str -+Lzero: -+ # Treat 0 as a special case. Unnecessary but we -+ # expect 0 will be frequent. -+ movl 108(%esp),%eax # eax = dst -+ popl %ebx -+ movb $48,(%eax) # '0' -+ popl %edi -+ incl %eax -+ popl %esi -+ popl %ebp -+ addl $80,%esp -+ movb $0,(%eax) # '\0' -+ ret - - # - # This is almost equal to the above, except that we can do the final - # loop much more efficient --# -+# - - .align 4 --.Ltmp: -- .long 0xcccccccd -- .align 4 - - .globl longlong10_to_str - .type longlong10_to_str,@function -@@ -202,7 +200,7 @@ - - # The following code uses some tricks to change division by 10 to - # multiplication and shifts -- movl .Ltmp,%esi # set %esi to 0xcccccccd -+ movl $0xcccccccd,%esi # set %esi to 0xcccccccd - - .L10_40: - movl %ebx,%eax -@@ -217,7 +215,30 @@ - movl %edx,%ebx - testl %ebx,%ebx - jne .L10_40 -- jmp .L10_mov # Shared end with longlong10_to_str -+# jmp .L10_mov # Shared end with longlong10_to_str -+ - -+.L10_mov: -+ movl %ecx,%esi -+ leal 92(%esp),%ecx # End of buffer -+ subl %esi,%ecx -+ rep -+ movsb -+ -+.L10_end: -+ movl %edi,%eax # Pointer to end null -+ movb $0,(%edi) # Store the end null -+ -+.L165: -+ popl %ebx -+ popl %edi -+ popl %esi -+ popl %ebp -+ addl $80,%esp -+ ret -+ - .L10end: - .size longlong10_to_str,.L10end-longlong10_to_str -+ -+ .section .note.GNU-stack,"",@progbits -+ -diff -aur mysql.orig/strings/my_strtoll10-x86.s mysql.notextrel/strings/my_strtoll10-x86.s ---- mysql.orig/strings/my_strtoll10-x86.s 2005-07-26 17:52:18.000000000 +0200 -+++ mysql.notextrel/strings/my_strtoll10-x86.s 2005-07-26 19:29:33.000000000 +0200 -@@ -18,20 +18,7 @@ - - .file "my_strtoll10-x86.s" - .version "01.01" --.data -- .align 32 -- .type lfactor,@object -- .size lfactor,36 --lfactor: -- .long 1 -- .long 10 -- .long 100 -- .long 1000 -- .long 10000 -- .long 100000 -- .long 1000000 -- .long 10000000 -- .long 100000000 -+ - .text - .align 4 - -@@ -315,9 +302,32 @@ - .Lend_i_and_j: - movl %esi,%ecx - subl -12(%ebp),%ecx # ecx= number of digits in second part -- movl lfactor(,%ecx,4),%eax -- jmp .L523 -- -+ movl $1,%eax -+ cmpb $0,%cl -+ je .L523 # 0 so 1 -+ movl $10,%eax -+ cmpb $1,%cl -+ je .L523 # 1 so 10 -+ movl $100,%eax -+ cmpb $2,%cl -+ je .L523 # 2 so 100 -+ movl $1000,%eax -+ cmpb $3,%cl -+ je .L523 # 3 so 1000 -+ movl $10000,%eax -+ cmpb $4,%cl -+ je .L523 # 4 so 10000 -+ movl $100000,%eax -+ cmpb $5,%cl -+ je .L523 # 5 so 100000 -+ movl $1000000,%eax -+ cmpb $6,%cl -+ je .L523 # 6 so 1000000 -+ movl $10000000,%eax -+ cmpb $7,%cl -+ je .L523 # 7 so 10000000 -+ movl $100000000,%eax -+ jmp .L523 # 8 so 100000000 - # Return -8(%ebp) * $1000000000 + edi - .p2align 4,,7 - .Lend3: -@@ -400,3 +410,6 @@ - .comm end_ptr,120,32 - .comm error,120,32 - .ident "Monty" -+ -+ .section .note.GNU-stack,"",@progbits -+ -diff -aur mysql.orig/strings/strings-x86.s mysql.notextrel/strings/strings-x86.s ---- mysql.orig/strings/strings-x86.s 2005-07-26 17:52:18.000000000 +0200 -+++ mysql.notextrel/strings/strings-x86.s 2005-07-26 19:29:42.000000000 +0200 -@@ -415,3 +415,6 @@ - ret - .strxmov_end: - .size strxmov,.strxmov_end-strxmov -+ -+ .section .note.GNU-stack,"",@progbits -+ diff --git a/035_x86_asm-pic-fixes-r3.patch b/035_x86_asm-pic-fixes-r3.patch deleted file mode 100644 index a6836d0..0000000 --- a/035_x86_asm-pic-fixes-r3.patch +++ /dev/null @@ -1,365 +0,0 @@ -###MY_VER_RANGE [4.1.13-r2,4.1.14_alpha20050816) - -FOLLOWING THE ORIGINAL PATCH COMMIT COMMENTS: - -ChangeSet - 1.2356 05/08/08 13:18:18 monty@mishka.local +6 -0 - Fix for BUG #11642: [Patch]es x86 Assembler and text relocations - Changed assembler functions to not access global variables or variables in text segement - Added wrapper function in C to longlong2str() to pass _dig_vec_upper as an argument - - strings/longlong2str_asm.c - 1.1 05/08/08 13:18:12 monty@mishka.local +33 -0 - New BitKeeper file ``strings/longlong2str_asm.c'' - - strings/my_strtoll10-x86.s - 1.4 05/08/08 13:18:12 monty@mishka.local +39 -23 - Removd array lfactor by calculating the value in code - (this is to to make the code position independent) - - strings/longlong2str_asm.c - 1.0 05/08/08 13:18:12 monty@mishka.local +0 -0 - BitKeeper file /home/my/mysql-4.1/strings/longlong2str_asm.c - - strings/longlong2str-x86.s - 1.11 05/08/08 13:18:12 monty@mishka.local +18 -17 - Changed functions to not access variables in text segment - Fixed this by adding global variable '_dig_vec_upper' as an argument to longlong2str_with_dig_vector() - - strings/Makefile.am - 1.43 05/08/08 13:18:12 monty@mishka.local +2 -2 - Added longlong2str_asm.c - - mysql-test/t/bigint.test - 1.24 05/08/08 13:18:11 monty@mishka.local +3 -0 - More tests for parsing of bigint's - More tests for different values to conv() - - mysql-test/r/bigint.result - 1.25 05/08/08 13:18:11 monty@mishka.local +9 -0 - More tests for parsing of bigint's - More tests for different values to conv() - -REAPPLIED PATCH FROM HERE: -PLUS ".section .note.GNU-stack,"",@progbits" - -diff -Naur mysql.orig/mysql-test/r/bigint.result mysql.new/mysql-test/r/bigint.result ---- mysql.orig/mysql-test/r/bigint.result 2005-07-15 12:50:20.000000000 +0200 -+++ mysql.new/mysql-test/r/bigint.result 2005-08-08 22:21:46.000000000 +0200 -@@ -17,6 +17,15 @@ - select -(0-3),round(-(0-3)), round(9999999999999999999); - -(0-3) round(-(0-3)) round(9999999999999999999) - 3 3 10000000000000000000 -+select 1,11,101,1001,10001,100001,1000001,10000001,100000001,1000000001,10000000001,100000000001,1000000000001,10000000000001,100000000000001,1000000000000001,10000000000000001,100000000000000001,1000000000000000001,10000000000000000001; -+1 11 101 1001 10001 100001 1000001 10000001 100000001 1000000001 10000000001 100000000001 1000000000001 10000000000001 100000000000001 1000000000000001 10000000000000001 100000000000000001 1000000000000000001 10000000000000000001 -+1 11 101 1001 10001 100001 1000001 10000001 100000001 1000000001 10000000001 100000000001 1000000000001 10000000000001 100000000000001 1000000000000001 10000000000000001 100000000000000001 1000000000000000001 10000000000000000001 -+select -1,-11,-101,-1001,-10001,-100001,-1000001,-10000001,-100000001,-1000000001,-10000000001,-100000000001,-1000000000001,-10000000000001,-100000000000001,-1000000000000001,-10000000000000001,-100000000000000001,-1000000000000000001,-10000000000000000001; -+-1 -11 -101 -1001 -10001 -100001 -1000001 -10000001 -100000001 -1000000001 -10000000001 -100000000001 -1000000000001 -10000000000001 -100000000000001 -1000000000000001 -10000000000000001 -100000000000000001 -1000000000000000001 -10000000000000000001 -+-1 -11 -101 -1001 -10001 -100001 -1000001 -10000001 -100000001 -1000000001 -10000000001 -100000000001 -1000000000001 -10000000000001 -100000000000001 -1000000000000001 -10000000000000001 -100000000000000001 -1000000000000000001 -10000000000000000000 -+select conv(1,10,16),conv((1<<2)-1,10,16),conv((1<<10)-2,10,16),conv((1<<16)-3,10,16),conv((1<<25)-4,10,16),conv((1<<31)-5,10,16),conv((1<<36)-6,10,16),conv((1<<47)-7,10,16),conv((1<<48)-8,10,16),conv((1<<55)-9,10,16),conv((1<<56)-10,10,16),conv((1<<63)-11,10,16); -+conv(1,10,16) conv((1<<2)-1,10,16) conv((1<<10)-2,10,16) conv((1<<16)-3,10,16) conv((1<<25)-4,10,16) conv((1<<31)-5,10,16) conv((1<<36)-6,10,16) conv((1<<47)-7,10,16) conv((1<<48)-8,10,16) conv((1<<55)-9,10,16) conv((1<<56)-10,10,16) conv((1<<63)-11,10,16) -+1 3 3FE FFFD 1FFFFFC 7FFFFFFB FFFFFFFFA 7FFFFFFFFFF9 FFFFFFFFFFF8 7FFFFFFFFFFFF7 FFFFFFFFFFFFF6 7FFFFFFFFFFFFFF5 - create table t1 (a bigint unsigned not null, primary key(a)); - insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612); - select * from t1; -diff -Naur mysql.orig/mysql-test/t/bigint.test mysql.new/mysql-test/t/bigint.test ---- mysql.orig/mysql-test/t/bigint.test 2005-07-15 12:50:20.000000000 +0200 -+++ mysql.new/mysql-test/t/bigint.test 2005-08-08 22:21:46.000000000 +0200 -@@ -14,6 +14,9 @@ - select cast(9223372036854775808 as unsigned)+1; - select 9223372036854775808+1; - select -(0-3),round(-(0-3)), round(9999999999999999999); -+select 1,11,101,1001,10001,100001,1000001,10000001,100000001,1000000001,10000000001,100000000001,1000000000001,10000000000001,100000000000001,1000000000000001,10000000000000001,100000000000000001,1000000000000000001,10000000000000000001; -+select -1,-11,-101,-1001,-10001,-100001,-1000001,-10000001,-100000001,-1000000001,-10000000001,-100000000001,-1000000000001,-10000000000001,-100000000000001,-1000000000000001,-10000000000000001,-100000000000000001,-1000000000000000001,-10000000000000000001; -+select conv(1,10,16),conv((1<<2)-1,10,16),conv((1<<10)-2,10,16),conv((1<<16)-3,10,16),conv((1<<25)-4,10,16),conv((1<<31)-5,10,16),conv((1<<36)-6,10,16),conv((1<<47)-7,10,16),conv((1<<48)-8,10,16),conv((1<<55)-9,10,16),conv((1<<56)-10,10,16),conv((1<<63)-11,10,16); - - # - # In 3.23 we have to disable the test of column to bigint as -diff -Naur mysql.orig/strings/Makefile.am mysql.new/strings/Makefile.am ---- mysql.orig/strings/Makefile.am 2005-07-15 12:39:35.000000000 +0200 -+++ mysql.new/strings/Makefile.am 2005-08-08 22:21:46.000000000 +0200 -@@ -23,7 +23,7 @@ - # Exact one of ASSEMBLER_X - if ASSEMBLER_x86 - ASRCS = strings-x86.s longlong2str-x86.s my_strtoll10-x86.s --CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c ctype-extra.c -+CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c ctype-extra.c longlong2str_asm.c - else - if ASSEMBLER_sparc32 - # These file MUST all be on the same line!! Otherwise automake -@@ -46,7 +46,7 @@ - ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-utf8.c \ - ctype-ucs2.c ctype-uca.c ctype-tis620.c ctype-ujis.c \ - xml.c strto.c strings-x86.s \ -- longlong2str.c longlong2str-x86.s \ -+ longlong2str.c longlong2str-x86.s longlong2str_asm.c \ - my_strtoll10.c my_strtoll10-x86.s \ - strxmov.c bmove_upp.c strappend.c strcont.c strend.c \ - strfill.c strcend.c is_prefix.c strstr.c strinstr.c \ -diff -Naur mysql.orig/strings/longlong2str-x86.s mysql.new/strings/longlong2str-x86.s ---- mysql.orig/strings/longlong2str-x86.s 2005-07-15 12:39:33.000000000 +0200 -+++ mysql.new/strings/longlong2str-x86.s 2005-08-08 22:52:38.000000000 +0200 -@@ -16,26 +16,26 @@ - # Optimized longlong2str function for Intel 80x86 (gcc/gas syntax) - # Some set sequences are optimized for pentuimpro II - -- .file "longlong2str.s" -- .version "1.01" -+ .file "longlong2str-x86.s" -+ .version "1.02" - - .text - .align 4 - --.globl longlong2str -- .type longlong2str,@function -+.globl longlong2str_with_dig_vector -+ .type longlong2str_with_dig_vector,@function - --longlong2str: -+longlong2str_with_dig_vector: - subl $80,%esp - pushl %ebp - pushl %esi - pushl %edi - pushl %ebx - movl 100(%esp),%esi # Lower part of val -- movl 104(%esp),%ebp # Higher part of val -- movl 108(%esp),%edi # get dst - movl 112(%esp),%ebx # Radix -+ movl 104(%esp),%ebp # Higher part of val - movl %ebx,%eax -+ movl 108(%esp),%edi # get dst - testl %eax,%eax - jge .L144 - -@@ -69,6 +69,8 @@ - - .L150: - leal 92(%esp),%ecx # End of buffer -+ movl %edi, 108(%esp) # Store possible modified dest -+ movl 116(%esp), %edi # dig_vec_upper - jmp .L155 - .align 4 - -@@ -83,7 +85,7 @@ - divl %ebx - decl %ecx - movl %eax,%esi # quotent in ebp:esi -- movb _dig_vec_upper(%edx),%al # al is faster than dl -+ movb (%edx,%edi),%al # al is faster than dl - movb %al,(%ecx) # store value in buff - .align 4 - .L155: -@@ -91,20 +93,22 @@ - ja .L153 - testl %esi,%esi # rest value - jl .L153 -- je .L10_mov # Ready -+ je .L160 # Ready - movl %esi,%eax -- movl $_dig_vec_upper,%ebp - .align 4 - - .L154: # Do rest with integer precision - cltd - divl %ebx - decl %ecx -- movb (%edx,%ebp),%dl # bh is always zero as ebx=radix < 36 -+ movb (%edx,%edi),%dl # bh is always zero as ebx=radix < 36 - testl %eax,%eax - movb %dl,(%ecx) - jne .L154 - -+.L160: -+ movl 108(%esp),%edi # get dst -+ - .L10_mov: - movl %ecx,%esi - leal 92(%esp),%ecx # End of buffer -@@ -129,7 +133,7 @@ - jmp .L165 - - .Lfe3: -- .size longlong2str,.Lfe3-longlong2str -+ .size longlong2str_with_dig_vector,.Lfe3-longlong2str_with_dig_vector - - # - # This is almost equal to the above, except that we can do the final -@@ -137,9 +141,6 @@ - # - - .align 4 --.Ltmp: -- .long 0xcccccccd -- .align 4 - - .globl longlong10_to_str - .type longlong10_to_str,@function -@@ -202,8 +203,8 @@ - - # The following code uses some tricks to change division by 10 to - # multiplication and shifts -- movl .Ltmp,%esi # set %esi to 0xcccccccd -- -+ movl $0xcccccccd,%esi -+ - .L10_40: - movl %ebx,%eax - mull %esi -@@ -221,3 +222,6 @@ - - .L10end: - .size longlong10_to_str,.L10end-longlong10_to_str -+ -+ .section .note.GNU-stack,"",@progbits -+ -diff -Naur mysql.orig/strings/longlong2str_asm.c mysql.new/strings/longlong2str_asm.c ---- mysql.orig/strings/longlong2str_asm.c 1970-01-01 01:00:00.000000000 +0100 -+++ mysql.new/strings/longlong2str_asm.c 2005-08-08 22:23:33.000000000 +0200 -@@ -0,0 +1,34 @@ -+/* Copyright (C) 2000 MySQL AB -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -+ -+/* -+ * Wrapper for longlong2str.s -+ * -+ * We need this because the assembler code can't access the local variable -+ * _dig_vector in a portable manner. -+ */ -+ -+#include <my_global.h> -+#include "m_string.h" -+ -+extern char *longlong2str_with_dig_vector(longlong val,char *dst,int radix, -+ const char *dig_vector); -+ -+char *longlong2str(longlong val,char *dst,int radix) -+{ -+ return longlong2str_with_dig_vector(val, dst, radix, _dig_vec_upper); -+} -+ -diff -Naur mysql.orig/strings/my_strtoll10-x86.s mysql.new/strings/my_strtoll10-x86.s ---- mysql.orig/strings/my_strtoll10-x86.s 2005-07-15 12:39:34.000000000 +0200 -+++ mysql.new/strings/my_strtoll10-x86.s 2005-08-08 22:52:51.000000000 +0200 -@@ -17,21 +17,8 @@ - # For documentation, check my_strtoll.c - - .file "my_strtoll10-x86.s" -- .version "01.01" --.data -- .align 32 -- .type lfactor,@object -- .size lfactor,36 --lfactor: -- .long 1 -- .long 10 -- .long 100 -- .long 1000 -- .long 10000 -- .long 100000 -- .long 1000000 -- .long 10000000 -- .long 100000000 -+ .version "01.02" -+ - .text - .align 4 - -@@ -209,14 +196,16 @@ - jne .L500 - cmpl -36(%ebp),%esi # Test if string is less than 18 digits - jne .Lend_i_and_j -- jmp .Lend3 # 18 digit string -+.L499: -+ movl $1000000000,%eax -+ jmp .Lgot_factor # 18 digit string - - # Handle the possible next to last digit and store in ecx - .L500: - movb (%esi),%al - addb $-48,%al - cmpb $9,%al -- ja .Lend3 -+ ja .L499 # 18 digit string - - incl %esi - movzbl %al,%ecx -@@ -315,14 +304,41 @@ - .Lend_i_and_j: - movl %esi,%ecx - subl -12(%ebp),%ecx # ecx= number of digits in second part -- movl lfactor(,%ecx,4),%eax -- jmp .L523 - -- # Return -8(%ebp) * $1000000000 + edi -+ # Calculate %eax= 10 ** %cl, where %cl <= 8 -+ # With an array one could do this with: -+ # movl 10_factor_table(,%ecx,4),%eax -+ # We calculate the table here to avoid problems in -+ # position independent code (gcc -pic) -+ -+ cmpb $3,%cl -+ ja .L4_to_8 -+ movl $1000, %eax -+ je .Lgot_factor # %cl=3, eax= 1000 -+ movl $10, %eax -+ cmpb $1,%cl # %cl is here 0 - 2 -+ je .Lgot_factor # %cl=1, eax= 10 -+ movl $100, %eax -+ ja .Lgot_factor # %cl=2, eax=100 -+ movl $1, %eax -+ jmp .Lgot_factor # %cl=0, eax=1 -+ -+.L4_to_8: # %cl is here 4-8 -+ cmpb $5,%cl -+ movl $100000, %eax -+ je .Lgot_factor # %cl=5, eax=100000 -+ movl $10000, %eax -+ jbe .Lgot_factor # %cl=4, eax=10000 -+ movl $10000000, %eax -+ cmpb $7,%cl -+ je .Lgot_factor # %cl=7, eax=10000000 -+ movl $100000000, %eax -+ ja .Lgot_factor # %cl=8, eax=100000000 -+ movl $1000000, %eax # %cl=6, eax=1000000 -+ -+ # Return -8(%ebp) * %eax + edi - .p2align 4,,7 --.Lend3: -- movl $1000000000,%eax --.L523: -+.Lgot_factor: - mull -8(%ebp) - addl %edi,%eax - adcl $0,%edx -@@ -400,3 +416,6 @@ - .comm end_ptr,120,32 - .comm error,120,32 - .ident "Monty" -+ -+ .section .note.GNU-stack,"",@progbits -+ -diff -Naur mysql.orig/strings/strings-x86.s mysql.new/strings/strings-x86.s ---- mysql.orig/strings/strings-x86.s 2005-07-15 12:39:36.000000000 +0200 -+++ mysql.new/strings/strings-x86.s 2005-08-08 22:53:00.000000000 +0200 -@@ -415,3 +415,6 @@ - ret - .strxmov_end: - .size strxmov,.strxmov_end-strxmov -+ -+ .section .note.GNU-stack,"",@progbits -+ diff --git a/035_x86_asm-pic-fixes-r4.patch b/035_x86_asm-pic-fixes-r4.patch deleted file mode 100644 index 308b6e5..0000000 --- a/035_x86_asm-pic-fixes-r4.patch +++ /dev/null @@ -1,365 +0,0 @@ -###MY_VER_RANGE [5.0.10_beta-r1,5.0.10_beta-r1] - -FOLLOWING THE ORIGINAL PATCH COMMIT COMMENTS: - -ChangeSet - 1.2356 05/08/08 13:18:18 monty@mishka.local +6 -0 - Fix for BUG #11642: [Patch]es x86 Assembler and text relocations - Changed assembler functions to not access global variables or variables in text segement - Added wrapper function in C to longlong2str() to pass _dig_vec_upper as an argument - - strings/longlong2str_asm.c - 1.1 05/08/08 13:18:12 monty@mishka.local +33 -0 - New BitKeeper file ``strings/longlong2str_asm.c'' - - strings/my_strtoll10-x86.s - 1.4 05/08/08 13:18:12 monty@mishka.local +39 -23 - Removd array lfactor by calculating the value in code - (this is to to make the code position independent) - - strings/longlong2str_asm.c - 1.0 05/08/08 13:18:12 monty@mishka.local +0 -0 - BitKeeper file /home/my/mysql-4.1/strings/longlong2str_asm.c - - strings/longlong2str-x86.s - 1.11 05/08/08 13:18:12 monty@mishka.local +18 -17 - Changed functions to not access variables in text segment - Fixed this by adding global variable '_dig_vec_upper' as an argument to longlong2str_with_dig_vector() - - strings/Makefile.am - 1.43 05/08/08 13:18:12 monty@mishka.local +2 -2 - Added longlong2str_asm.c - - mysql-test/t/bigint.test - 1.24 05/08/08 13:18:11 monty@mishka.local +3 -0 - More tests for parsing of bigint's - More tests for different values to conv() - - mysql-test/r/bigint.result - 1.25 05/08/08 13:18:11 monty@mishka.local +9 -0 - More tests for parsing of bigint's - More tests for different values to conv() - -REAPPLIED PATCH FROM HERE: -PLUS ".section .note.GNU-stack,"",@progbits" - - -diff -Naur mysql.orig/mysql-test/t/bigint.test mysql.new/mysql-test/t/bigint.test ---- mysql.orig/mysql-test/t/bigint.test 2005-08-08 22:39:10.000000000 +0200 -+++ mysql.new/mysql-test/t/bigint.test 2005-08-08 22:41:29.000000000 +0200 -@@ -14,6 +14,9 @@ - select cast(9223372036854775808 as unsigned)+1; - select 9223372036854775808+1; - select -(0-3),round(-(0-3)), round(9999999999999999999); -+select 1,11,101,1001,10001,100001,1000001,10000001,100000001,1000000001,10000000001,100000000001,1000000000001,10000000000001,100000000000001,1000000000000001,10000000000000001,100000000000000001,1000000000000000001,10000000000000000001; -+select -1,-11,-101,-1001,-10001,-100001,-1000001,-10000001,-100000001,-1000000001,-10000000001,-100000000001,-1000000000001,-10000000000001,-100000000000001,-1000000000000001,-10000000000000001,-100000000000000001,-1000000000000000001,-10000000000000000000; -+select conv(1,10,16),conv((1<<2)-1,10,16),conv((1<<10)-2,10,16),conv((1<<16)-3,10,16),conv((1<<25)-4,10,16),conv((1<<31)-5,10,16),conv((1<<36)-6,10,16),conv((1<<47)-7,10,16),conv((1<<48)-8,10,16),conv((1<<55)-9,10,16),conv((1<<56)-10,10,16),conv((1<<63)-11,10,16); - - # - # In 3.23 we have to disable the test of column to bigint as -diff -Naur mysql.orig/strings/Makefile.am mysql.new/strings/Makefile.am ---- mysql.orig/strings/Makefile.am 2005-08-08 22:39:10.000000000 +0200 -+++ mysql.new/strings/Makefile.am 2005-08-08 22:41:29.000000000 +0200 -@@ -22,7 +22,7 @@ - # Exact one of ASSEMBLER_X - if ASSEMBLER_x86 - ASRCS = strings-x86.s longlong2str-x86.s my_strtoll10-x86.s --CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c -+CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c longlong2str_asm.c - else - if ASSEMBLER_sparc32 - # These file MUST all be on the same line!! Otherwise automake -@@ -45,7 +45,7 @@ - ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-utf8.c \ - ctype-ucs2.c ctype-uca.c ctype-tis620.c ctype-ujis.c \ - xml.c decimal.c strto.c strings-x86.s \ -- longlong2str.c longlong2str-x86.s \ -+ longlong2str.c longlong2str-x86.s longlong2str_asm.c \ - my_strtoll10.c my_strtoll10-x86.s \ - strxmov.c bmove_upp.c strappend.c strcont.c strend.c \ - strfill.c strcend.c is_prefix.c strstr.c strinstr.c \ -diff -Naur mysql.orig/strings/longlong2str-x86.s mysql.new/strings/longlong2str-x86.s ---- mysql.orig/strings/longlong2str-x86.s 2005-08-08 22:39:10.000000000 +0200 -+++ mysql.new/strings/longlong2str-x86.s 2005-08-08 22:44:14.000000000 +0200 -@@ -16,26 +16,26 @@ - # Optimized longlong2str function for Intel 80x86 (gcc/gas syntax) - # Some set sequences are optimized for pentuimpro II - -- .file "longlong2str.s" -- .version "1.01" -+ .file "longlong2str-x86.s" -+ .version "1.02" - - .text - .align 4 - --.globl longlong2str -- .type longlong2str,@function -+.globl longlong2str_with_dig_vector -+ .type longlong2str_with_dig_vector,@function - --longlong2str: -+longlong2str_with_dig_vector: - subl $80,%esp - pushl %ebp - pushl %esi - pushl %edi - pushl %ebx - movl 100(%esp),%esi # Lower part of val -- movl 104(%esp),%ebp # Higher part of val -- movl 108(%esp),%edi # get dst - movl 112(%esp),%ebx # Radix -+ movl 104(%esp),%ebp # Higher part of val - movl %ebx,%eax -+ movl 108(%esp),%edi # get dst - testl %eax,%eax - jge .L144 - -@@ -69,6 +69,8 @@ - - .L150: - leal 92(%esp),%ecx # End of buffer -+ movl %edi, 108(%esp) # Store possible modified dest -+ movl 116(%esp), %edi # dig_vec_upper - jmp .L155 - .align 4 - -@@ -83,7 +85,7 @@ - divl %ebx - decl %ecx - movl %eax,%esi # quotent in ebp:esi -- movb _dig_vec_upper(%edx),%al # al is faster than dl -+ movb (%edx,%edi),%al # al is faster than dl - movb %al,(%ecx) # store value in buff - .align 4 - .L155: -@@ -91,20 +93,22 @@ - ja .L153 - testl %esi,%esi # rest value - jl .L153 -- je .L10_mov # Ready -+ je .L160 # Ready - movl %esi,%eax -- movl $_dig_vec_upper,%ebp - .align 4 - - .L154: # Do rest with integer precision - cltd - divl %ebx - decl %ecx -- movb (%edx,%ebp),%dl # bh is always zero as ebx=radix < 36 -+ movb (%edx,%edi),%dl # bh is always zero as ebx=radix < 36 - testl %eax,%eax - movb %dl,(%ecx) - jne .L154 - -+.L160: -+ movl 108(%esp),%edi # get dst -+ - .L10_mov: - movl %ecx,%esi - leal 92(%esp),%ecx # End of buffer -@@ -129,7 +133,7 @@ - jmp .L165 - - .Lfe3: -- .size longlong2str,.Lfe3-longlong2str -+ .size longlong2str_with_dig_vector,.Lfe3-longlong2str_with_dig_vector - - # - # This is almost equal to the above, except that we can do the final -@@ -137,9 +141,6 @@ - # - - .align 4 --.Ltmp: -- .long 0xcccccccd -- .align 4 - - .globl longlong10_to_str - .type longlong10_to_str,@function -@@ -202,8 +203,8 @@ - - # The following code uses some tricks to change division by 10 to - # multiplication and shifts -- movl .Ltmp,%esi # set %esi to 0xcccccccd -- -+ movl $0xcccccccd,%esi -+ - .L10_40: - movl %ebx,%eax - mull %esi -@@ -221,3 +222,6 @@ - - .L10end: - .size longlong10_to_str,.L10end-longlong10_to_str -+ -+ .section .note.GNU-stack,"",@progbits -+ -diff -Naur mysql.orig/strings/longlong2str_asm.c mysql.new/strings/longlong2str_asm.c ---- mysql.orig/strings/longlong2str_asm.c 1970-01-01 01:00:00.000000000 +0100 -+++ mysql.new/strings/longlong2str_asm.c 2005-08-08 22:39:10.000000000 +0200 -@@ -0,0 +1,34 @@ -+/* Copyright (C) 2000 MySQL AB -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -+ -+/* -+ * Wrapper for longlong2str.s -+ * -+ * We need this because the assembler code can't access the local variable -+ * _dig_vector in a portable manner. -+ */ -+ -+#include <my_global.h> -+#include "m_string.h" -+ -+extern char *longlong2str_with_dig_vector(longlong val,char *dst,int radix, -+ const char *dig_vector); -+ -+char *longlong2str(longlong val,char *dst,int radix) -+{ -+ return longlong2str_with_dig_vector(val, dst, radix, _dig_vec_upper); -+} -+ -diff -Naur mysql.orig/strings/my_strtoll10-x86.s mysql.new/strings/my_strtoll10-x86.s ---- mysql.orig/strings/my_strtoll10-x86.s 2005-08-08 22:39:10.000000000 +0200 -+++ mysql.new/strings/my_strtoll10-x86.s 2005-08-08 22:44:23.000000000 +0200 -@@ -17,21 +17,8 @@ - # For documentation, check my_strtoll.c - - .file "my_strtoll10-x86.s" -- .version "01.01" --.data -- .align 32 -- .type lfactor,@object -- .size lfactor,36 --lfactor: -- .long 1 -- .long 10 -- .long 100 -- .long 1000 -- .long 10000 -- .long 100000 -- .long 1000000 -- .long 10000000 -- .long 100000000 -+ .version "01.02" -+ - .text - .align 4 - -@@ -209,14 +196,16 @@ - jne .L500 - cmpl -36(%ebp),%esi # Test if string is less than 18 digits - jne .Lend_i_and_j -- jmp .Lend3 # 18 digit string -+.L499: -+ movl $1000000000,%eax -+ jmp .Lgot_factor # 18 digit string - - # Handle the possible next to last digit and store in ecx - .L500: - movb (%esi),%al - addb $-48,%al - cmpb $9,%al -- ja .Lend3 -+ ja .L499 # 18 digit string - - incl %esi - movzbl %al,%ecx -@@ -315,14 +304,41 @@ - .Lend_i_and_j: - movl %esi,%ecx - subl -12(%ebp),%ecx # ecx= number of digits in second part -- movl lfactor(,%ecx,4),%eax -- jmp .L523 - -- # Return -8(%ebp) * $1000000000 + edi -+ # Calculate %eax= 10 ** %cl, where %cl <= 8 -+ # With an array one could do this with: -+ # movl 10_factor_table(,%ecx,4),%eax -+ # We calculate the table here to avoid problems in -+ # position independent code (gcc -pic) -+ -+ cmpb $3,%cl -+ ja .L4_to_8 -+ movl $1000, %eax -+ je .Lgot_factor # %cl=3, eax= 1000 -+ movl $10, %eax -+ cmpb $1,%cl # %cl is here 0 - 2 -+ je .Lgot_factor # %cl=1, eax= 10 -+ movl $100, %eax -+ ja .Lgot_factor # %cl=2, eax=100 -+ movl $1, %eax -+ jmp .Lgot_factor # %cl=0, eax=1 -+ -+.L4_to_8: # %cl is here 4-8 -+ cmpb $5,%cl -+ movl $100000, %eax -+ je .Lgot_factor # %cl=5, eax=100000 -+ movl $10000, %eax -+ jbe .Lgot_factor # %cl=4, eax=10000 -+ movl $10000000, %eax -+ cmpb $7,%cl -+ je .Lgot_factor # %cl=7, eax=10000000 -+ movl $100000000, %eax -+ ja .Lgot_factor # %cl=8, eax=100000000 -+ movl $1000000, %eax # %cl=6, eax=1000000 -+ -+ # Return -8(%ebp) * %eax + edi - .p2align 4,,7 --.Lend3: -- movl $1000000000,%eax --.L523: -+.Lgot_factor: - mull -8(%ebp) - addl %edi,%eax - adcl $0,%edx -@@ -400,3 +416,6 @@ - .comm end_ptr,120,32 - .comm error,120,32 - .ident "Monty" -+ -+ .section .note.GNU-stack,"",@progbits -+ -diff -Naur mysql.orig/strings/strings-x86.s mysql.new/strings/strings-x86.s ---- mysql.orig/strings/strings-x86.s 2005-08-08 22:39:10.000000000 +0200 -+++ mysql.new/strings/strings-x86.s 2005-08-08 22:44:29.000000000 +0200 -@@ -415,3 +415,6 @@ - ret - .strxmov_end: - .size strxmov,.strxmov_end-strxmov -+ -+ .section .note.GNU-stack,"",@progbits -+ ---- mysql.orig/mysql-test/r/bigint.result 2005-08-10 23:28:13.000000000 +0200 -+++ mysql.new/mysql-test/r/bigint.result 2005-08-10 23:27:41.000000000 +0200 -@@ -17,6 +17,15 @@ - select -(0-3),round(-(0-3)), round(9999999999999999999); - -(0-3) round(-(0-3)) round(9999999999999999999) - 3 3 9999999999999999999 -+select 1,11,101,1001,10001,100001,1000001,10000001,100000001,1000000001,10000000001,100000000001,1000000000001,10000000000001,100000000000001,1000000000000001,10000000000000001,100000000000000001,1000000000000000001,10000000000000000001; -+1 11 101 1001 10001 100001 1000001 10000001 100000001 1000000001 10000000001 100000000001 1000000000001 10000000000001 100000000000001 1000000000000001 10000000000000001 100000000000000001 1000000000000000001 10000000000000000001 -+1 11 101 1001 10001 100001 1000001 10000001 100000001 1000000001 10000000001 100000000001 1000000000001 10000000000001 100000000000001 1000000000000001 10000000000000001 100000000000000001 1000000000000000001 10000000000000000001 -+select -1,-11,-101,-1001,-10001,-100001,-1000001,-10000001,-100000001,-1000000001,-10000000001,-100000000001,-1000000000001,-10000000000001,-100000000000001,-1000000000000001,-10000000000000001,-100000000000000001,-1000000000000000001,-10000000000000000000; -+-1 -11 -101 -1001 -10001 -100001 -1000001 -10000001 -100000001 -1000000001 -10000000001 -100000000001 -1000000000001 -10000000000001 -100000000000001 -1000000000000001 -10000000000000001 -100000000000000001 -1000000000000000001 -10000000000000000000 -+-1 -11 -101 -1001 -10001 -100001 -1000001 -10000001 -100000001 -1000000001 -10000000001 -100000000001 -1000000000001 -10000000000001 -100000000000001 -1000000000000001 -10000000000000001 -100000000000000001 -1000000000000000001 -10000000000000000000 -+select conv(1,10,16),conv((1<<2)-1,10,16),conv((1<<10)-2,10,16),conv((1<<16)-3,10,16),conv((1<<25)-4,10,16),conv((1<<31)-5,10,16),conv((1<<36)-6,10,16),conv((1<<47)-7,10,16),conv((1<<48)-8,10,16),conv((1<<55)-9,10,16),conv((1<<56)-10,10,16),conv((1<<63)-11,10,16); -+conv(1,10,16) conv((1<<2)-1,10,16) conv((1<<10)-2,10,16) conv((1<<16)-3,10,16) conv((1<<25)-4,10,16) conv((1<<31)-5,10,16) conv((1<<36)-6,10,16) conv((1<<47)-7,10,16) conv((1<<48)-8,10,16) conv((1<<55)-9,10,16) conv((1<<56)-10,10,16) conv((1<<63)-11,10,16) -+1 3 3FE FFFD 1FFFFFC 7FFFFFFB FFFFFFFFA 7FFFFFFFFFF9 FFFFFFFFFFF8 7FFFFFFFFFFFF7 FFFFFFFFFFFFF6 7FFFFFFFFFFFFFF5 - create table t1 (a bigint unsigned not null, primary key(a)); - insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612); - select * from t1; diff --git a/035_x86_asm-pic-fixes-r6.patch b/035_x86_asm-pic-fixes-r6.patch deleted file mode 100644 index 5430bc6..0000000 --- a/035_x86_asm-pic-fixes-r6.patch +++ /dev/null @@ -1,333 +0,0 @@ -###MY_VER_RANGE [5.0.11_beta,5.0.12_alpha) [5.1,5.1.2_alpha) - -FOLLOWING THE ORIGINAL PATCH COMMIT COMMENTS: - -ChangeSet - 1.2356 05/08/08 13:18:18 monty@mishka.local +6 -0 - Fix for BUG #11642: [Patch]es x86 Assembler and text relocations - Changed assembler functions to not access global variables or variables in text segement - Added wrapper function in C to longlong2str() to pass _dig_vec_upper as an argument - - strings/longlong2str_asm.c - 1.1 05/08/08 13:18:12 monty@mishka.local +33 -0 - New BitKeeper file ``strings/longlong2str_asm.c'' - - strings/my_strtoll10-x86.s - 1.4 05/08/08 13:18:12 monty@mishka.local +39 -23 - Removd array lfactor by calculating the value in code - (this is to to make the code position independent) - - strings/longlong2str_asm.c - 1.0 05/08/08 13:18:12 monty@mishka.local +0 -0 - BitKeeper file /home/my/mysql-4.1/strings/longlong2str_asm.c - - strings/longlong2str-x86.s - 1.11 05/08/08 13:18:12 monty@mishka.local +18 -17 - Changed functions to not access variables in text segment - Fixed this by adding global variable '_dig_vec_upper' as an argument to longlong2str_with_dig_vector() - - strings/Makefile.am - 1.43 05/08/08 13:18:12 monty@mishka.local +2 -2 - Added longlong2str_asm.c - -# mysql-test/t/bigint.test -# 1.24 05/08/08 13:18:11 monty@mishka.local +3 -0 -# More tests for parsing of bigint's -# More tests for different values to conv() -# -# mysql-test/r/bigint.result -# 1.25 05/08/08 13:18:11 monty@mishka.local +9 -0 -# More tests for parsing of bigint's -# More tests for different values to conv() - -REAPPLIED PATCH FROM HERE: -PLUS ".section .note.GNU-stack,"",@progbits" - -diff -Naur mysql.orig/strings/Makefile.am mysql.new/strings/Makefile.am ---- mysql.orig/strings/Makefile.am 2005-08-08 22:57:13.000000000 +0200 -+++ mysql.new/strings/Makefile.am 2005-08-08 22:57:45.000000000 +0200 -@@ -22,7 +22,7 @@ - # Exact one of ASSEMBLER_X - if ASSEMBLER_x86 - ASRCS = strings-x86.s longlong2str-x86.s my_strtoll10-x86.s --CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c str_alloc.c -+CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c str_alloc.c longlong2str_asm.c - else - if ASSEMBLER_sparc32 - # These file MUST all be on the same line!! Otherwise automake -@@ -45,7 +45,7 @@ - ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-utf8.c \ - ctype-ucs2.c ctype-uca.c ctype-tis620.c ctype-ujis.c \ - xml.c decimal.c strto.c strings-x86.s \ -- longlong2str.c longlong2str-x86.s \ -+ longlong2str.c longlong2str-x86.s longlong2str_asm.c \ - my_strtoll10.c my_strtoll10-x86.s \ - strxmov.c bmove_upp.c strappend.c strcont.c strend.c \ - strfill.c strcend.c is_prefix.c strstr.c strinstr.c \ -diff -Naur mysql.orig/strings/longlong2str-x86.s mysql.new/strings/longlong2str-x86.s ---- mysql.orig/strings/longlong2str-x86.s 2005-08-08 22:57:13.000000000 +0200 -+++ mysql.new/strings/longlong2str-x86.s 2005-08-08 22:58:23.000000000 +0200 -@@ -16,26 +16,26 @@ - # Optimized longlong2str function for Intel 80x86 (gcc/gas syntax) - # Some set sequences are optimized for pentuimpro II - -- .file "longlong2str.s" -- .version "1.01" -+ .file "longlong2str-x86.s" -+ .version "1.02" - - .text - .align 4 - --.globl longlong2str -- .type longlong2str,@function -+.globl longlong2str_with_dig_vector -+ .type longlong2str_with_dig_vector,@function - --longlong2str: -+longlong2str_with_dig_vector: - subl $80,%esp - pushl %ebp - pushl %esi - pushl %edi - pushl %ebx - movl 100(%esp),%esi # Lower part of val -- movl 104(%esp),%ebp # Higher part of val -- movl 108(%esp),%edi # get dst - movl 112(%esp),%ebx # Radix -+ movl 104(%esp),%ebp # Higher part of val - movl %ebx,%eax -+ movl 108(%esp),%edi # get dst - testl %eax,%eax - jge .L144 - -@@ -69,6 +69,8 @@ - - .L150: - leal 92(%esp),%ecx # End of buffer -+ movl %edi, 108(%esp) # Store possible modified dest -+ movl 116(%esp), %edi # dig_vec_upper - jmp .L155 - .align 4 - -@@ -83,7 +85,7 @@ - divl %ebx - decl %ecx - movl %eax,%esi # quotent in ebp:esi -- movb _dig_vec_upper(%edx),%al # al is faster than dl -+ movb (%edx,%edi),%al # al is faster than dl - movb %al,(%ecx) # store value in buff - .align 4 - .L155: -@@ -91,20 +93,22 @@ - ja .L153 - testl %esi,%esi # rest value - jl .L153 -- je .L10_mov # Ready -+ je .L160 # Ready - movl %esi,%eax -- movl $_dig_vec_upper,%ebp - .align 4 - - .L154: # Do rest with integer precision - cltd - divl %ebx - decl %ecx -- movb (%edx,%ebp),%dl # bh is always zero as ebx=radix < 36 -+ movb (%edx,%edi),%dl # bh is always zero as ebx=radix < 36 - testl %eax,%eax - movb %dl,(%ecx) - jne .L154 - -+.L160: -+ movl 108(%esp),%edi # get dst -+ - .L10_mov: - movl %ecx,%esi - leal 92(%esp),%ecx # End of buffer -@@ -129,7 +133,7 @@ - jmp .L165 - - .Lfe3: -- .size longlong2str,.Lfe3-longlong2str -+ .size longlong2str_with_dig_vector,.Lfe3-longlong2str_with_dig_vector - - # - # This is almost equal to the above, except that we can do the final -@@ -137,9 +141,6 @@ - # - - .align 4 --.Ltmp: -- .long 0xcccccccd -- .align 4 - - .globl longlong10_to_str - .type longlong10_to_str,@function -@@ -202,8 +203,8 @@ - - # The following code uses some tricks to change division by 10 to - # multiplication and shifts -- movl .Ltmp,%esi # set %esi to 0xcccccccd -- -+ movl $0xcccccccd,%esi -+ - .L10_40: - movl %ebx,%eax - mull %esi -@@ -221,3 +222,6 @@ - - .L10end: - .size longlong10_to_str,.L10end-longlong10_to_str -+ -+ .section .note.GNU-stack,"",@progbits -+ -diff -Naur mysql.orig/strings/longlong2str_asm.c mysql.new/strings/longlong2str_asm.c ---- mysql.orig/strings/longlong2str_asm.c 1970-01-01 01:00:00.000000000 +0100 -+++ mysql.new/strings/longlong2str_asm.c 2005-08-08 22:57:17.000000000 +0200 -@@ -0,0 +1,34 @@ -+/* Copyright (C) 2000 MySQL AB -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -+ -+/* -+ * Wrapper for longlong2str.s -+ * -+ * We need this because the assembler code can't access the local variable -+ * _dig_vector in a portable manner. -+ */ -+ -+#include <my_global.h> -+#include "m_string.h" -+ -+extern char *longlong2str_with_dig_vector(longlong val,char *dst,int radix, -+ const char *dig_vector); -+ -+char *longlong2str(longlong val,char *dst,int radix) -+{ -+ return longlong2str_with_dig_vector(val, dst, radix, _dig_vec_upper); -+} -+ -diff -Naur mysql.orig/strings/my_strtoll10-x86.s mysql.new/strings/my_strtoll10-x86.s ---- mysql.orig/strings/my_strtoll10-x86.s 2005-08-08 22:57:13.000000000 +0200 -+++ mysql.new/strings/my_strtoll10-x86.s 2005-08-08 22:58:30.000000000 +0200 -@@ -17,21 +17,8 @@ - # For documentation, check my_strtoll.c - - .file "my_strtoll10-x86.s" -- .version "01.01" --.data -- .align 32 -- .type lfactor,@object -- .size lfactor,36 --lfactor: -- .long 1 -- .long 10 -- .long 100 -- .long 1000 -- .long 10000 -- .long 100000 -- .long 1000000 -- .long 10000000 -- .long 100000000 -+ .version "01.02" -+ - .text - .align 4 - -@@ -209,14 +196,16 @@ - jne .L500 - cmpl -36(%ebp),%esi # Test if string is less than 18 digits - jne .Lend_i_and_j -- jmp .Lend3 # 18 digit string -+.L499: -+ movl $1000000000,%eax -+ jmp .Lgot_factor # 18 digit string - - # Handle the possible next to last digit and store in ecx - .L500: - movb (%esi),%al - addb $-48,%al - cmpb $9,%al -- ja .Lend3 -+ ja .L499 # 18 digit string - - incl %esi - movzbl %al,%ecx -@@ -315,14 +304,41 @@ - .Lend_i_and_j: - movl %esi,%ecx - subl -12(%ebp),%ecx # ecx= number of digits in second part -- movl lfactor(,%ecx,4),%eax -- jmp .L523 - -- # Return -8(%ebp) * $1000000000 + edi -+ # Calculate %eax= 10 ** %cl, where %cl <= 8 -+ # With an array one could do this with: -+ # movl 10_factor_table(,%ecx,4),%eax -+ # We calculate the table here to avoid problems in -+ # position independent code (gcc -pic) -+ -+ cmpb $3,%cl -+ ja .L4_to_8 -+ movl $1000, %eax -+ je .Lgot_factor # %cl=3, eax= 1000 -+ movl $10, %eax -+ cmpb $1,%cl # %cl is here 0 - 2 -+ je .Lgot_factor # %cl=1, eax= 10 -+ movl $100, %eax -+ ja .Lgot_factor # %cl=2, eax=100 -+ movl $1, %eax -+ jmp .Lgot_factor # %cl=0, eax=1 -+ -+.L4_to_8: # %cl is here 4-8 -+ cmpb $5,%cl -+ movl $100000, %eax -+ je .Lgot_factor # %cl=5, eax=100000 -+ movl $10000, %eax -+ jbe .Lgot_factor # %cl=4, eax=10000 -+ movl $10000000, %eax -+ cmpb $7,%cl -+ je .Lgot_factor # %cl=7, eax=10000000 -+ movl $100000000, %eax -+ ja .Lgot_factor # %cl=8, eax=100000000 -+ movl $1000000, %eax # %cl=6, eax=1000000 -+ -+ # Return -8(%ebp) * %eax + edi - .p2align 4,,7 --.Lend3: -- movl $1000000000,%eax --.L523: -+.Lgot_factor: - mull -8(%ebp) - addl %edi,%eax - adcl $0,%edx -@@ -400,3 +416,6 @@ - .comm end_ptr,120,32 - .comm error,120,32 - .ident "Monty" -+ -+ .section .note.GNU-stack,"",@progbits -+ -diff -Naur mysql.orig/strings/strings-x86.s mysql.new/strings/strings-x86.s ---- mysql.orig/strings/strings-x86.s 2005-08-08 22:57:13.000000000 +0200 -+++ mysql.new/strings/strings-x86.s 2005-08-08 22:58:40.000000000 +0200 -@@ -415,3 +415,6 @@ - ret - .strxmov_end: - .size strxmov,.strxmov_end-strxmov -+ -+ .section .note.GNU-stack,"",@progbits -+ diff --git a/035_x86_asm-pic-fixes-r7.patch b/035_x86_asm-pic-fixes-r7.patch index d7d2b58..a6de190 100644 --- a/035_x86_asm-pic-fixes-r7.patch +++ b/035_x86_asm-pic-fixes-r7.patch @@ -1,10 +1,8 @@ -###MY_VER_RANGE [5.0.12_beta,5.0.12_beta] - diff -Naur mysql.old/strings/longlong2str-x86.s mysql.new/strings/longlong2str-x86.s --- mysql.old/strings/longlong2str-x86.s 2005-08-27 22:33:11.000000000 +0200 +++ mysql.new/strings/longlong2str-x86.s 2005-09-05 18:46:04.000000000 +0200 @@ -222,3 +222,6 @@ - + .L10end: .size longlong10_to_str,.L10end-longlong10_to_str + diff --git a/040_all_tcpd-vars-fix-r1.patch b/040_all_tcpd-vars-fix-r1.patch deleted file mode 100644 index 20a3798..0000000 --- a/040_all_tcpd-vars-fix-r1.patch +++ /dev/null @@ -1,14 +0,0 @@ -###MY_VER_RANGE [5.0.11_beta,) ---- mysql-old/sql/mysqld.cc 2005-08-06 03:39:41.000000000 +0200 -+++ mysql-new/sql/mysqld.cc 2005-08-30 23:40:44.000000000 +0200 -@@ -126,8 +126,8 @@ - #ifdef NEED_SYS_SYSLOG_H - #include <sys/syslog.h> - #endif /* NEED_SYS_SYSLOG_H */ --int allow_severity = LOG_INFO; --int deny_severity = LOG_WARNING; -+//int allow_severity = LOG_INFO; -+//int deny_severity = LOG_WARNING; - - #endif /* HAVE_LIBWRAP */ - diff --git a/040_all_tcpd-vars-fix.patch b/040_all_tcpd-vars-fix.patch index 156e368..6150a79 100644 --- a/040_all_tcpd-vars-fix.patch +++ b/040_all_tcpd-vars-fix.patch @@ -1,4 +1,3 @@ -###MY_VER_RANGE [4.0.14-r1,5.0_alpha] --- mysql-4.1.8/sql/mysqld.cc 2004-12-14 13:40:36.000000000 +0100 +++ bbb/sql/mysqld.cc 2005-01-09 17:57:47.829022200 +0100 @@ -133,8 +133,8 @@ @@ -9,6 +8,6 @@ -int deny_severity = LOG_WARNING; +//int allow_severity = LOG_INFO; +//int deny_severity = LOG_WARNING; - + #ifdef __STDC__ #define my_fromhost(A) fromhost(A) diff --git a/050_all_mysql-create_system_tables.patch b/050_all_mysql-create_system_tables.patch deleted file mode 100644 index 9440c77..0000000 --- a/050_all_mysql-create_system_tables.patch +++ /dev/null @@ -1,12 +0,0 @@ -###MY_VER_RANGE [5.0_alpha,5.0.10_beta) ---- mysql.old/scripts/mysql_create_system_tables.sh 2005-04-19 12:08:40.000000000 +0200 -+++ mysql-5.0.4-beta/scripts/mysql_create_system_tables.sh 2005-04-19 12:09:18.000000000 +0200 -@@ -714,7 +714,7 @@ - c_p="$c_p 'TRADITIONAL'," - c_p="$c_p 'NO_AUTO_CREATE_USER'," - c_p="$c_p 'HIGH_NOT_PRECEDENCE'" -- c_p="$c_p ) DEFAULT 0 NOT NULL," -+ c_p="$c_p ) DEFAULT '' NOT NULL," - c_p="$c_p comment char(64) binary DEFAULT '' NOT NULL," - c_p="$c_p PRIMARY KEY (db,name,type)" - c_p="$c_p ) comment='Stored Procedures';" diff --git a/060_all_myxml_by_Alexander_Barkov.patch b/060_all_myxml_by_Alexander_Barkov.patch deleted file mode 100644 index 3dffe00..0000000 --- a/060_all_myxml_by_Alexander_Barkov.patch +++ /dev/null @@ -1,6170 +0,0 @@ -###MY_VER_RANGE [5.0.6_beta,) -###MY_USE_FLAG barkov-xml -diff -Naur mysql.orig/include/my_xml.h mysql.xml/include/my_xml.h ---- mysql.orig/include/my_xml.h 2005-05-15 06:16:51.000000000 +0200 -+++ mysql.xml/include/my_xml.h 2005-05-20 15:19:29.000000000 +0200 -@@ -26,8 +26,31 @@ - #define MY_XML_OK 0 - #define MY_XML_ERROR 1 - -+/* -+ A flag whether to use absolute tag names in call-back functions, -+ like "a", "a.b" and "a.b.c" (used in character set file parser), -+ or relative names like "a", "b" and "c". -+*/ -+#define MY_XML_FLAG_RELATIVE_NAMES 1 -+ -+/* -+ A flag whether to skip normilization of text values before calling -+ call-back functions: i.e. skip leading/trailing spaces, -+ \r, \n, \t characters. -+*/ -+#define MY_XML_FLAG_SKIP_TEXT_NORMALIZATION 2 -+ -+enum my_xml_node_type -+{ -+ MY_XML_NODE_TAG, /* can have TAG, ATTR and TEXT children */ -+ MY_XML_NODE_ATTR, /* can have TEXT children */ -+ MY_XML_NODE_TEXT /* cannot have children */ -+}; -+ - typedef struct xml_stack_st - { -+ int flags; -+ enum my_xml_node_type current_node_type; - char errstr[128]; - char attr[128]; - char *attrend; -diff -Naur mysql.orig/mysql-test/r/xml.result mysql.xml/mysql-test/r/xml.result ---- mysql.orig/mysql-test/r/xml.result 1970-01-01 01:00:00.000000000 +0100 -+++ mysql.xml/mysql-test/r/xml.result 2005-04-13 09:17:23.000000000 +0200 -@@ -0,0 +1,522 @@ -+SET @xml='<a aa1="aa1" aa2="aa2">a1<b ba1="ba1">b1<c>c1</c>b2</b>a2</a>'; -+SELECT extractValue(@xml,'/a'); -+extractValue(@xml,'/a') -+a1 a2 -+SELECT extractValue(@xml,'/a/b'); -+extractValue(@xml,'/a/b') -+b1 b2 -+SELECT extractValue(@xml,'/a/b/c'); -+extractValue(@xml,'/a/b/c') -+c1 -+SELECT extractValue(@xml,'/a/@aa1'); -+extractValue(@xml,'/a/@aa1') -+aa1 -+SELECT extractValue(@xml,'/a/@aa2'); -+extractValue(@xml,'/a/@aa2') -+aa2 -+SELECT extractValue(@xml,'/a/@*'); -+extractValue(@xml,'/a/@*') -+aa1 aa2 -+SELECT extractValue(@xml,'//@ba1'); -+extractValue(@xml,'//@ba1') -+ba1 -+SELECT extractValue(@xml,'//a'); -+extractValue(@xml,'//a') -+a1 a2 -+SELECT extractValue(@xml,'//b'); -+extractValue(@xml,'//b') -+b1 b2 -+SELECT extractValue(@xml,'//c'); -+extractValue(@xml,'//c') -+c1 -+SELECT extractValue(@xml,'/a//b'); -+extractValue(@xml,'/a//b') -+b1 b2 -+SELECT extractValue(@xml,'/a//c'); -+extractValue(@xml,'/a//c') -+c1 -+SELECT extractValue(@xml,'//*'); -+extractValue(@xml,'//*') -+a1 b1 c1 b2 a2 -+SELECT extractValue(@xml,'/a//*'); -+extractValue(@xml,'/a//*') -+b1 c1 b2 -+SELECT extractValue(@xml,'/./a'); -+extractValue(@xml,'/./a') -+a1 a2 -+SELECT extractValue(@xml,'/a/b/.'); -+extractValue(@xml,'/a/b/.') -+b1 b2 -+SELECT extractValue(@xml,'/a/b/..'); -+extractValue(@xml,'/a/b/..') -+a1 a2 -+SELECT extractValue(@xml,'/a/b/../@aa1'); -+extractValue(@xml,'/a/b/../@aa1') -+aa1 -+SELECT extractValue(@xml,'/*'); -+extractValue(@xml,'/*') -+a1 a2 -+SELECT extractValue(@xml,'/*/*'); -+extractValue(@xml,'/*/*') -+b1 b2 -+SELECT extractValue(@xml,'/*/*/*'); -+extractValue(@xml,'/*/*/*') -+c1 -+SELECT extractValue(@xml,'/a/child::*'); -+extractValue(@xml,'/a/child::*') -+b1 b2 -+SELECT extractValue(@xml,'/a/descendant::*'); -+extractValue(@xml,'/a/descendant::*') -+b1 c1 b2 -+SELECT extractValue(@xml,'/a/descendant-or-self::*'); -+extractValue(@xml,'/a/descendant-or-self::*') -+a1 b1 c1 b2 a2 -+SELECT extractValue(@xml,'/a/attribute::*'); -+extractValue(@xml,'/a/attribute::*') -+aa1 aa2 -+SELECT extractValue(@xml,'/a/b/c/parent::*'); -+extractValue(@xml,'/a/b/c/parent::*') -+b1 b2 -+SELECT extractValue(@xml,'/a/b/c/ancestor::*'); -+extractValue(@xml,'/a/b/c/ancestor::*') -+a1 b1 b2 a2 -+SELECT extractValue(@xml,'/a/b/c/ancestor-or-self::*'); -+extractValue(@xml,'/a/b/c/ancestor-or-self::*') -+a1 b1 c1 b2 a2 -+SELECT extractValue(@xml,'/descendant-or-self::*'); -+extractValue(@xml,'/descendant-or-self::*') -+a1 b1 c1 b2 a2 -+SET @xml='<a>a11<b ba="ba11" ba="ba12">b11</b><b ba="ba21" ba="ba22">b21<c>c1</c>b22</b>a12</a>'; -+SELECT extractValue(@xml,'/a/b/c/ancestor-or-self::*'); -+extractValue(@xml,'/a/b/c/ancestor-or-self::*') -+a11 b21 c1 b22 a12 -+SELECT extractValue(@xml,'//@ba'); -+extractValue(@xml,'//@ba') -+ba11 ba12 ba21 ba22 -+SET @xml='<a><b>b</b><c>c</c></a>'; -+SELECT extractValue(@xml,'/a/b'); -+extractValue(@xml,'/a/b') -+b -+SELECT extractValue(@xml,'/a/c'); -+extractValue(@xml,'/a/c') -+c -+SELECT extractValue(@xml,'/a/child::b'); -+extractValue(@xml,'/a/child::b') -+b -+SELECT extractValue(@xml,'/a/child::c'); -+extractValue(@xml,'/a/child::c') -+c -+SET @xml='<a><b>b1</b><c>c1</c><b>b2</b><c>c2</c></a>'; -+SELECT extractValue(@xml,'/a/b[1]'); -+extractValue(@xml,'/a/b[1]') -+b1 -+SELECT extractValue(@xml,'/a/b[2]'); -+extractValue(@xml,'/a/b[2]') -+b2 -+SELECT extractValue(@xml,'/a/c[1]'); -+extractValue(@xml,'/a/c[1]') -+c1 -+SELECT extractValue(@xml,'/a/c[2]'); -+extractValue(@xml,'/a/c[2]') -+c2 -+SET @xml='<a><b x="xb1" x="xb2"/><c x="xc1" x="xc2"/></a>'; -+SELECT extractValue(@xml,'/a//@x'); -+extractValue(@xml,'/a//@x') -+xb1 xb2 xc1 xc2 -+SELECT extractValue(@xml,'/a//@x[1]'); -+extractValue(@xml,'/a//@x[1]') -+xb1 xc1 -+SELECT extractValue(@xml,'/a//@x[2]'); -+extractValue(@xml,'/a//@x[2]') -+xb2 xc2 -+SET @xml='<a><b>b1</b><b>b2</b><c><b>c1b1</b><b>c1b2</b></c><c><b>c2b1</c></b>/a>'; -+SELECT extractValue(@xml,'//b[1]'); -+extractValue(@xml,'//b[1]') -+b1 c1b1 c2b1 -+SELECT extractValue(@xml,'/descendant::b[1]'); -+extractValue(@xml,'/descendant::b[1]') -+b1 -+SET @xml='<a><b>b1</b><b>b2</b></a>'; -+SELECT extractValue(@xml,'/a/b[1+0]'); -+extractValue(@xml,'/a/b[1+0]') -+b1 -+SELECT extractValue(@xml,'/a/b[1*1]'); -+extractValue(@xml,'/a/b[1*1]') -+b1 -+SELECT extractValue(@xml,'/a/b[--1]'); -+extractValue(@xml,'/a/b[--1]') -+b1 -+SELECT extractValue(@xml,'/a/b[2*1-1]'); -+extractValue(@xml,'/a/b[2*1-1]') -+b1 -+SELECT extractValue(@xml,'/a/b[1+1]'); -+extractValue(@xml,'/a/b[1+1]') -+b2 -+SELECT extractValue(@xml,'/a/b[1*2]'); -+extractValue(@xml,'/a/b[1*2]') -+b2 -+SELECT extractValue(@xml,'/a/b[--2]'); -+extractValue(@xml,'/a/b[--2]') -+b2 -+SELECT extractValue(@xml,'/a/b[1*(3-1)]'); -+extractValue(@xml,'/a/b[1*(3-1)]') -+b2 -+SELECT extractValue(@xml,'//*[1=1]'); -+extractValue(@xml,'//*[1=1]') -+b1 b2 -+SELECT extractValue(@xml,'//*[1!=1]'); -+extractValue(@xml,'//*[1!=1]') -+ -+SELECT extractValue(@xml,'//*[1>1]'); -+extractValue(@xml,'//*[1>1]') -+ -+SELECT extractValue(@xml,'//*[2>1]'); -+extractValue(@xml,'//*[2>1]') -+b1 b2 -+SELECT extractValue(@xml,'//*[1>2]'); -+extractValue(@xml,'//*[1>2]') -+ -+SELECT extractValue(@xml,'//*[1>=1]'); -+extractValue(@xml,'//*[1>=1]') -+b1 b2 -+SELECT extractValue(@xml,'//*[2>=1]'); -+extractValue(@xml,'//*[2>=1]') -+b1 b2 -+SELECT extractValue(@xml,'//*[1>=2]'); -+extractValue(@xml,'//*[1>=2]') -+ -+SELECT extractValue(@xml,'//*[1<1]'); -+extractValue(@xml,'//*[1<1]') -+ -+SELECT extractValue(@xml,'//*[2<1]'); -+extractValue(@xml,'//*[2<1]') -+ -+SELECT extractValue(@xml,'//*[1<2]'); -+extractValue(@xml,'//*[1<2]') -+b1 b2 -+SELECT extractValue(@xml,'//*[1<=1]'); -+extractValue(@xml,'//*[1<=1]') -+b1 b2 -+SELECT extractValue(@xml,'//*[2<=1]'); -+extractValue(@xml,'//*[2<=1]') -+ -+SELECT extractValue(@xml,'//*[1<=2]'); -+extractValue(@xml,'//*[1<=2]') -+b1 b2 -+SET @xml='<a><b>b11<c>c11</c></b><b>b21<c>c21</c></b></a>'; -+SELECT extractValue(@xml,'/a/b[c="c11"]'); -+extractValue(@xml,'/a/b[c="c11"]') -+b11 -+SELECT extractValue(@xml,'/a/b[c="c21"]'); -+extractValue(@xml,'/a/b[c="c21"]') -+b21 -+SET @xml='<a><b c="c11">b11</b><b c="c21">b21</b></a>'; -+SELECT extractValue(@xml,'/a/b[@c="c11"]'); -+extractValue(@xml,'/a/b[@c="c11"]') -+b11 -+SELECT extractValue(@xml,'/a/b[@c="c21"]'); -+extractValue(@xml,'/a/b[@c="c21"]') -+b21 -+SET @xml='<a>a1<b c="c11">b11<d>d11</d></b><b c="c21">b21<d>d21</d></b></a>'; -+SELECT extractValue(@xml, '/a/b[@c="c11"]/d'); -+extractValue(@xml, '/a/b[@c="c11"]/d') -+d11 -+SELECT extractValue(@xml, '/a/b[@c="c21"]/d'); -+extractValue(@xml, '/a/b[@c="c21"]/d') -+d21 -+SELECT extractValue(@xml, '/a/b[d="d11"]/@c'); -+extractValue(@xml, '/a/b[d="d11"]/@c') -+c11 -+SELECT extractValue(@xml, '/a/b[d="d21"]/@c'); -+extractValue(@xml, '/a/b[d="d21"]/@c') -+c21 -+SELECT extractValue(@xml, '/a[b="b11"]'); -+extractValue(@xml, '/a[b="b11"]') -+a1 -+SELECT extractValue(@xml, '/a[b/@c="c11"]'); -+extractValue(@xml, '/a[b/@c="c11"]') -+a1 -+SELECT extractValue(@xml, '/a[b/d="d11"]'); -+extractValue(@xml, '/a[b/d="d11"]') -+a1 -+SELECT extractValue(@xml, '/a[/a/b="b11"]'); -+extractValue(@xml, '/a[/a/b="b11"]') -+a1 -+SELECT extractValue(@xml, '/a[/a/b/@c="c11"]'); -+extractValue(@xml, '/a[/a/b/@c="c11"]') -+a1 -+SELECT extractValue(@xml, '/a[/a/b/d="d11"]'); -+extractValue(@xml, '/a[/a/b/d="d11"]') -+a1 -+SELECT extractValue('<a>a</a>', '/a[false()]'); -+extractValue('<a>a</a>', '/a[false()]') -+ -+SELECT extractValue('<a>a</a>', '/a[true()]'); -+extractValue('<a>a</a>', '/a[true()]') -+a -+SELECT extractValue('<a>a</a>', '/a[not(false())]'); -+extractValue('<a>a</a>', '/a[not(false())]') -+a -+SELECT extractValue('<a>a</a>', '/a[not(true())]'); -+extractValue('<a>a</a>', '/a[not(true())]') -+ -+SELECT extractValue('<a>a</a>', '/a[true() and true()]'); -+extractValue('<a>a</a>', '/a[true() and true()]') -+a -+SELECT extractValue('<a>a</a>', '/a[true() and false()]'); -+extractValue('<a>a</a>', '/a[true() and false()]') -+ -+SELECT extractValue('<a>a</a>', '/a[false()and false()]'); -+extractValue('<a>a</a>', '/a[false()and false()]') -+ -+SELECT extractValue('<a>a</a>', '/a[false()and true()]'); -+extractValue('<a>a</a>', '/a[false()and true()]') -+ -+SELECT extractValue('<a>a</a>', '/a[true() or true()]'); -+extractValue('<a>a</a>', '/a[true() or true()]') -+a -+SELECT extractValue('<a>a</a>', '/a[true() or false()]'); -+extractValue('<a>a</a>', '/a[true() or false()]') -+a -+SELECT extractValue('<a>a</a>', '/a[false()or false()]'); -+extractValue('<a>a</a>', '/a[false()or false()]') -+ -+SELECT extractValue('<a>a</a>', '/a[false()or true()]'); -+extractValue('<a>a</a>', '/a[false()or true()]') -+a -+SET @xml='<a>ab<b c="c" c="e">b1</b><b c="d">b2</b><b c="f" c="e">b3</b></a>'; -+select extractValue(@xml,'/a/b[@c="c"]'); -+extractValue(@xml,'/a/b[@c="c"]') -+b1 -+select extractValue(@xml,'/a/b[@c="d"]'); -+extractValue(@xml,'/a/b[@c="d"]') -+b2 -+select extractValue(@xml,'/a/b[@c="e"]'); -+extractValue(@xml,'/a/b[@c="e"]') -+b1 b3 -+select extractValue(@xml,'/a/b[not(@c="e")]'); -+extractValue(@xml,'/a/b[not(@c="e")]') -+b2 -+select extractValue(@xml,'/a/b[@c!="e"]'); -+extractValue(@xml,'/a/b[@c!="e"]') -+b1 b2 b3 -+select extractValue(@xml,'/a/b[@c="c" or @c="d"]'); -+extractValue(@xml,'/a/b[@c="c" or @c="d"]') -+b1 b2 -+select extractValue(@xml,'/a/b[@c="c" and @c="e"]'); -+extractValue(@xml,'/a/b[@c="c" and @c="e"]') -+b1 -+SET @xml='<a><b c="c" d="d">b1</b><b d="d" e="e">b2</b></a>'; -+select extractValue(@xml,'/a/b[@c]'); -+extractValue(@xml,'/a/b[@c]') -+b1 -+select extractValue(@xml,'/a/b[@d]'); -+extractValue(@xml,'/a/b[@d]') -+b1 b2 -+select extractValue(@xml,'/a/b[@e]'); -+extractValue(@xml,'/a/b[@e]') -+b2 -+select extractValue(@xml,'/a/b[not(@c)]'); -+extractValue(@xml,'/a/b[not(@c)]') -+b2 -+select extractValue(@xml,'/a/b[not(@d)]'); -+extractValue(@xml,'/a/b[not(@d)]') -+ -+select extractValue(@xml,'/a/b[not(@e)]'); -+extractValue(@xml,'/a/b[not(@e)]') -+b1 -+select extractValue(@xml, '/a/b[boolean(@c) or boolean(@d)]'); -+extractValue(@xml, '/a/b[boolean(@c) or boolean(@d)]') -+b1 b2 -+select extractValue(@xml, '/a/b[boolean(@c) or boolean(@e)]'); -+extractValue(@xml, '/a/b[boolean(@c) or boolean(@e)]') -+b1 b2 -+select extractValue(@xml, '/a/b[boolean(@d) or boolean(@e)]'); -+extractValue(@xml, '/a/b[boolean(@d) or boolean(@e)]') -+b1 b2 -+select extractValue(@xml, '/a/b[boolean(@c) and boolean(@d)]'); -+extractValue(@xml, '/a/b[boolean(@c) and boolean(@d)]') -+b1 -+select extractValue(@xml, '/a/b[boolean(@c) and boolean(@e)]'); -+extractValue(@xml, '/a/b[boolean(@c) and boolean(@e)]') -+ -+select extractValue(@xml, '/a/b[boolean(@d) and boolean(@e)]'); -+extractValue(@xml, '/a/b[boolean(@d) and boolean(@e)]') -+b2 -+select extractValue(@xml, '/a/b[@c or @d]'); -+extractValue(@xml, '/a/b[@c or @d]') -+b1 b2 -+select extractValue(@xml, '/a/b[@c or @e]'); -+extractValue(@xml, '/a/b[@c or @e]') -+b1 b2 -+select extractValue(@xml, '/a/b[@d or @e]'); -+extractValue(@xml, '/a/b[@d or @e]') -+b1 b2 -+select extractValue(@xml, '/a/b[@c and @d]'); -+extractValue(@xml, '/a/b[@c and @d]') -+b1 -+select extractValue(@xml, '/a/b[@c and @e]'); -+extractValue(@xml, '/a/b[@c and @e]') -+ -+select extractValue(@xml, '/a/b[@d and @e]'); -+extractValue(@xml, '/a/b[@d and @e]') -+b2 -+SET @xml='<a><b c="c">b1</b><b>b2</b></a>'; -+SELECT extractValue(@xml,'/a/b[@*]'); -+extractValue(@xml,'/a/b[@*]') -+b1 -+SELECT extractValue(@xml,'/a/b[not(@*)]'); -+extractValue(@xml,'/a/b[not(@*)]') -+b2 -+SELECT extractValue('<a>a</a>', '/a[ceiling(3.1)=4]'); -+extractValue('<a>a</a>', '/a[ceiling(3.1)=4]') -+a -+SELECT extractValue('<a>a</a>', '/a[floor(3.1)=3]'); -+extractValue('<a>a</a>', '/a[floor(3.1)=3]') -+a -+SELECT extractValue('<a>a</a>', '/a[round(3.1)=3]'); -+extractValue('<a>a</a>', '/a[round(3.1)=3]') -+a -+SELECT extractValue('<a>a</a>', '/a[round(3.8)=4]'); -+extractValue('<a>a</a>', '/a[round(3.8)=4]') -+a -+SELECT extractValue('<a><b>b</b><c>c</c></a>', '/a/b | /a/c'); -+extractValue('<a><b>b</b><c>c</c></a>', '/a/b | /a/c') -+b c -+select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[position()=1]'); -+extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[position()=1]') -+b1 -+select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[position()=2]'); -+extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[position()=2]') -+b2 -+select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[position()=3]'); -+extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[position()=3]') -+b3 -+select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[1=position()]'); -+extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[1=position()]') -+b1 -+select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[2=position()]'); -+extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[2=position()]') -+b2 -+select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[3=position()]'); -+extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[3=position()]') -+b3 -+select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[2>=position()]'); -+extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[2>=position()]') -+b1 b2 -+select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[2<=position()]'); -+extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[2<=position()]') -+b2 b3 -+select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[position()=3 or position()=2]'); -+extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[position()=3 or position()=2]') -+b2 b3 -+SELECT extractValue('<a>a<b>a1<c>c1</c></b><b>a2</b></a>','/a/b[count(c)=0]'); -+extractValue('<a>a<b>a1<c>c1</c></b><b>a2</b></a>','/a/b[count(c)=0]') -+a2 -+SELECT extractValue('<a>a<b>a1<c>c1</c></b><b>a2</b></a>','/a/b[count(c)=1]'); -+extractValue('<a>a<b>a1<c>c1</c></b><b>a2</b></a>','/a/b[count(c)=1]') -+a1 -+select extractValue('<a>a1<b ba="1" ba="2">b1</b><b>b2</b>4</a>','/a/b[sum(@ba)=3]'); -+extractValue('<a>a1<b ba="1" ba="2">b1</b><b>b2</b>4</a>','/a/b[sum(@ba)=3]') -+b1 -+select extractValue('<a><b>b1</b><b>b2</b></a>','/a/b[1]'); -+extractValue('<a><b>b1</b><b>b2</b></a>','/a/b[1]') -+b1 -+select extractValue('<a><b>b1</b><b>b2</b></a>','/a/b[boolean(1)]'); -+extractValue('<a><b>b1</b><b>b2</b></a>','/a/b[boolean(1)]') -+b1 b2 -+select extractValue('<a><b>b1</b><b>b2</b></a>','/a/b[true()]'); -+extractValue('<a><b>b1</b><b>b2</b></a>','/a/b[true()]') -+b1 b2 -+select extractValue('<a><b>b1</b><b>b2</b></a>','/a/b[number(true())]'); -+extractValue('<a><b>b1</b><b>b2</b></a>','/a/b[number(true())]') -+b1 -+select extractValue('<a>ab</a>','/a[contains("abc","b")]'); -+extractValue('<a>ab</a>','/a[contains("abc","b")]') -+ab -+select extractValue('<a>ab</a>','/a[contains(.,"a")]'); -+extractValue('<a>ab</a>','/a[contains(.,"a")]') -+ab -+select extractValue('<a>ab</a>','/a[contains(.,"b")]'); -+extractValue('<a>ab</a>','/a[contains(.,"b")]') -+ab -+select extractValue('<a>ab</a>','/a[contains(.,"c")]'); -+extractValue('<a>ab</a>','/a[contains(.,"c")]') -+ -+select extractValue('<a b="1">ab</a>','/a[concat(@b,"2")="12"]'); -+extractValue('<a b="1">ab</a>','/a[concat(@b,"2")="12"]') -+ab -+SET @xml='<a b="11" b="12" b="21" b="22">ab</a>'; -+select extractValue(@xml, '/a/@b[substring(.,2)="1"]'); -+extractValue(@xml, '/a/@b[substring(.,2)="1"]') -+11 21 -+select extractValue(@xml, '/a/@b[substring(.,2)="2"]'); -+extractValue(@xml, '/a/@b[substring(.,2)="2"]') -+12 22 -+select extractValue(@xml, '/a/@b[substring(.,1,1)="1"]'); -+extractValue(@xml, '/a/@b[substring(.,1,1)="1"]') -+11 12 -+select extractValue(@xml, '/a/@b[substring(.,1,1)="2"]'); -+extractValue(@xml, '/a/@b[substring(.,1,1)="2"]') -+21 22 -+select extractValue(@xml, '/a/@b[substring(.,2,1)="1"]'); -+extractValue(@xml, '/a/@b[substring(.,2,1)="1"]') -+11 21 -+select extractValue(@xml, '/a/@b[substring(.,2,1)="2"]'); -+extractValue(@xml, '/a/@b[substring(.,2,1)="2"]') -+12 22 -+SET @xml='<a b="b11" b="b12" b="b21" b="22"/>'; -+select extractValue(@xml,'/a/@b'); -+extractValue(@xml,'/a/@b') -+b11 b12 b21 22 -+select extractValue(@xml,'/a/@b[contains(.,"1")]'); -+extractValue(@xml,'/a/@b[contains(.,"1")]') -+b11 b12 b21 -+select extractValue(@xml,'/a/@b[contains(.,"1")][contains(.,"2")]'); -+extractValue(@xml,'/a/@b[contains(.,"1")][contains(.,"2")]') -+b12 b21 -+select extractValue(@xml,'/a/@b[contains(.,"1")][contains(.,"2")][2]'); -+extractValue(@xml,'/a/@b[contains(.,"1")][contains(.,"2")][2]') -+b21 -+SET @xml='<a>a1<b>b1<c>c1</c>b2</b>a2</a>'; -+select UpdateXML('<a>a1<b>b1<c>c1</c>b2</b>a2</a>','/a/b/c','+++++++++'); -+UpdateXML('<a>a1<b>b1<c>c1</c>b2</b>a2</a>','/a/b/c','+++++++++') -+<a>a1<b>b1+++++++++b2</b>a2</a> -+select UpdateXML('<a>a1<b>b1<c>c1</c>b2</b>a2</a>','/a/b/c','<c1>+++++++++</c1>'); -+UpdateXML('<a>a1<b>b1<c>c1</c>b2</b>a2</a>','/a/b/c','<c1>+++++++++</c1>') -+<a>a1<b>b1<c1>+++++++++</c1>b2</b>a2</a> -+select UpdateXML('<a>a1<b>b1<c>c1</c>b2</b>a2</a>','/a/b/c','<c1/>'); -+UpdateXML('<a>a1<b>b1<c>c1</c>b2</b>a2</a>','/a/b/c','<c1/>') -+<a>a1<b>b1<c1/>b2</b>a2</a> -+SET @xml='<a><b>bb</b></a>'; -+select UpdateXML(@xml, '/a/b', '<b>ccc</b>'); -+UpdateXML(@xml, '/a/b', '<b>ccc</b>') -+<a><b>ccc</b></a> -+SET @xml='<a aa1="aa1" aa2="aa2"><b bb1="bb1" bb2="bb2">bb</b></a>'; -+select UpdateXML(@xml, '/a/b', '<b>ccc</b>'); -+UpdateXML(@xml, '/a/b', '<b>ccc</b>') -+<a aa1="aa1" aa2="aa2"><b>ccc</b></a> -+select UpdateXML(@xml, '/a/@aa1', ''); -+UpdateXML(@xml, '/a/@aa1', '') -+<a aa2="aa2"><b bb1="bb1" bb2="bb2">bb</b></a> -+select UpdateXML(@xml, '/a/@aa1', 'aa3="aa3"'); -+UpdateXML(@xml, '/a/@aa1', 'aa3="aa3"') -+<a aa3="aa3" aa2="aa2"><b bb1="bb1" bb2="bb2">bb</b></a> -+select UpdateXML(@xml, '/a/@aa2', ''); -+UpdateXML(@xml, '/a/@aa2', '') -+<a aa1="aa1" ><b bb1="bb1" bb2="bb2">bb</b></a> -+select UpdateXML(@xml, '/a/@aa2', 'aa3="aa3"'); -+UpdateXML(@xml, '/a/@aa2', 'aa3="aa3"') -+<a aa1="aa1" aa3="aa3"><b bb1="bb1" bb2="bb2">bb</b></a> -+select UpdateXML(@xml, '/a/b/@bb1', ''); -+UpdateXML(@xml, '/a/b/@bb1', '') -+<a aa1="aa1" aa2="aa2"><b bb2="bb2">bb</b></a> -+select UpdateXML(@xml, '/a/b/@bb1', 'bb3="bb3"'); -+UpdateXML(@xml, '/a/b/@bb1', 'bb3="bb3"') -+<a aa1="aa1" aa2="aa2"><b bb3="bb3" bb2="bb2">bb</b></a> -+select UpdateXML(@xml, '/a/b/@bb2', ''); -+UpdateXML(@xml, '/a/b/@bb2', '') -+<a aa1="aa1" aa2="aa2"><b bb1="bb1" >bb</b></a> -+select UpdateXML(@xml, '/a/b/@bb2', 'bb3="bb3"'); -+UpdateXML(@xml, '/a/b/@bb2', 'bb3="bb3"') -+<a aa1="aa1" aa2="aa2"><b bb1="bb1" bb3="bb3">bb</b></a> -diff -Naur mysql.orig/mysql-test/t/xml.test mysql.xml/mysql-test/t/xml.test ---- mysql.orig/mysql-test/t/xml.test 1970-01-01 01:00:00.000000000 +0100 -+++ mysql.xml/mysql-test/t/xml.test 2005-04-13 09:15:03.000000000 +0200 -@@ -0,0 +1,217 @@ -+SET @xml='<a aa1="aa1" aa2="aa2">a1<b ba1="ba1">b1<c>c1</c>b2</b>a2</a>'; -+SELECT extractValue(@xml,'/a'); -+SELECT extractValue(@xml,'/a/b'); -+SELECT extractValue(@xml,'/a/b/c'); -+SELECT extractValue(@xml,'/a/@aa1'); -+SELECT extractValue(@xml,'/a/@aa2'); -+SELECT extractValue(@xml,'/a/@*'); -+SELECT extractValue(@xml,'//@ba1'); -+ -+SELECT extractValue(@xml,'//a'); -+SELECT extractValue(@xml,'//b'); -+SELECT extractValue(@xml,'//c'); -+SELECT extractValue(@xml,'/a//b'); -+SELECT extractValue(@xml,'/a//c'); -+SELECT extractValue(@xml,'//*'); -+SELECT extractValue(@xml,'/a//*'); -+SELECT extractValue(@xml,'/./a'); -+SELECT extractValue(@xml,'/a/b/.'); -+SELECT extractValue(@xml,'/a/b/..'); -+SELECT extractValue(@xml,'/a/b/../@aa1'); -+SELECT extractValue(@xml,'/*'); -+SELECT extractValue(@xml,'/*/*'); -+SELECT extractValue(@xml,'/*/*/*'); -+ -+SELECT extractValue(@xml,'/a/child::*'); -+SELECT extractValue(@xml,'/a/descendant::*'); -+SELECT extractValue(@xml,'/a/descendant-or-self::*'); -+SELECT extractValue(@xml,'/a/attribute::*'); -+SELECT extractValue(@xml,'/a/b/c/parent::*'); -+SELECT extractValue(@xml,'/a/b/c/ancestor::*'); -+SELECT extractValue(@xml,'/a/b/c/ancestor-or-self::*'); -+SELECT extractValue(@xml,'/descendant-or-self::*'); -+ -+SET @xml='<a>a11<b ba="ba11" ba="ba12">b11</b><b ba="ba21" ba="ba22">b21<c>c1</c>b22</b>a12</a>'; -+SELECT extractValue(@xml,'/a/b/c/ancestor-or-self::*'); -+SELECT extractValue(@xml,'//@ba'); -+ -+SET @xml='<a><b>b</b><c>c</c></a>'; -+SELECT extractValue(@xml,'/a/b'); -+SELECT extractValue(@xml,'/a/c'); -+SELECT extractValue(@xml,'/a/child::b'); -+SELECT extractValue(@xml,'/a/child::c'); -+ -+SET @xml='<a><b>b1</b><c>c1</c><b>b2</b><c>c2</c></a>'; -+SELECT extractValue(@xml,'/a/b[1]'); -+SELECT extractValue(@xml,'/a/b[2]'); -+SELECT extractValue(@xml,'/a/c[1]'); -+SELECT extractValue(@xml,'/a/c[2]'); -+ -+SET @xml='<a><b x="xb1" x="xb2"/><c x="xc1" x="xc2"/></a>'; -+SELECT extractValue(@xml,'/a//@x'); -+SELECT extractValue(@xml,'/a//@x[1]'); -+SELECT extractValue(@xml,'/a//@x[2]'); -+ -+SET @xml='<a><b>b1</b><b>b2</b><c><b>c1b1</b><b>c1b2</b></c><c><b>c2b1</c></b>/a>'; -+SELECT extractValue(@xml,'//b[1]'); -+SELECT extractValue(@xml,'/descendant::b[1]'); -+ -+SET @xml='<a><b>b1</b><b>b2</b></a>'; -+SELECT extractValue(@xml,'/a/b[1+0]'); -+SELECT extractValue(@xml,'/a/b[1*1]'); -+SELECT extractValue(@xml,'/a/b[--1]'); -+SELECT extractValue(@xml,'/a/b[2*1-1]'); -+ -+SELECT extractValue(@xml,'/a/b[1+1]'); -+SELECT extractValue(@xml,'/a/b[1*2]'); -+SELECT extractValue(@xml,'/a/b[--2]'); -+SELECT extractValue(@xml,'/a/b[1*(3-1)]'); -+ -+SELECT extractValue(@xml,'//*[1=1]'); -+SELECT extractValue(@xml,'//*[1!=1]'); -+SELECT extractValue(@xml,'//*[1>1]'); -+SELECT extractValue(@xml,'//*[2>1]'); -+SELECT extractValue(@xml,'//*[1>2]'); -+SELECT extractValue(@xml,'//*[1>=1]'); -+SELECT extractValue(@xml,'//*[2>=1]'); -+SELECT extractValue(@xml,'//*[1>=2]'); -+SELECT extractValue(@xml,'//*[1<1]'); -+SELECT extractValue(@xml,'//*[2<1]'); -+SELECT extractValue(@xml,'//*[1<2]'); -+SELECT extractValue(@xml,'//*[1<=1]'); -+SELECT extractValue(@xml,'//*[2<=1]'); -+SELECT extractValue(@xml,'//*[1<=2]'); -+ -+SET @xml='<a><b>b11<c>c11</c></b><b>b21<c>c21</c></b></a>'; -+SELECT extractValue(@xml,'/a/b[c="c11"]'); -+SELECT extractValue(@xml,'/a/b[c="c21"]'); -+ -+SET @xml='<a><b c="c11">b11</b><b c="c21">b21</b></a>'; -+SELECT extractValue(@xml,'/a/b[@c="c11"]'); -+SELECT extractValue(@xml,'/a/b[@c="c21"]'); -+ -+SET @xml='<a>a1<b c="c11">b11<d>d11</d></b><b c="c21">b21<d>d21</d></b></a>'; -+SELECT extractValue(@xml, '/a/b[@c="c11"]/d'); -+SELECT extractValue(@xml, '/a/b[@c="c21"]/d'); -+SELECT extractValue(@xml, '/a/b[d="d11"]/@c'); -+SELECT extractValue(@xml, '/a/b[d="d21"]/@c'); -+SELECT extractValue(@xml, '/a[b="b11"]'); -+SELECT extractValue(@xml, '/a[b/@c="c11"]'); -+SELECT extractValue(@xml, '/a[b/d="d11"]'); -+SELECT extractValue(@xml, '/a[/a/b="b11"]'); -+SELECT extractValue(@xml, '/a[/a/b/@c="c11"]'); -+SELECT extractValue(@xml, '/a[/a/b/d="d11"]'); -+ -+SELECT extractValue('<a>a</a>', '/a[false()]'); -+SELECT extractValue('<a>a</a>', '/a[true()]'); -+SELECT extractValue('<a>a</a>', '/a[not(false())]'); -+SELECT extractValue('<a>a</a>', '/a[not(true())]'); -+SELECT extractValue('<a>a</a>', '/a[true() and true()]'); -+SELECT extractValue('<a>a</a>', '/a[true() and false()]'); -+SELECT extractValue('<a>a</a>', '/a[false()and false()]'); -+SELECT extractValue('<a>a</a>', '/a[false()and true()]'); -+SELECT extractValue('<a>a</a>', '/a[true() or true()]'); -+SELECT extractValue('<a>a</a>', '/a[true() or false()]'); -+SELECT extractValue('<a>a</a>', '/a[false()or false()]'); -+SELECT extractValue('<a>a</a>', '/a[false()or true()]'); -+ -+SET @xml='<a>ab<b c="c" c="e">b1</b><b c="d">b2</b><b c="f" c="e">b3</b></a>'; -+select extractValue(@xml,'/a/b[@c="c"]'); -+select extractValue(@xml,'/a/b[@c="d"]'); -+select extractValue(@xml,'/a/b[@c="e"]'); -+select extractValue(@xml,'/a/b[not(@c="e")]'); -+select extractValue(@xml,'/a/b[@c!="e"]'); -+select extractValue(@xml,'/a/b[@c="c" or @c="d"]'); -+select extractValue(@xml,'/a/b[@c="c" and @c="e"]'); -+ -+SET @xml='<a><b c="c" d="d">b1</b><b d="d" e="e">b2</b></a>'; -+select extractValue(@xml,'/a/b[@c]'); -+select extractValue(@xml,'/a/b[@d]'); -+select extractValue(@xml,'/a/b[@e]'); -+select extractValue(@xml,'/a/b[not(@c)]'); -+select extractValue(@xml,'/a/b[not(@d)]'); -+select extractValue(@xml,'/a/b[not(@e)]'); -+ -+select extractValue(@xml, '/a/b[boolean(@c) or boolean(@d)]'); -+select extractValue(@xml, '/a/b[boolean(@c) or boolean(@e)]'); -+select extractValue(@xml, '/a/b[boolean(@d) or boolean(@e)]'); -+select extractValue(@xml, '/a/b[boolean(@c) and boolean(@d)]'); -+select extractValue(@xml, '/a/b[boolean(@c) and boolean(@e)]'); -+select extractValue(@xml, '/a/b[boolean(@d) and boolean(@e)]'); -+ -+select extractValue(@xml, '/a/b[@c or @d]'); -+select extractValue(@xml, '/a/b[@c or @e]'); -+select extractValue(@xml, '/a/b[@d or @e]'); -+select extractValue(@xml, '/a/b[@c and @d]'); -+select extractValue(@xml, '/a/b[@c and @e]'); -+select extractValue(@xml, '/a/b[@d and @e]'); -+ -+SET @xml='<a><b c="c">b1</b><b>b2</b></a>'; -+SELECT extractValue(@xml,'/a/b[@*]'); -+SELECT extractValue(@xml,'/a/b[not(@*)]'); -+ -+SELECT extractValue('<a>a</a>', '/a[ceiling(3.1)=4]'); -+SELECT extractValue('<a>a</a>', '/a[floor(3.1)=3]'); -+SELECT extractValue('<a>a</a>', '/a[round(3.1)=3]'); -+SELECT extractValue('<a>a</a>', '/a[round(3.8)=4]'); -+ -+SELECT extractValue('<a><b>b</b><c>c</c></a>', '/a/b | /a/c'); -+ -+select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[position()=1]'); -+select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[position()=2]'); -+select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[position()=3]'); -+select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[1=position()]'); -+select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[2=position()]'); -+select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[3=position()]'); -+select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[2>=position()]'); -+select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[2<=position()]'); -+select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[position()=3 or position()=2]'); -+ -+SELECT extractValue('<a>a<b>a1<c>c1</c></b><b>a2</b></a>','/a/b[count(c)=0]'); -+SELECT extractValue('<a>a<b>a1<c>c1</c></b><b>a2</b></a>','/a/b[count(c)=1]'); -+select extractValue('<a>a1<b ba="1" ba="2">b1</b><b>b2</b>4</a>','/a/b[sum(@ba)=3]'); -+ -+select extractValue('<a><b>b1</b><b>b2</b></a>','/a/b[1]'); -+select extractValue('<a><b>b1</b><b>b2</b></a>','/a/b[boolean(1)]'); -+select extractValue('<a><b>b1</b><b>b2</b></a>','/a/b[true()]'); -+select extractValue('<a><b>b1</b><b>b2</b></a>','/a/b[number(true())]'); -+ -+select extractValue('<a>ab</a>','/a[contains("abc","b")]'); -+select extractValue('<a>ab</a>','/a[contains(.,"a")]'); -+select extractValue('<a>ab</a>','/a[contains(.,"b")]'); -+select extractValue('<a>ab</a>','/a[contains(.,"c")]'); -+ -+select extractValue('<a b="1">ab</a>','/a[concat(@b,"2")="12"]'); -+ -+SET @xml='<a b="11" b="12" b="21" b="22">ab</a>'; -+select extractValue(@xml, '/a/@b[substring(.,2)="1"]'); -+select extractValue(@xml, '/a/@b[substring(.,2)="2"]'); -+select extractValue(@xml, '/a/@b[substring(.,1,1)="1"]'); -+select extractValue(@xml, '/a/@b[substring(.,1,1)="2"]'); -+select extractValue(@xml, '/a/@b[substring(.,2,1)="1"]'); -+select extractValue(@xml, '/a/@b[substring(.,2,1)="2"]'); -+ -+SET @xml='<a b="b11" b="b12" b="b21" b="22"/>'; -+select extractValue(@xml,'/a/@b'); -+select extractValue(@xml,'/a/@b[contains(.,"1")]'); -+select extractValue(@xml,'/a/@b[contains(.,"1")][contains(.,"2")]'); -+select extractValue(@xml,'/a/@b[contains(.,"1")][contains(.,"2")][2]'); -+ -+SET @xml='<a>a1<b>b1<c>c1</c>b2</b>a2</a>'; -+select UpdateXML('<a>a1<b>b1<c>c1</c>b2</b>a2</a>','/a/b/c','+++++++++'); -+select UpdateXML('<a>a1<b>b1<c>c1</c>b2</b>a2</a>','/a/b/c','<c1>+++++++++</c1>'); -+select UpdateXML('<a>a1<b>b1<c>c1</c>b2</b>a2</a>','/a/b/c','<c1/>'); -+ -+SET @xml='<a><b>bb</b></a>'; -+select UpdateXML(@xml, '/a/b', '<b>ccc</b>'); -+ -+SET @xml='<a aa1="aa1" aa2="aa2"><b bb1="bb1" bb2="bb2">bb</b></a>'; -+select UpdateXML(@xml, '/a/b', '<b>ccc</b>'); -+select UpdateXML(@xml, '/a/@aa1', ''); -+select UpdateXML(@xml, '/a/@aa1', 'aa3="aa3"'); -+select UpdateXML(@xml, '/a/@aa2', ''); -+select UpdateXML(@xml, '/a/@aa2', 'aa3="aa3"'); -+select UpdateXML(@xml, '/a/b/@bb1', ''); -+select UpdateXML(@xml, '/a/b/@bb1', 'bb3="bb3"'); -+select UpdateXML(@xml, '/a/b/@bb2', ''); -+select UpdateXML(@xml, '/a/b/@bb2', 'bb3="bb3"'); -diff -Naur mysql.orig/sql/Makefile.am mysql.xml/sql/Makefile.am ---- mysql.orig/sql/Makefile.am 2005-05-15 06:16:51.000000000 +0200 -+++ mysql.xml/sql/Makefile.am 2005-05-20 15:19:29.000000000 +0200 -@@ -45,6 +45,7 @@ - $(LDADD) $(CXXLDFLAGS) $(WRAPLIBS) @LIBDL@ @openssl_libs@ - noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \ - item_strfunc.h item_timefunc.h item_uniq.h \ -+ item_xmlfunc.h \ - item_create.h item_subselect.h item_row.h \ - mysql_priv.h item_geofunc.h sql_bitmap.h \ - procedure.h sql_class.h sql_lex.h sql_list.h \ -@@ -68,7 +69,7 @@ - item.cc item_sum.cc item_buff.cc item_func.cc \ - item_cmpfunc.cc item_strfunc.cc item_timefunc.cc \ - thr_malloc.cc item_create.cc item_subselect.cc \ -- item_row.cc item_geofunc.cc \ -+ item_row.cc item_geofunc.cc item_xmlfunc.cc \ - field.cc strfunc.cc key.cc sql_class.cc sql_list.cc \ - net_serv.cc protocol.cc sql_state.c \ - lock.cc my_lock.c \ -diff -Naur mysql.orig/sql/item.h mysql.xml/sql/item.h ---- mysql.orig/sql/item.h 2005-05-15 06:16:50.000000000 +0200 -+++ mysql.xml/sql/item.h 2005-05-20 15:19:29.000000000 +0200 -@@ -241,7 +241,8 @@ - PROC_ITEM,COND_ITEM, REF_ITEM, FIELD_STD_ITEM, - FIELD_VARIANCE_ITEM, INSERT_VALUE_ITEM, - SUBSELECT_ITEM, ROW_ITEM, CACHE_ITEM, TYPE_HOLDER, -- PARAM_ITEM, TRIGGER_FIELD_ITEM, DECIMAL_ITEM}; -+ PARAM_ITEM, TRIGGER_FIELD_ITEM, DECIMAL_ITEM, -+ XPATH_NODESET, XPATH_NODESET_CMP }; - - enum cond_result { COND_UNDEF,COND_OK,COND_TRUE,COND_FALSE }; - -@@ -391,6 +392,7 @@ - TRUE value is true (not equal to 0) - */ - virtual bool val_bool(); -+ virtual String *val_nodeset(String*) { return 0; } - /* Helper functions, see item_sum.cc */ - String *val_string_from_real(String *str); - String *val_string_from_int(String *str); -@@ -1429,6 +1431,7 @@ - #include "item_timefunc.h" - #include "item_uniq.h" - #include "item_subselect.h" -+#include "item_xmlfunc.h" - - class Item_copy_string :public Item - { -diff -Naur mysql.orig/sql/item.h.orig mysql.xml/sql/item.h.orig ---- mysql.orig/sql/item.h.orig 1970-01-01 01:00:00.000000000 +0100 -+++ mysql.xml/sql/item.h.orig 2005-05-15 06:16:50.000000000 +0200 -@@ -0,0 +1,1850 @@ -+/* Copyright (C) 2000-2003 MySQL AB & MySQL Finland AB & TCX DataKonsult AB -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 2 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the Free Software -+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -+ -+ -+#ifdef USE_PRAGMA_INTERFACE -+#pragma interface /* gcc class implementation */ -+#endif -+ -+class Protocol; -+struct st_table_list; -+void item_init(void); /* Init item functions */ -+class Item_field; -+ -+ -+/* -+ "Declared Type Collation" -+ A combination of collation and its derivation. -+*/ -+ -+enum Derivation -+{ -+ DERIVATION_IGNORABLE= 5, -+ DERIVATION_COERCIBLE= 4, -+ DERIVATION_SYSCONST= 3, -+ DERIVATION_IMPLICIT= 2, -+ DERIVATION_NONE= 1, -+ DERIVATION_EXPLICIT= 0 -+}; -+ -+/* -+ Flags for collation aggregation modes: -+ MY_COLL_ALLOW_SUPERSET_CONV - allow conversion to a superset -+ MY_COLL_ALLOW_COERCIBLE_CONV - allow conversion of a coercible value -+ (i.e. constant). -+ MY_COLL_ALLOW_CONV - allow any kind of conversion -+ (combination of the above two) -+ MY_COLL_DISALLOW_NONE - don't allow return DERIVATION_NONE -+ (e.g. when aggregating for comparison) -+ MY_COLL_CMP_CONV - combination of MY_COLL_ALLOW_CONV -+ and MY_COLL_DISALLOW_NONE -+*/ -+ -+#define MY_COLL_ALLOW_SUPERSET_CONV 1 -+#define MY_COLL_ALLOW_COERCIBLE_CONV 2 -+#define MY_COLL_ALLOW_CONV 3 -+#define MY_COLL_DISALLOW_NONE 4 -+#define MY_COLL_CMP_CONV 7 -+ -+class DTCollation { -+public: -+ CHARSET_INFO *collation; -+ enum Derivation derivation; -+ -+ DTCollation() -+ { -+ collation= &my_charset_bin; -+ derivation= DERIVATION_NONE; -+ } -+ DTCollation(CHARSET_INFO *collation_arg, Derivation derivation_arg) -+ { -+ collation= collation_arg; -+ derivation= derivation_arg; -+ } -+ void set(DTCollation &dt) -+ { -+ collation= dt.collation; -+ derivation= dt.derivation; -+ } -+ void set(CHARSET_INFO *collation_arg, Derivation derivation_arg) -+ { -+ collation= collation_arg; -+ derivation= derivation_arg; -+ } -+ void set(CHARSET_INFO *collation_arg) -+ { collation= collation_arg; } -+ void set(Derivation derivation_arg) -+ { derivation= derivation_arg; } -+ bool aggregate(DTCollation &dt, uint flags= 0); -+ bool set(DTCollation &dt1, DTCollation &dt2, uint flags= 0) -+ { set(dt1); return aggregate(dt2, flags); } -+ const char *derivation_name() const -+ { -+ switch(derivation) -+ { -+ case DERIVATION_IGNORABLE: return "IGNORABLE"; -+ case DERIVATION_COERCIBLE: return "COERCIBLE"; -+ case DERIVATION_IMPLICIT: return "IMPLICIT"; -+ case DERIVATION_SYSCONST: return "SYSCONST"; -+ case DERIVATION_EXPLICIT: return "EXPLICIT"; -+ case DERIVATION_NONE: return "NONE"; -+ default: return "UNKNOWN"; -+ } -+ } -+}; -+ -+ -+/*************************************************************************/ -+/* -+ A framework to easily handle different return types for hybrid items -+ (hybrid item is an item whose operand can be of any type, e.g. integer, -+ real, decimal). -+*/ -+ -+struct Hybrid_type_traits; -+ -+struct Hybrid_type -+{ -+ longlong integer; -+ -+ double real; -+ /* -+ Use two decimal buffers interchangeably to speed up += operation -+ which has no native support in decimal library. -+ Hybrid_type+= arg is implemented as dec_buf[1]= dec_buf[0] + arg. -+ The third decimal is used as a handy temporary storage. -+ */ -+ my_decimal dec_buf[3]; -+ int used_dec_buf_no; -+ -+ /* -+ Traits moved to a separate class to -+ a) be able to easily change object traits in runtime -+ b) they work as a differentiator for the union above -+ */ -+ const Hybrid_type_traits *traits; -+ -+ Hybrid_type() {} -+ /* XXX: add traits->copy() when needed */ -+ Hybrid_type(const Hybrid_type &rhs) :traits(rhs.traits) {} -+}; -+ -+ -+/* Hybryd_type_traits interface + default implementation for REAL_RESULT */ -+ -+struct Hybrid_type_traits -+{ -+ virtual Item_result type() const { return REAL_RESULT; } -+ -+ virtual void -+ fix_length_and_dec(Item *item, Item *arg) const; -+ -+ /* Hybrid_type operations. */ -+ virtual void set_zero(Hybrid_type *val) const { val->real= 0.0; } -+ virtual void add(Hybrid_type *val, Field *f) const -+ { val->real+= f->val_real(); } -+ virtual void div(Hybrid_type *val, ulonglong u) const -+ { val->real/= ulonglong2double(u); } -+ -+ virtual longlong val_int(Hybrid_type *val, bool unsigned_flag) const -+ { return (longlong) val->real; } -+ virtual double val_real(Hybrid_type *val) const { return val->real; } -+ virtual my_decimal *val_decimal(Hybrid_type *val, my_decimal *buf) const; -+ virtual String *val_str(Hybrid_type *val, String *buf, uint8 decimals) const; -+ static const Hybrid_type_traits *instance(); -+}; -+ -+ -+struct Hybrid_type_traits_decimal: public Hybrid_type_traits -+{ -+ virtual Item_result type() const { return DECIMAL_RESULT; } -+ -+ virtual void -+ fix_length_and_dec(Item *arg, Item *item) const; -+ -+ /* Hybrid_type operations. */ -+ virtual void set_zero(Hybrid_type *val) const; -+ virtual void add(Hybrid_type *val, Field *f) const; -+ virtual void div(Hybrid_type *val, ulonglong u) const; -+ -+ virtual longlong val_int(Hybrid_type *val, bool unsigned_flag) const; -+ virtual double val_real(Hybrid_type *val) const; -+ virtual my_decimal *val_decimal(Hybrid_type *val, my_decimal *buf) const -+ { return &val->dec_buf[val->used_dec_buf_no]; } -+ virtual String *val_str(Hybrid_type *val, String *buf, uint8 decimals) const; -+ static const Hybrid_type_traits_decimal *instance(); -+}; -+ -+ -+struct Hybrid_type_traits_integer: public Hybrid_type_traits -+{ -+ virtual Item_result type() const { return INT_RESULT; } -+ -+ virtual void -+ fix_length_and_dec(Item *arg, Item *item) const; -+ -+ /* Hybrid_type operations. */ -+ virtual void set_zero(Hybrid_type *val) const -+ { val->integer= 0; } -+ virtual void add(Hybrid_type *val, Field *f) const -+ { val->integer+= f->val_int(); } -+ virtual void div(Hybrid_type *val, ulonglong u) const -+ { val->integer/= (longlong) u; } -+ -+ virtual longlong val_int(Hybrid_type *val, bool unsigned_flag) const -+ { return val->integer; } -+ virtual double val_real(Hybrid_type *val) const -+ { return (double) val->integer; } -+ virtual my_decimal *val_decimal(Hybrid_type *val, my_decimal *buf) const -+ { -+ int2my_decimal(E_DEC_FATAL_ERROR, val->integer, 0, &val->dec_buf[2]); -+ return &val->dec_buf[2]; -+ } -+ virtual String *val_str(Hybrid_type *val, String *buf, uint8 decimals) const -+ { buf->set(val->integer, &my_charset_bin); return buf;} -+ static const Hybrid_type_traits_integer *instance(); -+}; -+ -+/*************************************************************************/ -+ -+typedef bool (Item::*Item_processor)(byte *arg); -+typedef Item* (Item::*Item_transformer) (byte *arg); -+ -+typedef void (*Cond_traverser) (const Item *item, void *arg); -+ -+class Item { -+ Item(const Item &); /* Prevent use of these */ -+ void operator=(Item &); -+public: -+ static void *operator new(size_t size) {return (void*) sql_alloc((uint) size); } -+ static void *operator new(size_t size, MEM_ROOT *mem_root) -+ { return (void*) alloc_root(mem_root, (uint) size); } -+ static void operator delete(void *ptr,size_t size) { TRASH(ptr, size); } -+ static void operator delete(void *ptr, MEM_ROOT *mem_root) {} -+ -+ enum Type {FIELD_ITEM= 0, FUNC_ITEM, SUM_FUNC_ITEM, STRING_ITEM, -+ INT_ITEM, REAL_ITEM, NULL_ITEM, VARBIN_ITEM, -+ COPY_STR_ITEM, FIELD_AVG_ITEM, DEFAULT_VALUE_ITEM, -+ PROC_ITEM,COND_ITEM, REF_ITEM, FIELD_STD_ITEM, -+ FIELD_VARIANCE_ITEM, INSERT_VALUE_ITEM, -+ SUBSELECT_ITEM, ROW_ITEM, CACHE_ITEM, TYPE_HOLDER, -+ PARAM_ITEM, TRIGGER_FIELD_ITEM, DECIMAL_ITEM}; -+ -+ enum cond_result { COND_UNDEF,COND_OK,COND_TRUE,COND_FALSE }; -+ -+ enum traverse_order { POSTFIX, PREFIX }; -+ -+ /* -+ str_values's main purpose is to be used to cache the value in -+ save_in_field -+ */ -+ String str_value; -+ my_string name; /* Name from select */ -+ /* Original item name (if it was renamed)*/ -+ my_string orig_name; -+ Item *next; -+ uint32 max_length; -+ uint name_length; /* Length of name */ -+ uint8 marker, decimals; -+ my_bool maybe_null; /* If item may be null */ -+ my_bool null_value; /* if item is null */ -+ my_bool unsigned_flag; -+ my_bool with_sum_func; -+ my_bool fixed; /* If item fixed with fix_fields */ -+ DTCollation collation; -+ -+ // alloc & destruct is done as start of select using sql_alloc -+ Item(); -+ /* -+ Constructor used by Item_field, Item_ref & aggregate (sum) functions. -+ Used for duplicating lists in processing queries with temporary -+ tables -+ Also it used for Item_cond_and/Item_cond_or for creating -+ top AND/OR structure of WHERE clause to protect it of -+ optimisation changes in prepared statements -+ */ -+ Item(THD *thd, Item *item); -+ virtual ~Item() -+ { -+ name=0; -+ } /*lint -e1509 */ -+ void set_name(const char *str,uint length, CHARSET_INFO *cs); -+ void rename(char *new_name); -+ void init_make_field(Send_field *tmp_field,enum enum_field_types type); -+ virtual void cleanup(); -+ virtual void make_field(Send_field *field); -+ Field *make_string_field(TABLE *table); -+ virtual bool fix_fields(THD *, struct st_table_list *, Item **); -+ /* -+ should be used in case where we are sure that we do not need -+ complete fix_fields() procedure. -+ */ -+ inline void quick_fix_field() { fixed= 1; } -+ /* Function returns 1 on overflow and -1 on fatal errors */ -+ int save_in_field_no_warnings(Field *field, bool no_conversions); -+ virtual int save_in_field(Field *field, bool no_conversions); -+ virtual void save_org_in_field(Field *field) -+ { (void) save_in_field(field, 1); } -+ virtual int save_safe_in_field(Field *field) -+ { return save_in_field(field, 1); } -+ virtual bool send(Protocol *protocol, String *str); -+ virtual bool eq(const Item *, bool binary_cmp) const; -+ virtual Item_result result_type() const { return REAL_RESULT; } -+ virtual Item_result cast_to_int_type() const { return result_type(); } -+ virtual enum_field_types field_type() const; -+ virtual enum Type type() const =0; -+ /* valXXX methods must return NULL or 0 or 0.0 if null_value is set. */ -+ /* -+ Return double precision floating point representation of item. -+ -+ SYNOPSIS -+ val_real() -+ -+ RETURN -+ In case of NULL value return 0.0 and set null_value flag to TRUE. -+ If value is not null null_value flag will be reset to FALSE. -+ */ -+ virtual double val_real()=0; -+ /* -+ Return integer representation of item. -+ -+ SYNOPSIS -+ val_int() -+ -+ RETURN -+ In case of NULL value return 0 and set null_value flag to TRUE. -+ If value is not null null_value flag will be reset to FALSE. -+ */ -+ virtual longlong val_int()=0; -+ /* -+ Return string representation of this item object. -+ -+ SYNOPSIS -+ val_str() -+ str an allocated buffer this or any nested Item object can use to -+ store return value of this method. -+ -+ NOTE -+ Buffer passed via argument should only be used if the item itself -+ doesn't have an own String buffer. In case when the item maintains -+ it's own string buffer, it's preferable to return it instead to -+ minimize number of mallocs/memcpys. -+ The caller of this method can modify returned string, but only in case -+ when it was allocated on heap, (is_alloced() is true). This allows -+ the caller to efficiently use a buffer allocated by a child without -+ having to allocate a buffer of it's own. The buffer, given to -+ val_str() as argument, belongs to the caller and is later used by the -+ caller at it's own choosing. -+ A few implications from the above: -+ - unless you return a string object which only points to your buffer -+ but doesn't manages it you should be ready that it will be -+ modified. -+ - even for not allocated strings (is_alloced() == false) the caller -+ can change charset (see Item_func_{typecast/binary}. XXX: is this -+ a bug? -+ - still you should try to minimize data copying and return internal -+ object whenever possible. -+ -+ RETURN -+ In case of NULL value return 0 (NULL pointer) and set null_value flag -+ to TRUE. -+ If value is not null null_value flag will be reset to FALSE. -+ */ -+ virtual String *val_str(String *str)=0; -+ /* -+ Return decimal representation of item with fixed point. -+ -+ SYNOPSIS -+ val_decimal() -+ decimal_buffer buffer which can be used by Item for returning value -+ (but can be not) -+ -+ NOTE -+ Returned value should not be changed if it is not the same which was -+ passed via argument. -+ -+ RETURN -+ Return pointer on my_decimal (it can be other then passed via argument) -+ if value is not NULL (null_value flag will be reset to FALSE). -+ In case of NULL value it return 0 pointer and set null_value flag -+ to TRUE. -+ */ -+ virtual my_decimal *val_decimal(my_decimal *decimal_buffer)= 0; -+ /* -+ Return boolean value of item. -+ -+ RETURN -+ FALSE value is false or NULL -+ TRUE value is true (not equal to 0) -+ */ -+ virtual bool val_bool(); -+ /* Helper functions, see item_sum.cc */ -+ String *val_string_from_real(String *str); -+ String *val_string_from_int(String *str); -+ String *val_string_from_decimal(String *str); -+ my_decimal *val_decimal_from_real(my_decimal *decimal_value); -+ my_decimal *val_decimal_from_int(my_decimal *decimal_value); -+ my_decimal *val_decimal_from_string(my_decimal *decimal_value); -+ longlong val_int_from_decimal(); -+ double val_real_from_decimal(); -+ -+ virtual Field *get_tmp_table_field() { return 0; } -+ virtual Field *tmp_table_field(TABLE *t_arg) { return 0; } -+ virtual const char *full_name() const { return name ? name : "???"; } -+ -+ /* -+ *result* family of methods is analog of *val* family (see above) but -+ return value of result_field of item if it is present. If Item have not -+ result field, it return val(). This methods set null_value flag in same -+ way as *val* methods do it. -+ */ -+ virtual double val_result() { return val_real(); } -+ virtual longlong val_int_result() { return val_int(); } -+ virtual String *str_result(String* tmp) { return val_str(tmp); } -+ virtual my_decimal *val_decimal_result(my_decimal *val) -+ { return val_decimal(val); } -+ virtual bool val_bool_result() { return val_bool(); } -+ -+ /* bit map of tables used by item */ -+ virtual table_map used_tables() const { return (table_map) 0L; } -+ /* -+ Return table map of tables that can't be NULL tables (tables that are -+ used in a context where if they would contain a NULL row generated -+ by a LEFT or RIGHT join, the item would not be true). -+ This expression is used on WHERE item to determinate if a LEFT JOIN can be -+ converted to a normal join. -+ Generally this function should return used_tables() if the function -+ would return null if any of the arguments are null -+ As this is only used in the beginning of optimization, the value don't -+ have to be updated in update_used_tables() -+ */ -+ virtual table_map not_null_tables() const { return used_tables(); } -+ /* -+ Returns true if this is a simple constant item like an integer, not -+ a constant expression. Used in the optimizer to propagate basic constants. -+ */ -+ virtual bool basic_const_item() const { return 0; } -+ /* cloning of constant items (0 if it is not const) */ -+ virtual Item *new_item() { return 0; } -+ virtual cond_result eq_cmp_result() const { return COND_OK; } -+ inline uint float_length(uint decimals_par) const -+ { return decimals != NOT_FIXED_DEC ? (DBL_DIG+2+decimals_par) : DBL_DIG+8;} -+ virtual uint decimal_precision() const; -+ inline int decimal_int_part() const -+ { return my_decimal_int_part(decimal_precision(), decimals); } -+ /* -+ Returns true if this is constant (during query execution, i.e. its value -+ will not change until next fix_fields) and its value is known. -+ */ -+ virtual bool const_item() const { return used_tables() == 0; } -+ /* -+ Returns true if this is constant but its value may be not known yet. -+ (Can be used for parameters of prep. stmts or of stored procedures.) -+ */ -+ virtual bool const_during_execution() const -+ { return (used_tables() & ~PARAM_TABLE_BIT) == 0; } -+ virtual void print(String *str_arg) { str_arg->append(full_name()); } -+ void print_item_w_name(String *); -+ virtual void update_used_tables() {} -+ virtual void split_sum_func(THD *thd, Item **ref_pointer_array, -+ List<Item> &fields) {} -+ /* Called for items that really have to be split */ -+ void split_sum_func2(THD *thd, Item **ref_pointer_array, List<Item> &fields, -+ Item **ref); -+ virtual bool get_date(TIME *ltime,uint fuzzydate); -+ virtual bool get_time(TIME *ltime); -+ virtual bool get_date_result(TIME *ltime,uint fuzzydate) -+ { return get_date(ltime,fuzzydate); } -+ /* -+ This function is used only in Item_func_isnull/Item_func_isnotnull -+ (implementations of IS NULL/IS NOT NULL clauses). Item_func_is{not}null -+ calls this method instead of one of val/result*() methods, which -+ normally will set null_value. This allows to determine nullness of -+ a complex expression without fully evaluating it. -+ Any new item which can be NULL must implement this call. -+ */ -+ virtual bool is_null() { return 0; } -+ /* -+ it is "top level" item of WHERE clause and we do not need correct NULL -+ handling -+ */ -+ virtual void top_level_item() {} -+ /* -+ set field of temporary table for Item which can be switched on temporary -+ table during query processing (grouping and so on) -+ */ -+ virtual void set_result_field(Field *field) {} -+ virtual bool is_result_field() { return 0; } -+ virtual bool is_bool_func() { return 0; } -+ virtual void save_in_result_field(bool no_conversions) {} -+ /* -+ set value of aggregate function in case of no rows for grouping were found -+ */ -+ virtual void no_rows_in_result() {} -+ virtual Item *copy_or_same(THD *thd) { return this; } -+ virtual Item *copy_andor_structure(THD *thd) { return this; } -+ virtual Item *real_item() { return this; } -+ virtual Item *get_tmp_table_item(THD *thd) { return copy_or_same(thd); } -+ -+ static CHARSET_INFO *default_charset(); -+ virtual CHARSET_INFO *compare_collation() { return NULL; } -+ -+ virtual bool walk(Item_processor processor, byte *arg) -+ { -+ return (this->*processor)(arg); -+ } -+ -+ virtual Item* transform(Item_transformer transformer, byte *arg) -+ { -+ return (this->*transformer)(arg); -+ } -+ -+ virtual void traverse_cond(Cond_traverser traverser, -+ void *arg, traverse_order order) -+ { -+ (*traverser)(this, arg); -+ } -+ -+ virtual bool remove_dependence_processor(byte * arg) { return 0; } -+ virtual bool remove_fixed(byte * arg) { fixed= 0; return 0; } -+ virtual bool cleanup_processor(byte *arg); -+ virtual bool collect_item_field_processor(byte * arg) { return 0; } -+ virtual Item *equal_fields_propagator(byte * arg) { return this; } -+ virtual Item *set_no_const_sub(byte *arg) { return this; } -+ virtual Item *replace_equal_field(byte * arg) { return this; } -+ -+ /* -+ For SP local variable returns pointer to Item representing its -+ current value and pointer to current Item otherwise. -+ */ -+ virtual Item *this_item() { return this; } -+ /* -+ For SP local variable returns address of pointer to Item representing its -+ current value and pointer passed via parameter otherwise. -+ */ -+ virtual Item **this_item_addr(THD *thd, Item **addr) { return addr; } -+ virtual Item *this_const_item() const { return const_cast<Item*>(this); } /* For SPs mostly. */ -+ -+ // Row emulation -+ virtual uint cols() { return 1; } -+ virtual Item* el(uint i) { return this; } -+ virtual Item** addr(uint i) { return 0; } -+ virtual bool check_cols(uint c); -+ // It is not row => null inside is impossible -+ virtual bool null_inside() { return 0; } -+ // used in row subselects to get value of elements -+ virtual void bring_value() {} -+ -+ Field *tmp_table_field_from_field_type(TABLE *table); -+ virtual Item_field *filed_for_view_update() { return 0; } -+ -+ virtual Item *neg_transformer(THD *thd) { return NULL; } -+ virtual Item *safe_charset_converter(CHARSET_INFO *tocs); -+ void delete_self() -+ { -+ cleanup(); -+ delete this; -+ } -+ -+ virtual bool is_splocal() { return 0; } /* Needed for error checking */ -+}; -+ -+ -+// A local SP variable (incl. parameters), used in runtime -+class Item_splocal : public Item -+{ -+private: -+ -+ uint m_offset; -+ LEX_STRING m_name; -+ -+public: -+ -+ Item_splocal(LEX_STRING name, uint offset) -+ : m_offset(offset), m_name(name) -+ { -+ Item::maybe_null= TRUE; -+ } -+ -+ bool is_splocal() { return 1; } /* Needed for error checking */ -+ -+ Item *this_item(); -+ Item **this_item_addr(THD *thd, Item **); -+ Item *this_const_item() const; -+ -+ bool fix_fields(THD *, struct st_table_list *, Item **); -+ void cleanup(); -+ -+ inline uint get_offset() -+ { -+ return m_offset; -+ } -+ -+ // Abstract methods inherited from Item. Just defer the call to -+ // the item in the frame -+ enum Type type() const; -+ -+ double val_real(); -+ longlong val_int(); -+ String *val_str(String *sp); -+ my_decimal *val_decimal(my_decimal *); -+ bool is_null(); -+ void print(String *str); -+ -+ inline void make_field(Send_field *field) -+ { -+ Item *it= this_item(); -+ -+ if (name) -+ it->set_name(name, strlen(name), system_charset_info); -+ else -+ it->set_name(m_name.str, m_name.length, system_charset_info); -+ it->make_field(field); -+ } -+ -+ inline Item_result result_type() const -+ { -+ return this_const_item()->result_type(); -+ } -+ -+ inline bool const_item() const -+ { -+ return TRUE; -+ } -+ -+ inline int save_in_field(Field *field, bool no_conversions) -+ { -+ return this_item()->save_in_field(field, no_conversions); -+ } -+ -+ inline bool send(Protocol *protocol, String *str) -+ { -+ return this_item()->send(protocol, str); -+ } -+}; -+ -+ -+class Item_num: public Item -+{ -+public: -+ virtual Item_num *neg()= 0; -+}; -+ -+#define NO_CACHED_FIELD_INDEX ((uint)(-1)) -+ -+class st_select_lex; -+class Item_ident :public Item -+{ -+protected: -+ /* -+ We have to store initial values of db_name, table_name and field_name -+ to be able to restore them during cleanup() because they can be -+ updated during fix_fields() to values from Field object and life-time -+ of those is shorter than life-time of Item_field. -+ */ -+ const char *orig_db_name; -+ const char *orig_table_name; -+ const char *orig_field_name; -+public: -+ const char *db_name; -+ const char *table_name; -+ const char *field_name; -+ bool alias_name_used; /* true if item was resolved against alias */ -+ /* -+ Cached value of index for this field in table->field array, used by prep. -+ stmts for speeding up their re-execution. Holds NO_CACHED_FIELD_INDEX -+ if index value is not known. -+ */ -+ uint cached_field_index; -+ /* -+ Cached pointer to table which contains this field, used for the same reason -+ by prep. stmt. too in case then we have not-fully qualified field. -+ 0 - means no cached value. -+ */ -+ TABLE_LIST *cached_table; -+ st_select_lex *depended_from; -+ Item_ident(const char *db_name_par,const char *table_name_par, -+ const char *field_name_par); -+ Item_ident(THD *thd, Item_ident *item); -+ const char *full_name() const; -+ void cleanup(); -+ bool remove_dependence_processor(byte * arg); -+ void print(String *str); -+ -+ friend bool insert_fields(THD *thd,TABLE_LIST *tables, const char *db_name, -+ const char *table_name, List_iterator<Item> *it, -+ bool any_privileges, bool allocate_view_names); -+}; -+ -+class Item_equal; -+class COND_EQUAL; -+ -+class Item_field :public Item_ident -+{ -+protected: -+ void set_field(Field *field); -+public: -+ Field *field,*result_field; -+ Item_equal *item_equal; -+ bool no_const_subst; -+ /* -+ if any_privileges set to TRUE then here real effective privileges will -+ be stored -+ */ -+ uint have_privileges; -+ /* field need any privileges (for VIEW creation) */ -+ bool any_privileges; -+ -+ Item_field(const char *db_par,const char *table_name_par, -+ const char *field_name_par) -+ :Item_ident(db_par,table_name_par,field_name_par), -+ field(0), result_field(0), item_equal(0), no_const_subst(0), -+ have_privileges(0), any_privileges(0) -+ { collation.set(DERIVATION_IMPLICIT); } -+ /* -+ Constructor needed to process subselect with temporary tables (see Item) -+ */ -+ Item_field(THD *thd, Item_field *item); -+ /* -+ Constructor used inside setup_wild(), ensures that field, table, -+ and database names will live as long as Item_field (this is important -+ in prepared statements). -+ */ -+ Item_field(THD *thd, Field *field); -+ /* -+ If this constructor is used, fix_fields() won't work, because -+ db_name, table_name and column_name are unknown. It's necessary to call -+ reset_field() before fix_fields() for all fields created this way. -+ */ -+ Item_field(Field *field); -+ enum Type type() const { return FIELD_ITEM; } -+ bool eq(const Item *item, bool binary_cmp) const; -+ double val_real(); -+ longlong val_int(); -+ my_decimal *val_decimal(my_decimal *); -+ String *val_str(String*); -+ double val_result(); -+ longlong val_int_result(); -+ String *str_result(String* tmp); -+ my_decimal *val_decimal_result(my_decimal *); -+ bool val_bool_result(); -+ bool send(Protocol *protocol, String *str_arg); -+ void reset_field(Field *f); -+ bool fix_fields(THD *, struct st_table_list *, Item **); -+ void make_field(Send_field *tmp_field); -+ int save_in_field(Field *field,bool no_conversions); -+ void save_org_in_field(Field *field); -+ table_map used_tables() const; -+ enum Item_result result_type () const -+ { -+ return field->result_type(); -+ } -+ Item_result cast_to_int_type() const -+ { -+ return field->cast_to_int_type(); -+ } -+ enum_field_types field_type() const -+ { -+ return field->type(); -+ } -+ Field *get_tmp_table_field() { return result_field; } -+ Field *tmp_table_field(TABLE *t_arg) { return result_field; } -+ bool get_date(TIME *ltime,uint fuzzydate); -+ bool get_date_result(TIME *ltime,uint fuzzydate); -+ bool get_time(TIME *ltime); -+ bool is_null() { return field->is_null(); } -+ Item *get_tmp_table_item(THD *thd); -+ bool collect_item_field_processor(byte * arg); -+ void cleanup(); -+ Item_equal *find_item_equal(COND_EQUAL *cond_equal); -+ Item *equal_fields_propagator(byte *arg); -+ Item *set_no_const_sub(byte *arg); -+ Item *replace_equal_field(byte *arg); -+ inline uint32 max_disp_length() { return field->max_length(); } -+ Item_field *filed_for_view_update() { return this; } -+ Item *safe_charset_converter(CHARSET_INFO *tocs); -+ friend class Item_default_value; -+ friend class Item_insert_value; -+ friend class st_select_lex_unit; -+}; -+ -+class Item_null :public Item -+{ -+public: -+ Item_null(char *name_par=0) -+ { -+ maybe_null= null_value= TRUE; -+ max_length= 0; -+ name= name_par ? name_par : (char*) "NULL"; -+ fixed= 1; -+ collation.set(&my_charset_bin, DERIVATION_IGNORABLE); -+ } -+ enum Type type() const { return NULL_ITEM; } -+ bool eq(const Item *item, bool binary_cmp) const; -+ double val_real(); -+ longlong val_int(); -+ String *val_str(String *str); -+ my_decimal *val_decimal(my_decimal *); -+ int save_in_field(Field *field, bool no_conversions); -+ int save_safe_in_field(Field *field); -+ bool send(Protocol *protocol, String *str); -+ enum Item_result result_type () const { return STRING_RESULT; } -+ enum_field_types field_type() const { return MYSQL_TYPE_NULL; } -+ /* to prevent drop fixed flag (no need parent cleanup call) */ -+ void cleanup() {} -+ bool basic_const_item() const { return 1; } -+ Item *new_item() { return new Item_null(name); } -+ bool is_null() { return 1; } -+ void print(String *str) { str->append("NULL", 4); } -+ Item *safe_charset_converter(CHARSET_INFO *tocs); -+}; -+ -+class Item_null_result :public Item_null -+{ -+public: -+ Field *result_field; -+ Item_null_result() : Item_null(), result_field(0) {} -+ bool is_result_field() { return result_field != 0; } -+ void save_in_result_field(bool no_conversions) -+ { -+ save_in_field(result_field, no_conversions); -+ } -+}; -+ -+/* Item represents one placeholder ('?') of prepared statement */ -+ -+class Item_param :public Item -+{ -+public: -+ enum enum_item_param_state -+ { -+ NO_VALUE, NULL_VALUE, INT_VALUE, REAL_VALUE, -+ STRING_VALUE, TIME_VALUE, LONG_DATA_VALUE, -+ DECIMAL_VALUE -+ } state; -+ -+ /* -+ A buffer for string and long data values. Historically all allocated -+ values returned from val_str() were treated as eligible to -+ modification. I. e. in some cases Item_func_concat can append it's -+ second argument to return value of the first one. Because of that we -+ can't return the original buffer holding string data from val_str(), -+ and have to have one buffer for data and another just pointing to -+ the data. This is the latter one and it's returned from val_str(). -+ Can not be declared inside the union as it's not a POD type. -+ */ -+ String str_value_ptr; -+ my_decimal decimal_value; -+ union -+ { -+ longlong integer; -+ double real; -+ /* -+ Character sets conversion info for string values. -+ Character sets of client and connection defined at bind time are used -+ for all conversions, even if one of them is later changed (i.e. -+ between subsequent calls to mysql_stmt_execute). -+ */ -+ struct CONVERSION_INFO -+ { -+ CHARSET_INFO *character_set_client; -+ /* -+ This points at character set of connection if conversion -+ to it is required (i. e. if placeholder typecode is not BLOB). -+ Otherwise it's equal to character_set_client (to simplify -+ check in convert_str_value()). -+ */ -+ CHARSET_INFO *final_character_set_of_str_value; -+ } cs_info; -+ TIME time; -+ } value; -+ -+ /* Cached values for virtual methods to save us one switch. */ -+ enum Item_result item_result_type; -+ enum Type item_type; -+ -+ /* -+ Used when this item is used in a temporary table. -+ This is NOT placeholder metadata sent to client, as this value -+ is assigned after sending metadata (in setup_one_conversion_function). -+ For example in case of 'SELECT ?' you'll get MYSQL_TYPE_STRING both -+ in result set and placeholders metadata, no matter what type you will -+ supply for this placeholder in mysql_stmt_execute. -+ */ -+ enum enum_field_types param_type; -+ /* -+ Offset of placeholder inside statement text. Used to create -+ no-placeholders version of this statement for the binary log. -+ */ -+ uint pos_in_query; -+ -+ Item_param(uint pos_in_query_arg); -+ -+ enum Item_result result_type () const { return item_result_type; } -+ enum Type type() const { return item_type; } -+ enum_field_types field_type() const { return param_type; } -+ -+ double val_real(); -+ longlong val_int(); -+ my_decimal *val_decimal(my_decimal*); -+ String *val_str(String*); -+ bool get_time(TIME *tm); -+ bool get_date(TIME *tm, uint fuzzydate); -+ int save_in_field(Field *field, bool no_conversions); -+ bool fix_fields(THD *, struct st_table_list *, Item **); -+ -+ void set_null(); -+ void set_int(longlong i, uint32 max_length_arg); -+ void set_double(double i); -+ void set_decimal(const char *str, ulong length); -+ bool set_str(const char *str, ulong length); -+ bool set_longdata(const char *str, ulong length); -+ void set_time(TIME *tm, timestamp_type type, uint32 max_length_arg); -+ bool set_from_user_var(THD *thd, const user_var_entry *entry); -+ void reset(); -+ /* -+ Assign placeholder value from bind data. -+ Note, that 'len' has different semantics in embedded library (as we -+ don't need to check that packet is not broken there). See -+ sql_prepare.cc for details. -+ */ -+ void (*set_param_func)(Item_param *param, uchar **pos, ulong len); -+ -+ const String *query_val_str(String *str) const; -+ -+ bool convert_str_value(THD *thd); -+ -+ /* -+ If value for parameter was not set we treat it as non-const -+ so noone will use parameters value in fix_fields still -+ parameter is constant during execution. -+ */ -+ virtual table_map used_tables() const -+ { return state != NO_VALUE ? (table_map)0 : PARAM_TABLE_BIT; } -+ void print(String *str); -+ bool is_null() -+ { DBUG_ASSERT(state != NO_VALUE); return state == NULL_VALUE; } -+ bool basic_const_item() const; -+ /* -+ This method is used to make a copy of a basic constant item when -+ propagating constants in the optimizer. The reason to create a new -+ item and not use the existing one is not precisely known (2005/04/16). -+ Probably we are trying to preserve tree structure of items, in other -+ words, avoid pointing at one item from two different nodes of the tree. -+ Return a new basic constant item if parameter value is a basic -+ constant, assert otherwise. This method is called only if -+ basic_const_item returned TRUE. -+ */ -+ Item *new_item(); -+ /* -+ Implement by-value equality evaluation if parameter value -+ is set and is a basic constant (integer, real or string). -+ Otherwise return FALSE. -+ */ -+ bool eq(const Item *item, bool binary_cmp) const; -+}; -+ -+ -+class Item_int :public Item_num -+{ -+public: -+ longlong value; -+ Item_int(int32 i,uint length=11) :value((longlong) i) -+ { max_length=length; fixed= 1; } -+#ifdef HAVE_LONG_LONG -+ Item_int(longlong i,uint length=21) :value(i) -+ { max_length=length; fixed= 1; } -+#endif -+ Item_int(const char *str_arg,longlong i,uint length) :value(i) -+ { max_length=length; name=(char*) str_arg; fixed= 1; } -+ Item_int(const char *str_arg, uint length=64); -+ enum Type type() const { return INT_ITEM; } -+ enum Item_result result_type () const { return INT_RESULT; } -+ enum_field_types field_type() const { return MYSQL_TYPE_LONGLONG; } -+ longlong val_int() { DBUG_ASSERT(fixed == 1); return value; } -+ double val_real() { DBUG_ASSERT(fixed == 1); return (double) value; } -+ my_decimal *val_decimal(my_decimal *); -+ String *val_str(String*); -+ int save_in_field(Field *field, bool no_conversions); -+ bool basic_const_item() const { return 1; } -+ Item *new_item() { return new Item_int(name,value,max_length); } -+ // to prevent drop fixed flag (no need parent cleanup call) -+ void cleanup() {} -+ void print(String *str); -+ Item_num *neg() { value= -value; return this; } -+ uint decimal_precision() const { return (uint)(max_length - test(value < 0)); } -+ bool eq(const Item *, bool binary_cmp) const; -+}; -+ -+ -+class Item_static_int_func :public Item_int -+{ -+ const char *func_name; -+public: -+ Item_static_int_func(const char *str_arg, longlong i, uint length) -+ :Item_int(NullS, i, length), func_name(str_arg) -+ {} -+ void print(String *str) { str->append(func_name); } -+}; -+ -+ -+class Item_uint :public Item_int -+{ -+public: -+ Item_uint(const char *str_arg, uint length); -+ Item_uint(const char *str_arg, longlong i, uint length); -+ Item_uint(uint32 i) :Item_int((longlong) i, 10) -+ { unsigned_flag= 1; } -+ double val_real() -+ { DBUG_ASSERT(fixed == 1); return ulonglong2double((ulonglong)value); } -+ String *val_str(String*); -+ Item *new_item() { return new Item_uint(name,max_length); } -+ int save_in_field(Field *field, bool no_conversions); -+ void print(String *str); -+ Item_num *neg (); -+ uint decimal_precision() const { return max_length; } -+}; -+ -+ -+/* decimal (fixed point) constant */ -+class Item_decimal :public Item_num -+{ -+protected: -+ my_decimal decimal_value; -+public: -+ Item_decimal(const char *str_arg, uint length, CHARSET_INFO *charset); -+ Item_decimal(const char *str, const my_decimal *val_arg, -+ uint decimal_par, uint length); -+ Item_decimal(my_decimal *value_par); -+ Item_decimal(longlong val, bool unsig); -+ Item_decimal(double val, int precision, int scale); -+ Item_decimal(const char *bin, int precision, int scale); -+ -+ enum Type type() const { return DECIMAL_ITEM; } -+ enum Item_result result_type () const { return DECIMAL_RESULT; } -+ enum_field_types field_type() const { return MYSQL_TYPE_NEWDECIMAL; } -+ longlong val_int(); -+ double val_real(); -+ String *val_str(String*); -+ my_decimal *val_decimal(my_decimal *val) { return &decimal_value; } -+ int save_in_field(Field *field, bool no_conversions); -+ bool basic_const_item() const { return 1; } -+ Item *new_item() -+ { -+ return new Item_decimal(name, &decimal_value, decimals, max_length); -+ } -+ // to prevent drop fixed flag (no need parent cleanup call) -+ void cleanup() {} -+ void print(String *str); -+ Item_num *neg() -+ { -+ my_decimal_neg(&decimal_value); -+ unsigned_flag= !decimal_value.sign(); -+ return this; -+ } -+ uint decimal_precision() const { return decimal_value.precision(); } -+ bool eq(const Item *, bool binary_cmp) const; -+}; -+ -+ -+class Item_float :public Item_num -+{ -+ char *presentation; -+public: -+ double value; -+ // Item_real() :value(0) {} -+ Item_float(const char *str_arg, uint length); -+ Item_float(const char *str,double val_arg,uint decimal_par,uint length) -+ :value(val_arg) -+ { -+ presentation= name=(char*) str; -+ decimals=(uint8) decimal_par; -+ max_length=length; -+ fixed= 1; -+ } -+ Item_float(double value_par) :presentation(0), value(value_par) { fixed= 1; } -+ -+ int save_in_field(Field *field, bool no_conversions); -+ enum Type type() const { return REAL_ITEM; } -+ enum_field_types field_type() const { return MYSQL_TYPE_DOUBLE; } -+ double val_real() { DBUG_ASSERT(fixed == 1); return value; } -+ longlong val_int() -+ { -+ DBUG_ASSERT(fixed == 1); -+ return (longlong) (value+(value > 0 ? 0.5 : -0.5)); -+ } -+ String *val_str(String*); -+ my_decimal *val_decimal(my_decimal *); -+ bool basic_const_item() const { return 1; } -+ // to prevent drop fixed flag (no need parent cleanup call) -+ void cleanup() {} -+ Item *new_item() -+ { return new Item_float(name, value, decimals, max_length); } -+ Item_num *neg() { value= -value; return this; } -+ void print(String *str); -+ bool eq(const Item *, bool binary_cmp) const; -+}; -+ -+ -+class Item_static_float_func :public Item_float -+{ -+ const char *func_name; -+public: -+ Item_static_float_func(const char *str, double val_arg, uint decimal_par, -+ uint length) -+ :Item_float(NullS, val_arg, decimal_par, length), func_name(str) -+ {} -+ void print(String *str) { str->append(func_name); } -+}; -+ -+ -+class Item_string :public Item -+{ -+public: -+ Item_string(const char *str,uint length, -+ CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE) -+ { -+ collation.set(cs, dv); -+ str_value.set_or_copy_aligned(str,length,cs); -+ /* -+ We have to have a different max_length than 'length' here to -+ ensure that we get the right length if we do use the item -+ to create a new table. In this case max_length must be the maximum -+ number of chars for a string of this type because we in create_field:: -+ divide the max_length with mbmaxlen). -+ */ -+ max_length= str_value.numchars()*cs->mbmaxlen; -+ set_name(str, length, cs); -+ decimals=NOT_FIXED_DEC; -+ // it is constant => can be used without fix_fields (and frequently used) -+ fixed= 1; -+ } -+ Item_string(const char *name_par, const char *str, uint length, -+ CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE) -+ { -+ collation.set(cs, dv); -+ str_value.set_or_copy_aligned(str,length,cs); -+ max_length= str_value.numchars()*cs->mbmaxlen; -+ set_name(name_par,0,cs); -+ decimals=NOT_FIXED_DEC; -+ // it is constant => can be used without fix_fields (and frequently used) -+ fixed= 1; -+ } -+ enum Type type() const { return STRING_ITEM; } -+ double val_real(); -+ longlong val_int(); -+ String *val_str(String*) -+ { -+ DBUG_ASSERT(fixed == 1); -+ return (String*) &str_value; -+ } -+ my_decimal *val_decimal(my_decimal *); -+ int save_in_field(Field *field, bool no_conversions); -+ enum Item_result result_type () const { return STRING_RESULT; } -+ enum_field_types field_type() const { return MYSQL_TYPE_VARCHAR; } -+ bool basic_const_item() const { return 1; } -+ bool eq(const Item *item, bool binary_cmp) const; -+ Item *new_item() -+ { -+ return new Item_string(name, str_value.ptr(), -+ str_value.length(), collation.collation); -+ } -+ Item *safe_charset_converter(CHARSET_INFO *tocs); -+ String *const_string() { return &str_value; } -+ inline void append(char *str, uint length) { str_value.append(str, length); } -+ void print(String *str); -+ // to prevent drop fixed flag (no need parent cleanup call) -+ void cleanup() {} -+}; -+ -+ -+class Item_static_string_func :public Item_string -+{ -+ const char *func_name; -+public: -+ Item_static_string_func(const char *name_par, const char *str, uint length, -+ CHARSET_INFO *cs, -+ Derivation dv= DERIVATION_COERCIBLE) -+ :Item_string(NullS, str, length, cs, dv), func_name(name_par) -+ {} -+ void print(String *str) { str->append(func_name); } -+}; -+ -+ -+/* for show tables */ -+ -+class Item_datetime :public Item_string -+{ -+public: -+ Item_datetime(const char *item_name): Item_string(item_name,"",0, -+ &my_charset_bin) -+ { max_length=19;} -+ enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; } -+}; -+ -+class Item_empty_string :public Item_string -+{ -+public: -+ Item_empty_string(const char *header,uint length, CHARSET_INFO *cs= NULL) : -+ Item_string("",0, cs ? cs : &my_charset_bin) -+ { name=(char*) header; max_length= cs ? length * cs->mbmaxlen : length; } -+ void make_field(Send_field *field); -+}; -+ -+class Item_return_int :public Item_int -+{ -+ enum_field_types int_field_type; -+public: -+ Item_return_int(const char *name, uint length, -+ enum_field_types field_type_arg) -+ :Item_int(name, 0, length), int_field_type(field_type_arg) -+ { -+ unsigned_flag=1; -+ } -+ enum_field_types field_type() const { return int_field_type; } -+}; -+ -+ -+class Item_hex_string: public Item -+{ -+public: -+ Item_hex_string(): Item() {} -+ Item_hex_string(const char *str,uint str_length); -+ enum Type type() const { return VARBIN_ITEM; } -+ double val_real() -+ { DBUG_ASSERT(fixed == 1); return (double) Item_hex_string::val_int(); } -+ longlong val_int(); -+ bool basic_const_item() const { return 1; } -+ String *val_str(String*) { DBUG_ASSERT(fixed == 1); return &str_value; } -+ my_decimal *val_decimal(my_decimal *); -+ int save_in_field(Field *field, bool no_conversions); -+ enum Item_result result_type () const { return STRING_RESULT; } -+ enum_field_types field_type() const { return MYSQL_TYPE_VARCHAR; } -+ // to prevent drop fixed flag (no need parent cleanup call) -+ void cleanup() {} -+ bool eq(const Item *item, bool binary_cmp) const; -+}; -+ -+ -+class Item_bin_string: public Item_hex_string -+{ -+public: -+ Item_bin_string(const char *str,uint str_length); -+}; -+ -+class Item_result_field :public Item /* Item with result field */ -+{ -+public: -+ Field *result_field; /* Save result here */ -+ Item_result_field() :result_field(0) {} -+ // Constructor used for Item_sum/Item_cond_and/or (see Item comment) -+ Item_result_field(THD *thd, Item_result_field *item): -+ Item(thd, item), result_field(item->result_field) -+ {} -+ ~Item_result_field() {} /* Required with gcc 2.95 */ -+ Field *get_tmp_table_field() { return result_field; } -+ Field *tmp_table_field(TABLE *t_arg) { return result_field; } -+ table_map used_tables() const { return 1; } -+ virtual void fix_length_and_dec()=0; -+ void set_result_field(Field *field) { result_field= field; } -+ bool is_result_field() { return 1; } -+ void save_in_result_field(bool no_conversions) -+ { -+ save_in_field(result_field, no_conversions); -+ } -+ void cleanup(); -+}; -+ -+ -+class Item_ref :public Item_ident -+{ -+protected: -+ void set_properties(); -+public: -+ Field *result_field; /* Save result here */ -+ Item **ref; -+ Item_ref(const char *db_par, const char *table_name_par, -+ const char *field_name_par) -+ :Item_ident(db_par, table_name_par, field_name_par), result_field(0), ref(0) {} -+ /* -+ This constructor is used in two scenarios: -+ A) *item = NULL -+ No initialization is performed, fix_fields() call will be necessary. -+ -+ B) *item points to an Item this Item_ref will refer to. This is -+ used for GROUP BY. fix_fields() will not be called in this case, -+ so we call set_properties to make this item "fixed". set_properties -+ performs a subset of action Item_ref::fix_fields does, and this subset -+ is enough for Item_ref's used in GROUP BY. -+ -+ TODO we probably fix a superset of problems like in BUG#6658. Check this -+ with Bar, and if we have a more broader set of problems like this. -+ */ -+ Item_ref(Item **item, const char *table_name_par, const char *field_name_par); -+ -+ /* Constructor need to process subselect with temporary tables (see Item) */ -+ Item_ref(THD *thd, Item_ref *item) :Item_ident(thd, item), result_field(item->result_field), ref(item->ref) {} -+ enum Type type() const { return REF_ITEM; } -+ bool eq(const Item *item, bool binary_cmp) const -+ { return ref && (*ref)->eq(item, binary_cmp); } -+ double val_real(); -+ longlong val_int(); -+ my_decimal *val_decimal(my_decimal *); -+ bool val_bool(); -+ String *val_str(String* tmp); -+ bool is_null(); -+ bool get_date(TIME *ltime,uint fuzzydate); -+ double val_result(); -+ longlong val_int_result(); -+ String *str_result(String* tmp); -+ my_decimal *val_decimal_result(my_decimal *); -+ bool val_bool_result(); -+ bool send(Protocol *prot, String *tmp); -+ void make_field(Send_field *field) { (*ref)->make_field(field); } -+ bool fix_fields(THD *, struct st_table_list *, Item **); -+ int save_in_field(Field *field, bool no_conversions) -+ { return (*ref)->save_in_field(field, no_conversions); } -+ void save_org_in_field(Field *field) { (*ref)->save_org_in_field(field); } -+ enum Item_result result_type () const { return (*ref)->result_type(); } -+ enum_field_types field_type() const { return (*ref)->field_type(); } -+ Field *get_tmp_table_field() { return result_field; } -+ table_map used_tables() const -+ { -+ return depended_from ? OUTER_REF_TABLE_BIT : (*ref)->used_tables(); -+ } -+ void set_result_field(Field *field) { result_field= field; } -+ bool is_result_field() { return 1; } -+ void save_in_result_field(bool no_conversions) -+ { -+ (*ref)->save_in_field(result_field, no_conversions); -+ } -+ Item *real_item() { return *ref; } -+ bool walk(Item_processor processor, byte *arg) -+ { return (*ref)->walk(processor, arg); } -+ void print(String *str); -+ void cleanup(); -+}; -+ -+ -+/* -+ The same as Item_ref, but get value from val_* family of method to get -+ value of item on which it referred instead of result* family. -+*/ -+class Item_direct_ref :public Item_ref -+{ -+public: -+ Item_direct_ref(Item **item, const char *table_name_par, -+ const char *field_name_par) -+ :Item_ref(item, table_name_par, field_name_par) {} -+ /* Constructor need to process subselect with temporary tables (see Item) */ -+ Item_direct_ref(THD *thd, Item_direct_ref *item) : Item_ref(thd, item) {} -+ -+ double val_real(); -+ longlong val_int(); -+ String *val_str(String* tmp); -+ my_decimal *val_decimal(my_decimal *); -+ bool val_bool(); -+ bool is_null(); -+ bool get_date(TIME *ltime,uint fuzzydate); -+}; -+ -+ -+class Item_in_subselect; -+ -+class Item_ref_null_helper: public Item_ref -+{ -+protected: -+ Item_in_subselect* owner; -+public: -+ Item_ref_null_helper(Item_in_subselect* master, Item **item, -+ const char *table_name_par, const char *field_name_par): -+ Item_ref(item, table_name_par, field_name_par), owner(master) {} -+ double val_real(); -+ longlong val_int(); -+ String* val_str(String* s); -+ my_decimal *val_decimal(my_decimal *); -+ bool val_bool(); -+ bool get_date(TIME *ltime, uint fuzzydate); -+ void print(String *str); -+}; -+ -+class Item_null_helper :public Item_ref_null_helper -+{ -+ Item *store; -+public: -+ Item_null_helper(Item_in_subselect* master, Item *item, -+ const char *table_name_par, const char *field_name_par) -+ :Item_ref_null_helper(master, (store= 0, &store), table_name_par, -+ field_name_par), -+ store(item) -+ { ref= &store; } -+ void print(String *str); -+}; -+ -+/* -+ The following class is used to optimize comparing of date and bigint columns -+ We need to save the original item, to be able to set the field to the -+ original value in 'opt_range'. -+ An instance of Item_int_with_ref may refer to a signed or an unsigned -+ integer. -+*/ -+ -+class Item_int_with_ref :public Item_int -+{ -+ Item *ref; -+public: -+ Item_int_with_ref(longlong i, Item *ref_arg) :Item_int(i), ref(ref_arg) -+ { -+ unsigned_flag= ref_arg->unsigned_flag; -+ } -+ int save_in_field(Field *field, bool no_conversions) -+ { -+ return ref->save_in_field(field, no_conversions); -+ } -+ Item *new_item(); -+}; -+ -+ -+#include "gstream.h" -+#include "spatial.h" -+#include "item_sum.h" -+#include "item_func.h" -+#include "item_row.h" -+#include "item_cmpfunc.h" -+#include "item_strfunc.h" -+#include "item_geofunc.h" -+#include "item_timefunc.h" -+#include "item_uniq.h" -+#include "item_subselect.h" -+ -+class Item_copy_string :public Item -+{ -+ enum enum_field_types cached_field_type; -+public: -+ Item *item; -+ Item_copy_string(Item *i) :item(i) -+ { -+ null_value=maybe_null=item->maybe_null; -+ decimals=item->decimals; -+ max_length=item->max_length; -+ name=item->name; -+ cached_field_type= item->field_type(); -+ } -+ enum Type type() const { return COPY_STR_ITEM; } -+ enum Item_result result_type () const { return STRING_RESULT; } -+ enum_field_types field_type() const { return cached_field_type; } -+ double val_real() -+ { -+ int err_not_used; -+ char *end_not_used; -+ return (null_value ? 0.0 : -+ my_strntod(str_value.charset(), (char*) str_value.ptr(), -+ str_value.length(), &end_not_used, &err_not_used)); -+ } -+ longlong val_int() -+ { -+ int err; -+ return null_value ? LL(0) : my_strntoll(str_value.charset(),str_value.ptr(),str_value.length(),10, (char**) 0,&err); -+ } -+ String *val_str(String*); -+ my_decimal *val_decimal(my_decimal *); -+ void make_field(Send_field *field) { item->make_field(field); } -+ void copy(); -+ int save_in_field(Field *field, bool no_conversions); -+ table_map used_tables() const { return (table_map) 1L; } -+ bool const_item() const { return 0; } -+ bool is_null() { return null_value; } -+}; -+ -+ -+class Item_buff :public Sql_alloc -+{ -+public: -+ my_bool null_value; -+ Item_buff() :null_value(0) {} -+ virtual bool cmp(void)=0; -+ virtual ~Item_buff(); /*line -e1509 */ -+}; -+ -+class Item_str_buff :public Item_buff -+{ -+ Item *item; -+ String value,tmp_value; -+public: -+ Item_str_buff(Item *arg) :item(arg),value(arg->max_length) {} -+ bool cmp(void); -+ ~Item_str_buff(); // Deallocate String:s -+}; -+ -+ -+class Item_real_buff :public Item_buff -+{ -+ Item *item; -+ double value; -+public: -+ Item_real_buff(Item *item_par) :item(item_par),value(0.0) {} -+ bool cmp(void); -+}; -+ -+class Item_int_buff :public Item_buff -+{ -+ Item *item; -+ longlong value; -+public: -+ Item_int_buff(Item *item_par) :item(item_par),value(0) {} -+ bool cmp(void); -+}; -+ -+ -+class Item_decimal_buff :public Item_buff -+{ -+ Item *item; -+ my_decimal value; -+public: -+ Item_decimal_buff(Item *item_par); -+ bool cmp(void); -+}; -+ -+class Item_field_buff :public Item_buff -+{ -+ char *buff; -+ Field *field; -+ uint length; -+ -+public: -+ Item_field_buff(Item_field *item) -+ { -+ field=item->field; -+ buff= (char*) sql_calloc(length=field->pack_length()); -+ } -+ bool cmp(void); -+}; -+ -+class Item_default_value : public Item_field -+{ -+public: -+ Item *arg; -+ Item_default_value() : -+ Item_field((const char *)NULL, (const char *)NULL, (const char *)NULL), arg(NULL) {} -+ Item_default_value(Item *a) : -+ Item_field((const char *)NULL, (const char *)NULL, (const char *)NULL), arg(a) {} -+ enum Type type() const { return DEFAULT_VALUE_ITEM; } -+ bool eq(const Item *item, bool binary_cmp) const; -+ bool fix_fields(THD *, struct st_table_list *, Item **); -+ void print(String *str); -+ int save_in_field(Field *field_arg, bool no_conversions); -+ table_map used_tables() const { return (table_map)0L; } -+ -+ bool walk(Item_processor processor, byte *args) -+ { -+ return arg->walk(processor, args) || -+ (this->*processor)(args); -+ } -+ -+ /* -+ This method like the walk method traverses the item tree, but -+ at the same time it can replace some nodes in the tree -+ */ -+ Item *transform(Item_transformer transformer, byte *args) -+ { -+ Item *new_item= arg->transform(transformer, args); -+ if (!new_item) -+ return 0; -+ arg= new_item; -+ return (this->*transformer)(args); -+ } -+}; -+ -+class Item_insert_value : public Item_field -+{ -+public: -+ Item *arg; -+ Item_insert_value(Item *a) : -+ Item_field((const char *)NULL, (const char *)NULL, (const char *)NULL), arg(a) {} -+ bool eq(const Item *item, bool binary_cmp) const; -+ bool fix_fields(THD *, struct st_table_list *, Item **); -+ void print(String *str); -+ int save_in_field(Field *field_arg, bool no_conversions) -+ { -+ return Item_field::save_in_field(field_arg, no_conversions); -+ } -+ table_map used_tables() const { return (table_map)0L; } -+ -+ bool walk(Item_processor processor, byte *args) -+ { -+ return arg->walk(processor, args) || -+ (this->*processor)(args); -+ } -+}; -+ -+ -+/* -+ We need this two enums here instead of sql_lex.h because -+ at least one of them is used by Item_trigger_field interface. -+ -+ Time when trigger is invoked (i.e. before or after row actually -+ inserted/updated/deleted). -+*/ -+enum trg_action_time_type -+{ -+ TRG_ACTION_BEFORE= 0, TRG_ACTION_AFTER= 1 -+}; -+ -+/* -+ Event on which trigger is invoked. -+*/ -+enum trg_event_type -+{ -+ TRG_EVENT_INSERT= 0 , TRG_EVENT_UPDATE= 1, TRG_EVENT_DELETE= 2 -+}; -+ -+/* -+ Represents NEW/OLD version of field of row which is -+ changed/read in trigger. -+ -+ Note: For this item actual binding to Field object happens not during -+ fix_fields() (like for Item_field) but during parsing of trigger -+ definition, when table is opened, with special setup_field() call. -+*/ -+class Item_trigger_field : public Item_field -+{ -+public: -+ /* Is this item represents row from NEW or OLD row ? */ -+ enum row_version_type {OLD_ROW, NEW_ROW}; -+ row_version_type row_version; -+ /* Next in list of all Item_trigger_field's in trigger */ -+ Item_trigger_field *next_trg_field; -+ -+ Item_trigger_field(row_version_type row_ver_par, -+ const char *field_name_par): -+ Item_field((const char *)NULL, (const char *)NULL, field_name_par), -+ row_version(row_ver_par) -+ {} -+ void setup_field(THD *thd, TABLE *table, enum trg_event_type event); -+ enum Type type() const { return TRIGGER_FIELD_ITEM; } -+ bool eq(const Item *item, bool binary_cmp) const; -+ bool fix_fields(THD *, struct st_table_list *, Item **); -+ void print(String *str); -+ table_map used_tables() const { return (table_map)0L; } -+ void cleanup(); -+}; -+ -+ -+class Item_cache: public Item -+{ -+protected: -+ Item *example; -+ table_map used_table_map; -+public: -+ Item_cache(): example(0), used_table_map(0) {fixed= 1; null_value= 1;} -+ -+ void set_used_tables(table_map map) { used_table_map= map; } -+ -+ virtual bool allocate(uint i) { return 0; } -+ virtual bool setup(Item *item) -+ { -+ example= item; -+ max_length= item->max_length; -+ decimals= item->decimals; -+ collation.set(item->collation); -+ return 0; -+ }; -+ virtual void store(Item *)= 0; -+ enum Type type() const { return CACHE_ITEM; } -+ static Item_cache* get_cache(Item_result type); -+ table_map used_tables() const { return used_table_map; } -+ virtual void keep_array() {} -+ // to prevent drop fixed flag (no need parent cleanup call) -+ void cleanup() {} -+ void print(String *str); -+}; -+ -+ -+class Item_cache_int: public Item_cache -+{ -+protected: -+ longlong value; -+public: -+ Item_cache_int(): Item_cache(), value(0) {} -+ -+ void store(Item *item); -+ double val_real() { DBUG_ASSERT(fixed == 1); return (double) value; } -+ longlong val_int() { DBUG_ASSERT(fixed == 1); return value; } -+ String* val_str(String *str); -+ my_decimal *val_decimal(my_decimal *); -+ enum Item_result result_type() const { return INT_RESULT; } -+}; -+ -+ -+class Item_cache_real: public Item_cache -+{ -+ double value; -+public: -+ Item_cache_real(): Item_cache(), value(0) {} -+ -+ void store(Item *item); -+ double val_real() { DBUG_ASSERT(fixed == 1); return value; } -+ longlong val_int(); -+ String* val_str(String *str); -+ my_decimal *val_decimal(my_decimal *); -+ enum Item_result result_type() const { return REAL_RESULT; } -+}; -+ -+ -+class Item_cache_decimal: public Item_cache -+{ -+protected: -+ my_decimal decimal_value; -+public: -+ Item_cache_decimal(): Item_cache() {} -+ -+ void store(Item *item); -+ double val_real(); -+ longlong val_int(); -+ String* val_str(String *str); -+ my_decimal *val_decimal(my_decimal *); -+ enum Item_result result_type() const { return DECIMAL_RESULT; } -+}; -+ -+ -+class Item_cache_str: public Item_cache -+{ -+ char buffer[STRING_BUFFER_USUAL_SIZE]; -+ String *value, value_buff; -+public: -+ Item_cache_str(): Item_cache(), value(0) { } -+ -+ void store(Item *item); -+ double val_real(); -+ longlong val_int(); -+ String* val_str(String *) { DBUG_ASSERT(fixed == 1); return value; } -+ my_decimal *val_decimal(my_decimal *); -+ enum Item_result result_type() const { return STRING_RESULT; } -+ CHARSET_INFO *charset() const { return value->charset(); }; -+}; -+ -+class Item_cache_row: public Item_cache -+{ -+ Item_cache **values; -+ uint item_count; -+ bool save_array; -+public: -+ Item_cache_row() -+ :Item_cache(), values(0), item_count(2), save_array(0) {} -+ -+ /* -+ 'allocate' used only in row transformer, to preallocate space for row -+ cache. -+ */ -+ bool allocate(uint num); -+ /* -+ 'setup' is needed only by row => it not called by simple row subselect -+ (only by IN subselect (in subselect optimizer)) -+ */ -+ bool setup(Item *item); -+ void store(Item *item); -+ void illegal_method_call(const char *); -+ void make_field(Send_field *) -+ { -+ illegal_method_call((const char*)"make_field"); -+ }; -+ double val_real() -+ { -+ illegal_method_call((const char*)"val"); -+ return 0; -+ }; -+ longlong val_int() -+ { -+ illegal_method_call((const char*)"val_int"); -+ return 0; -+ }; -+ String *val_str(String *) -+ { -+ illegal_method_call((const char*)"val_str"); -+ return 0; -+ }; -+ my_decimal *val_decimal(my_decimal *val) -+ { -+ illegal_method_call((const char*)"val_decimal"); -+ return 0; -+ }; -+ -+ enum Item_result result_type() const { return ROW_RESULT; } -+ -+ uint cols() { return item_count; } -+ Item* el(uint i) { return values[i]; } -+ Item** addr(uint i) { return (Item **) (values + i); } -+ bool check_cols(uint c); -+ bool null_inside(); -+ void bring_value(); -+ void keep_array() { save_array= 1; } -+ void cleanup() -+ { -+ DBUG_ENTER("Item_cache_row::cleanup"); -+ Item_cache::cleanup(); -+ if (save_array) -+ bzero(values, item_count*sizeof(Item**)); -+ else -+ values= 0; -+ DBUG_VOID_RETURN; -+ } -+}; -+ -+ -+/* -+ Item_type_holder used to store type. name, length of Item for UNIONS & -+ derived tables. -+ -+ Item_type_holder do not need cleanup() because its time of live limited by -+ single SP/PS execution. -+*/ -+class Item_type_holder: public Item -+{ -+protected: -+ TYPELIB *enum_set_typelib; -+ enum_field_types fld_type; -+ -+ void get_full_info(Item *item); -+ -+ /* It is used to count decimal precision in join_types */ -+ int prev_decimal_int_part; -+public: -+ Item_type_holder(THD*, Item*); -+ -+ Item_result result_type() const; -+ virtual enum_field_types field_type() const { return fld_type; }; -+ enum Type type() const { return TYPE_HOLDER; } -+ double val_real(); -+ longlong val_int(); -+ my_decimal *val_decimal(my_decimal *); -+ String *val_str(String*); -+ bool join_types(THD *thd, Item *); -+ Field *make_field_by_type(TABLE *table); -+ static uint32 display_length(Item *item); -+ static enum_field_types get_real_type(Item *); -+}; -+ -+class st_select_lex; -+void mark_select_range_as_dependent(THD *thd, -+ st_select_lex *last_select, -+ st_select_lex *current_sel, -+ Field *found_field, Item *found_item, -+ Item_ident *resolved_item); -+ -+extern Item_buff *new_Item_buff(Item *item); -+extern Item_result item_cmp_type(Item_result a,Item_result b); -+extern void resolve_const_item(THD *thd, Item **ref, Item *cmp_item); -+extern bool field_is_equal_to_item(Field *field,Item *item); -diff -Naur mysql.orig/sql/item_create.cc mysql.xml/sql/item_create.cc ---- mysql.orig/sql/item_create.cc 2005-05-15 06:16:52.000000000 +0200 -+++ mysql.xml/sql/item_create.cc 2005-05-20 15:19:29.000000000 +0200 -@@ -496,6 +496,16 @@ - return new Item_func_quote(a); - } - -+Item *create_func_xml_extractvalue(Item *a, Item *b) -+{ -+ return new Item_func_xml_extractvalue(a, b); -+} -+ -+Item *create_func_xml_update(Item *a, Item *b, Item *c) -+{ -+ return new Item_func_xml_update(a, b, c); -+} -+ - #ifdef HAVE_SPATIAL - Item *create_func_as_wkt(Item *a) - { -diff -Naur mysql.orig/sql/item_create.cc.orig mysql.xml/sql/item_create.cc.orig ---- mysql.orig/sql/item_create.cc.orig 1970-01-01 01:00:00.000000000 +0100 -+++ mysql.xml/sql/item_create.cc.orig 2005-05-15 06:16:52.000000000 +0200 -@@ -0,0 +1,725 @@ -+/* Copyright (C) 2000-2003 MySQL AB -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 2 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the Free Software -+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -+ -+/* Functions to create an item. Used by lex.h */ -+ -+#include "mysql_priv.h" -+ -+Item *create_func_abs(Item* a) -+{ -+ return new Item_func_abs(a); -+} -+ -+Item *create_func_acos(Item* a) -+{ -+ return new Item_func_acos(a); -+} -+ -+Item *create_func_aes_encrypt(Item* a, Item* b) -+{ -+ return new Item_func_aes_encrypt(a, b); -+} -+ -+Item *create_func_aes_decrypt(Item* a, Item* b) -+{ -+ return new Item_func_aes_decrypt(a, b); -+} -+ -+Item *create_func_ascii(Item* a) -+{ -+ return new Item_func_ascii(a); -+} -+ -+Item *create_func_ord(Item* a) -+{ -+ return new Item_func_ord(a); -+} -+ -+Item *create_func_asin(Item* a) -+{ -+ return new Item_func_asin(a); -+} -+ -+Item *create_func_bin(Item* a) -+{ -+ return new Item_func_conv(a,new Item_int((int32) 10,2), -+ new Item_int((int32) 2,1)); -+} -+ -+Item *create_func_bit_count(Item* a) -+{ -+ return new Item_func_bit_count(a); -+} -+ -+Item *create_func_ceiling(Item* a) -+{ -+ return new Item_func_ceiling(a); -+} -+ -+Item *create_func_connection_id(void) -+{ -+ THD *thd=current_thd; -+ thd->lex->safe_to_cache_query= 0; -+ return new Item_static_int_func("connection_id()", -+ (longlong) -+ ((thd->slave_thread) ? -+ thd->variables.pseudo_thread_id : -+ thd->thread_id), -+ 10); -+} -+ -+Item *create_func_conv(Item* a, Item *b, Item *c) -+{ -+ return new Item_func_conv(a,b,c); -+} -+ -+Item *create_func_cos(Item* a) -+{ -+ return new Item_func_cos(a); -+} -+ -+Item *create_func_cot(Item* a) -+{ -+ return new Item_func_div(new Item_int((char*) "1",1,1), -+ new Item_func_tan(a)); -+} -+ -+Item *create_func_date_format(Item* a,Item *b) -+{ -+ return new Item_func_date_format(a,b,0); -+} -+ -+Item *create_func_dayofmonth(Item* a) -+{ -+ return new Item_func_dayofmonth(a); -+} -+ -+Item *create_func_dayofweek(Item* a) -+{ -+ return new Item_func_weekday(new Item_func_to_days(a),1); -+} -+ -+Item *create_func_dayofyear(Item* a) -+{ -+ return new Item_func_dayofyear(a); -+} -+ -+Item *create_func_dayname(Item* a) -+{ -+ return new Item_func_dayname(new Item_func_to_days(a)); -+} -+ -+Item *create_func_degrees(Item *a) -+{ -+ return new Item_func_units((char*) "degrees",a,180/M_PI,0.0); -+} -+ -+Item *create_func_exp(Item* a) -+{ -+ return new Item_func_exp(a); -+} -+ -+Item *create_func_find_in_set(Item* a, Item *b) -+{ -+ return new Item_func_find_in_set(a, b); -+} -+ -+Item *create_func_floor(Item* a) -+{ -+ return new Item_func_floor(a); -+} -+ -+Item *create_func_found_rows(void) -+{ -+ THD *thd=current_thd; -+ thd->lex->safe_to_cache_query= 0; -+ return new Item_func_found_rows(); -+} -+ -+Item *create_func_from_days(Item* a) -+{ -+ return new Item_func_from_days(a); -+} -+ -+Item *create_func_get_lock(Item* a, Item *b) -+{ -+ current_thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT); -+ return new Item_func_get_lock(a, b); -+} -+ -+Item *create_func_hex(Item *a) -+{ -+ return new Item_func_hex(a); -+} -+ -+Item *create_func_inet_ntoa(Item* a) -+{ -+ return new Item_func_inet_ntoa(a); -+} -+ -+Item *create_func_inet_aton(Item* a) -+{ -+ return new Item_func_inet_aton(a); -+} -+ -+ -+Item *create_func_ifnull(Item* a, Item *b) -+{ -+ return new Item_func_ifnull(a,b); -+} -+ -+Item *create_func_nullif(Item* a, Item *b) -+{ -+ return new Item_func_nullif(a,b); -+} -+ -+Item *create_func_locate(Item* a, Item *b) -+{ -+ return new Item_func_locate(b,a); -+} -+ -+Item *create_func_instr(Item* a, Item *b) -+{ -+ return new Item_func_locate(a,b); -+} -+ -+Item *create_func_isnull(Item* a) -+{ -+ return new Item_func_isnull(a); -+} -+ -+Item *create_func_lcase(Item* a) -+{ -+ return new Item_func_lcase(a); -+} -+ -+Item *create_func_length(Item* a) -+{ -+ return new Item_func_length(a); -+} -+ -+Item *create_func_bit_length(Item* a) -+{ -+ return new Item_func_bit_length(a); -+} -+ -+Item *create_func_coercibility(Item* a) -+{ -+ return new Item_func_coercibility(a); -+} -+ -+Item *create_func_char_length(Item* a) -+{ -+ return new Item_func_char_length(a); -+} -+ -+Item *create_func_ln(Item* a) -+{ -+ return new Item_func_ln(a); -+} -+ -+Item *create_func_log2(Item* a) -+{ -+ return new Item_func_log2(a); -+} -+ -+Item *create_func_log10(Item* a) -+{ -+ return new Item_func_log10(a); -+} -+ -+Item *create_func_lpad(Item* a, Item *b, Item *c) -+{ -+ return new Item_func_lpad(a,b,c); -+} -+ -+Item *create_func_ltrim(Item* a) -+{ -+ return new Item_func_ltrim(a); -+} -+ -+Item *create_func_md5(Item* a) -+{ -+ return new Item_func_md5(a); -+} -+ -+Item *create_func_mod(Item* a, Item *b) -+{ -+ return new Item_func_mod(a,b); -+} -+ -+Item *create_func_monthname(Item* a) -+{ -+ return new Item_func_monthname(a); -+} -+ -+Item *create_func_month(Item* a) -+{ -+ return new Item_func_month(a); -+} -+ -+Item *create_func_oct(Item *a) -+{ -+ return new Item_func_conv(a,new Item_int((int32) 10,2), -+ new Item_int((int32) 8,1)); -+} -+ -+Item *create_func_period_add(Item* a, Item *b) -+{ -+ return new Item_func_period_add(a,b); -+} -+ -+Item *create_func_period_diff(Item* a, Item *b) -+{ -+ return new Item_func_period_diff(a,b); -+} -+ -+Item *create_func_pi(void) -+{ -+ return new Item_static_float_func("pi()", M_PI, 6, 8); -+} -+ -+Item *create_func_pow(Item* a, Item *b) -+{ -+ return new Item_func_pow(a,b); -+} -+ -+Item *create_func_current_user() -+{ -+ THD *thd=current_thd; -+ char buff[HOSTNAME_LENGTH+USERNAME_LENGTH+2]; -+ uint length; -+ -+ thd->lex->safe_to_cache_query= 0; -+ length= (uint) (strxmov(buff, thd->priv_user, "@", thd->priv_host, NullS) - -+ buff); -+ return new Item_static_string_func("current_user()", -+ thd->memdup(buff, length), length, -+ system_charset_info); -+} -+ -+Item *create_func_radians(Item *a) -+{ -+ return new Item_func_units((char*) "radians",a,M_PI/180,0.0); -+} -+ -+Item *create_func_release_lock(Item* a) -+{ -+ current_thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT); -+ return new Item_func_release_lock(a); -+} -+ -+Item *create_func_repeat(Item* a, Item *b) -+{ -+ return new Item_func_repeat(a,b); -+} -+ -+Item *create_func_reverse(Item* a) -+{ -+ return new Item_func_reverse(a); -+} -+ -+Item *create_func_rpad(Item* a, Item *b, Item *c) -+{ -+ return new Item_func_rpad(a,b,c); -+} -+ -+Item *create_func_rtrim(Item* a) -+{ -+ return new Item_func_rtrim(a); -+} -+ -+Item *create_func_sec_to_time(Item* a) -+{ -+ return new Item_func_sec_to_time(a); -+} -+ -+Item *create_func_sign(Item* a) -+{ -+ return new Item_func_sign(a); -+} -+ -+Item *create_func_sin(Item* a) -+{ -+ return new Item_func_sin(a); -+} -+ -+Item *create_func_sha(Item* a) -+{ -+ return new Item_func_sha(a); -+} -+ -+Item *create_func_space(Item *a) -+{ -+ CHARSET_INFO *cs= current_thd->variables.collation_connection; -+ Item *sp; -+ -+ if (cs->mbminlen > 1) -+ { -+ uint dummy_errors; -+ sp= new Item_string("",0,cs); -+ if (sp) -+ sp->str_value.copy(" ", 1, &my_charset_latin1, cs, &dummy_errors); -+ } -+ else -+ { -+ sp= new Item_string(" ",1,cs); -+ } -+ return sp ? new Item_func_repeat(sp, a) : 0; -+} -+ -+Item *create_func_soundex(Item* a) -+{ -+ return new Item_func_soundex(a); -+} -+ -+Item *create_func_sqrt(Item* a) -+{ -+ return new Item_func_sqrt(a); -+} -+ -+Item *create_func_strcmp(Item* a, Item *b) -+{ -+ return new Item_func_strcmp(a,b); -+} -+ -+Item *create_func_tan(Item* a) -+{ -+ return new Item_func_tan(a); -+} -+ -+Item *create_func_time_format(Item *a, Item *b) -+{ -+ return new Item_func_date_format(a,b,1); -+} -+ -+Item *create_func_time_to_sec(Item* a) -+{ -+ return new Item_func_time_to_sec(a); -+} -+ -+Item *create_func_to_days(Item* a) -+{ -+ return new Item_func_to_days(a); -+} -+ -+Item *create_func_ucase(Item* a) -+{ -+ return new Item_func_ucase(a); -+} -+ -+Item *create_func_unhex(Item* a) -+{ -+ return new Item_func_unhex(a); -+} -+ -+Item *create_func_uuid(void) -+{ -+ return new Item_func_uuid(); -+} -+ -+Item *create_func_version(void) -+{ -+ return new Item_static_string_func("version()", server_version, -+ (uint) strlen(server_version), -+ system_charset_info, DERIVATION_SYSCONST); -+} -+ -+Item *create_func_weekday(Item* a) -+{ -+ return new Item_func_weekday(new Item_func_to_days(a),0); -+} -+ -+Item *create_func_year(Item* a) -+{ -+ return new Item_func_year(a); -+} -+ -+Item *create_load_file(Item* a) -+{ -+ current_thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT); -+ return new Item_load_file(a); -+} -+ -+ -+Item *create_func_cast(Item *a, Cast_target cast_type, int len, int dec, -+ CHARSET_INFO *cs) -+{ -+ Item *res; -+ LINT_INIT(res); -+ -+ switch (cast_type) { -+ case ITEM_CAST_BINARY: res= new Item_func_binary(a); break; -+ case ITEM_CAST_SIGNED_INT: res= new Item_func_signed(a); break; -+ case ITEM_CAST_UNSIGNED_INT: res= new Item_func_unsigned(a); break; -+ case ITEM_CAST_DATE: res= new Item_date_typecast(a); break; -+ case ITEM_CAST_TIME: res= new Item_time_typecast(a); break; -+ case ITEM_CAST_DATETIME: res= new Item_datetime_typecast(a); break; -+ case ITEM_CAST_DECIMAL: -+ res= new Item_decimal_typecast(a, (len>0) ? len : 10, dec ? dec : 2); -+ break; -+ case ITEM_CAST_CHAR: -+ res= new Item_char_typecast(a, len, cs ? cs : -+ current_thd->variables.collation_connection); -+ break; -+ } -+ return res; -+} -+ -+Item *create_func_is_free_lock(Item* a) -+{ -+ current_thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT); -+ return new Item_func_is_free_lock(a); -+} -+ -+Item *create_func_is_used_lock(Item* a) -+{ -+ current_thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT); -+ return new Item_func_is_used_lock(a); -+} -+ -+Item *create_func_quote(Item* a) -+{ -+ return new Item_func_quote(a); -+} -+ -+#ifdef HAVE_SPATIAL -+Item *create_func_as_wkt(Item *a) -+{ -+ return new Item_func_as_wkt(a); -+} -+ -+Item *create_func_as_wkb(Item *a) -+{ -+ return new Item_func_as_wkb(a); -+} -+ -+Item *create_func_srid(Item *a) -+{ -+ return new Item_func_srid(a); -+} -+ -+Item *create_func_startpoint(Item *a) -+{ -+ return new Item_func_spatial_decomp(a, Item_func::SP_STARTPOINT); -+} -+ -+Item *create_func_endpoint(Item *a) -+{ -+ return new Item_func_spatial_decomp(a, Item_func::SP_ENDPOINT); -+} -+ -+Item *create_func_exteriorring(Item *a) -+{ -+ return new Item_func_spatial_decomp(a, Item_func::SP_EXTERIORRING); -+} -+ -+Item *create_func_pointn(Item *a, Item *b) -+{ -+ return new Item_func_spatial_decomp_n(a, b, Item_func::SP_POINTN); -+} -+ -+Item *create_func_interiorringn(Item *a, Item *b) -+{ -+ return new Item_func_spatial_decomp_n(a, b, Item_func::SP_INTERIORRINGN); -+} -+ -+Item *create_func_geometryn(Item *a, Item *b) -+{ -+ return new Item_func_spatial_decomp_n(a, b, Item_func::SP_GEOMETRYN); -+} -+ -+Item *create_func_centroid(Item *a) -+{ -+ return new Item_func_centroid(a); -+} -+ -+Item *create_func_envelope(Item *a) -+{ -+ return new Item_func_envelope(a); -+} -+ -+Item *create_func_equals(Item *a, Item *b) -+{ -+ return new Item_func_spatial_rel(a, b, Item_func::SP_EQUALS_FUNC); -+} -+ -+Item *create_func_disjoint(Item *a, Item *b) -+{ -+ return new Item_func_spatial_rel(a, b, Item_func::SP_DISJOINT_FUNC); -+} -+ -+Item *create_func_intersects(Item *a, Item *b) -+{ -+ return new Item_func_spatial_rel(a, b, Item_func::SP_INTERSECTS_FUNC); -+} -+ -+Item *create_func_touches(Item *a, Item *b) -+{ -+ return new Item_func_spatial_rel(a, b, Item_func::SP_TOUCHES_FUNC); -+} -+ -+Item *create_func_crosses(Item *a, Item *b) -+{ -+ return new Item_func_spatial_rel(a, b, Item_func::SP_CROSSES_FUNC); -+} -+ -+Item *create_func_within(Item *a, Item *b) -+{ -+ return new Item_func_spatial_rel(a, b, Item_func::SP_WITHIN_FUNC); -+} -+ -+Item *create_func_contains(Item *a, Item *b) -+{ -+ return new Item_func_spatial_rel(a, b, Item_func::SP_CONTAINS_FUNC); -+} -+ -+Item *create_func_overlaps(Item *a, Item *b) -+{ -+ return new Item_func_spatial_rel(a, b, Item_func::SP_OVERLAPS_FUNC); -+} -+ -+Item *create_func_isempty(Item *a) -+{ -+ return new Item_func_isempty(a); -+} -+ -+Item *create_func_issimple(Item *a) -+{ -+ return new Item_func_issimple(a); -+} -+ -+Item *create_func_isclosed(Item *a) -+{ -+ return new Item_func_isclosed(a); -+} -+ -+Item *create_func_geometry_type(Item *a) -+{ -+ return new Item_func_geometry_type(a); -+} -+ -+Item *create_func_dimension(Item *a) -+{ -+ return new Item_func_dimension(a); -+} -+ -+Item *create_func_x(Item *a) -+{ -+ return new Item_func_x(a); -+} -+ -+Item *create_func_y(Item *a) -+{ -+ return new Item_func_y(a); -+} -+ -+Item *create_func_numpoints(Item *a) -+{ -+ return new Item_func_numpoints(a); -+} -+ -+Item *create_func_numinteriorring(Item *a) -+{ -+ return new Item_func_numinteriorring(a); -+} -+ -+Item *create_func_numgeometries(Item *a) -+{ -+ return new Item_func_numgeometries(a); -+} -+ -+Item *create_func_area(Item *a) -+{ -+ return new Item_func_area(a); -+} -+ -+Item *create_func_glength(Item *a) -+{ -+ return new Item_func_glength(a); -+} -+ -+Item *create_func_point(Item *a, Item *b) -+{ -+ return new Item_func_point(a, b); -+} -+#endif /*HAVE_SPATIAL*/ -+ -+Item *create_func_crc32(Item* a) -+{ -+ return new Item_func_crc32(a); -+} -+ -+Item *create_func_compress(Item* a) -+{ -+ return new Item_func_compress(a); -+} -+ -+Item *create_func_uncompress(Item* a) -+{ -+ return new Item_func_uncompress(a); -+} -+ -+Item *create_func_uncompressed_length(Item* a) -+{ -+ return new Item_func_uncompressed_length(a); -+} -+ -+Item *create_func_datediff(Item *a, Item *b) -+{ -+ return new Item_func_minus(new Item_func_to_days(a), -+ new Item_func_to_days(b)); -+} -+ -+Item *create_func_weekofyear(Item *a) -+{ -+ return new Item_func_week(a, new Item_int((char*) "0", 3, 1)); -+} -+ -+Item *create_func_makedate(Item* a,Item* b) -+{ -+ return new Item_func_makedate(a, b); -+} -+ -+Item *create_func_addtime(Item* a,Item* b) -+{ -+ return new Item_func_add_time(a, b, 0, 0); -+} -+ -+Item *create_func_subtime(Item* a,Item* b) -+{ -+ return new Item_func_add_time(a, b, 0, 1); -+} -+ -+Item *create_func_timediff(Item* a,Item* b) -+{ -+ return new Item_func_timediff(a, b); -+} -+ -+Item *create_func_maketime(Item* a,Item* b,Item* c) -+{ -+ return new Item_func_maketime(a, b, c); -+} -+ -+Item *create_func_str_to_date(Item* a,Item* b) -+{ -+ return new Item_func_str_to_date(a, b); -+} -+ -+Item *create_func_last_day(Item *a) -+{ -+ return new Item_func_last_day(a); -+} -diff -Naur mysql.orig/sql/item_create.h mysql.xml/sql/item_create.h ---- mysql.orig/sql/item_create.h 2005-05-15 06:16:52.000000000 +0200 -+++ mysql.xml/sql/item_create.h 2005-05-20 15:19:29.000000000 +0200 -@@ -100,7 +100,8 @@ - Item *create_func_is_free_lock(Item* a); - Item *create_func_is_used_lock(Item* a); - Item *create_func_quote(Item* a); -- -+Item *create_func_xml_extractvalue(Item *a, Item *b); -+Item *create_func_xml_update(Item *a, Item *b, Item *c); - #ifdef HAVE_SPATIAL - - Item *create_func_geometry_from_text(Item *a); -diff -Naur mysql.orig/sql/item_xmlfunc.cc mysql.xml/sql/item_xmlfunc.cc ---- mysql.orig/sql/item_xmlfunc.cc 1970-01-01 01:00:00.000000000 +0100 -+++ mysql.xml/sql/item_xmlfunc.cc 2005-04-16 13:49:09.000000000 +0200 -@@ -0,0 +1,2555 @@ -+/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 2 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the Free Software -+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -+ -+ -+#ifdef __GNUC__ -+#pragma implementation -+#endif -+ -+#include "mysql_priv.h" -+#include "my_xml.h" -+ -+ -+/* -+ TODO: future development directions: -+ 1. add real constants for XPATH_NODESET_CMP and XPATH_NODESET -+ into enum Type in item.h. -+ 2. add nodeset_to_nodeset_comparator -+ 3. add lacking functions: -+ - name() -+ - last() -+ - lang() -+ - string() -+ - id() -+ - translate() -+ - local-name() -+ - starts-with() -+ - namespace-uri() -+ - substring-after() -+ - normalize-space() -+ - substring-before() -+ 4. add lacking axis: -+ - following-sibling -+ - following, -+ - preceding-sibling -+ - preceding -+*/ -+ -+ -+/* Structure to store a parsed XML tree */ -+typedef struct my_xml_node_st -+{ -+ uint level; /* level in XML tree, 0 means root node */ -+ enum my_xml_node_type type; /* node type: node, or attribute, or text */ -+ uint parent; /* link to the parent */ -+ const char *beg; /* beginning of the name or text */ -+ const char *end; /* end of the name or text */ -+ const char *tagend; /* where this tag ends */ -+} MY_XML_NODE; -+ -+ -+/* Lexical analizer token */ -+typedef struct my_xpath_lex_st -+{ -+ int term; /* token type, see MY_XPATH_LEX_XXXXX below */ -+ const char *beg; /* beginnign of the token */ -+ const char *end; /* end of the token */ -+} MY_XPATH_LEX; -+ -+ -+/* Structure to store nodesets */ -+typedef struct my_xpath_flt_st -+{ -+ uint num; /* absolute position in MY_XML_NODE array */ -+ uint pos; /* relative position in context */ -+} MY_XPATH_FLT; -+ -+ -+/* XPath function creator */ -+typedef struct my_xpath_function_names_st -+{ -+ const char *name; /* function name */ -+ size_t length; /* function name length */ -+ size_t minargs; /* min number of arguments */ -+ size_t maxargs; /* max number of arguments */ -+ Item *(*create)(struct my_xpath_st *xpath, Item **args, uint nargs); -+} MY_XPATH_FUNC; -+ -+ -+/* XPath query parser */ -+typedef struct my_xpath_st -+{ -+ int debug; -+ MY_XPATH_LEX query; /* Whole query */ -+ MY_XPATH_LEX lasttok; /* last scanned token */ -+ MY_XPATH_LEX prevtok; /* previous scanned token */ -+ int axis; /* last scanned axis */ -+ int extra; /* last scanned "extra", context dependent */ -+ MY_XPATH_FUNC *func; /* last scanned function creator */ -+ Item *item; /* current expression */ -+ Item *context; /* last scanned context */ -+ String *context_cache; /* last context provider */ -+ String *pxml; /* Parsed XML, an array of MY_XML_NODE */ -+ CHARSET_INFO *cs; /* character set/collation string comparison */ -+} MY_XPATH; -+ -+ -+/* Dynamic array of MY_XPATH_FLT */ -+class XPathFilter :public String -+{ -+public: -+ XPathFilter() :String() {} -+ inline bool append_element(MY_XPATH_FLT *flt) -+ { -+ String *str= this; -+ return str->append((const char*)flt, (uint32) sizeof(MY_XPATH_FLT)); -+ } -+ inline bool append_element(uint32 num, uint32 pos) -+ { -+ MY_XPATH_FLT add; -+ add.num= num; -+ add.pos= pos; -+ return append_element(&add); -+ } -+ inline MY_XPATH_FLT *element(uint i) -+ { -+ return (MY_XPATH_FLT*) (ptr() + i * sizeof(MY_XPATH_FLT)); -+ } -+ inline uint32 numelements() -+ { -+ return length() / sizeof(MY_XPATH_FLT); -+ } -+}; -+ -+ -+/* -+ Common features of the functions returning a node set. -+*/ -+class Item_nodeset_func :public Item_str_func -+{ -+protected: -+ String tmp_value, tmp2_value; -+ MY_XPATH_FLT *fltbeg, *fltend; -+ MY_XML_NODE *nodebeg, *nodeend; -+ uint numnodes; -+public: -+ String *pxml; -+ String context_cache; -+ Item_nodeset_func(String *pxml_arg) :Item_str_func(), pxml(pxml_arg) {} -+ Item_nodeset_func(Item *a, String *pxml_arg) -+ :Item_str_func(a), pxml(pxml_arg) {} -+ Item_nodeset_func(Item *a, Item *b, String *pxml_arg) -+ :Item_str_func(a, b), pxml(pxml_arg) {} -+ Item_nodeset_func(Item *a, Item *b, Item *c, String *pxml_arg) -+ :Item_str_func(a,b,c), pxml(pxml_arg) {} -+ void prepare_nodes() -+ { -+ nodebeg= (MY_XML_NODE*) pxml->ptr(); -+ nodeend= (MY_XML_NODE*) (pxml->ptr() + pxml->length()); -+ numnodes= nodeend - nodebeg; -+ } -+ void prepare(String *nodeset) -+ { -+ prepare_nodes(); -+ String *res= args[0]->val_nodeset(&tmp_value); -+ fltbeg= (MY_XPATH_FLT*) res->ptr(); -+ fltend= (MY_XPATH_FLT*) (res->ptr() + res->length()); -+ nodeset->length(0); -+ } -+ enum Type type() const { return XPATH_NODESET; } -+ String *val_str(String *str) -+ { -+ prepare_nodes(); -+ String *res= val_nodeset(&tmp2_value); -+ fltbeg= (MY_XPATH_FLT*) res->ptr(); -+ fltend= (MY_XPATH_FLT*) (res->ptr() + res->length()); -+ String active; -+ active.alloc(numnodes); -+ bzero((char*) active.ptr(), numnodes); -+ for (MY_XPATH_FLT *flt= fltbeg; flt < fltend; flt++) -+ { -+ MY_XML_NODE *node; -+ uint j; -+ for (j=0, node= nodebeg ; j < numnodes; j++, node++) -+ { -+ if (node->type == MY_XML_NODE_TEXT && -+ node->parent == flt->num) -+ active[j]= 1; -+ } -+ } -+ -+ str->length(0); -+ str->set_charset(collation.collation); -+ for (uint i=0 ; i < numnodes; i++) -+ { -+ if(active[i]) -+ { -+ if (str->length()) -+ str->append(" ", 1, &my_charset_latin1); -+ str->append(nodebeg[i].beg, nodebeg[i].end - nodebeg[i].beg); -+ } -+ } -+ return str; -+ } -+ enum Item_result result_type () const { return STRING_RESULT; } -+ void fix_length_and_dec() { max_length= MAX_BLOB_WIDTH; } -+ const char *func_name() const { return "nodeset"; } -+}; -+ -+ -+/* Returns an XML root */ -+class Item_nodeset_func_rootelement :public Item_nodeset_func -+{ -+public: -+ Item_nodeset_func_rootelement(String *pxml): Item_nodeset_func(pxml) {} -+ String *val_nodeset(String *nodeset); -+}; -+ -+ -+/* Returns a Union of two node sets */ -+class Item_nodeset_func_union :public Item_nodeset_func -+{ -+public: -+ Item_nodeset_func_union(Item *a, Item *b, String *pxml) -+ :Item_nodeset_func(a, b, pxml) {} -+ String *val_nodeset(String *nodeset); -+}; -+ -+ -+/* Makes one step towards the given axis */ -+class Item_nodeset_func_axisbyname :public Item_nodeset_func -+{ -+ const char *node_name; -+ uint node_namelen; -+public: -+ Item_nodeset_func_axisbyname(Item *a, const char *n_arg, uint l_arg, -+ String *pxml): -+ Item_nodeset_func(a, pxml), node_name(n_arg), node_namelen(l_arg) { } -+ bool validname(MY_XML_NODE *n) -+ { -+ if (node_name[0] == '*') -+ return 1; -+ return (node_namelen == (uint) (n->end - n->beg)) && -+ !memcmp(node_name, n->beg, node_namelen); -+ } -+}; -+ -+ -+/* Returns children */ -+class Item_nodeset_func_childbyname: public Item_nodeset_func_axisbyname -+{ -+public: -+ Item_nodeset_func_childbyname(Item *a, const char *n_arg, uint l_arg, -+ String *pxml): -+ Item_nodeset_func_axisbyname(a, n_arg, l_arg, pxml) {} -+ String *val_nodeset(String *nodeset); -+}; -+ -+ -+/* Returns descendants */ -+class Item_nodeset_func_descendantbyname: public Item_nodeset_func_axisbyname -+{ -+ bool need_self; -+public: -+ Item_nodeset_func_descendantbyname(Item *a, const char *n_arg, uint l_arg, -+ String *pxml, bool need_self_arg): -+ Item_nodeset_func_axisbyname(a, n_arg, l_arg, pxml), -+ need_self(need_self_arg) {} -+ String *val_nodeset(String *nodeset); -+}; -+ -+ -+/* Returns ancestors */ -+class Item_nodeset_func_ancestorbyname: public Item_nodeset_func_axisbyname -+{ -+ bool need_self; -+public: -+ Item_nodeset_func_ancestorbyname(Item *a, const char *n_arg, uint l_arg, -+ String *pxml, bool need_self_arg): -+ Item_nodeset_func_axisbyname(a, n_arg, l_arg, pxml), -+ need_self(need_self_arg) {} -+ String *val_nodeset(String *nodeset); -+}; -+ -+ -+/* Returns parents */ -+class Item_nodeset_func_parentbyname: public Item_nodeset_func_axisbyname -+{ -+public: -+ Item_nodeset_func_parentbyname(Item *a, const char *n_arg, uint l_arg, -+ String *pxml): -+ Item_nodeset_func_axisbyname(a, n_arg, l_arg, pxml) {} -+ String *val_nodeset(String *nodeset); -+}; -+ -+ -+/* Returns attributes */ -+class Item_nodeset_func_attributebyname: public Item_nodeset_func_axisbyname -+{ -+public: -+ Item_nodeset_func_attributebyname(Item *a, const char *n_arg, uint l_arg, -+ String *pxml): -+ Item_nodeset_func_axisbyname(a, n_arg, l_arg, pxml) {} -+ String *val_nodeset(String *nodeset); -+}; -+ -+ -+/* -+ Condition iterator: goes through all nodes in the current -+ context and checks a condition, returning those nodes -+ giving TRUE condition result. -+*/ -+class Item_nodeset_func_predicate :public Item_nodeset_func -+{ -+public: -+ Item_nodeset_func_predicate(Item *a, Item *b, String *pxml): -+ Item_nodeset_func(a, b, pxml) {} -+ String *val_nodeset(String *nodeset); -+}; -+ -+ -+/* Selects nodes with a given position in context */ -+class Item_nodeset_func_elementbyindex :public Item_nodeset_func -+{ -+public: -+ Item_nodeset_func_elementbyindex(Item *a, Item *b, String *pxml): -+ Item_nodeset_func(a, b, pxml) { } -+ String *val_nodeset(String *nodeset); -+}; -+ -+ -+/* -+ We need to distinguish a number from a boolean: -+ a[1] and a[true] are different things in XPath. -+*/ -+class Item_bool :public Item_int -+{ -+public: -+ Item_bool(int32 i): Item_int(i) {} -+ bool is_bool_func() { return 1; } -+}; -+ -+ -+/* -+ Converts its argument into a boolean value. -+ * a number is true if it is non-zero -+ * a node-set is true if and only if it is non-empty -+ * a string is true if and only if its length is non-zero -+*/ -+class Item_xpath_cast_bool :public Item_int_func -+{ -+ String *pxml; -+ String tmp_value; -+public: -+ Item_xpath_cast_bool(Item *a, String *pxml_arg) -+ :Item_int_func(a), pxml(pxml_arg) {} -+ bool is_bool_func() { return 1; } -+ longlong val_int() -+ { -+ if (args[0]->type() == XPATH_NODESET) -+ { -+ String *flt= args[0]->val_nodeset(&tmp_value); -+ return flt->length() == sizeof(MY_XPATH_FLT) ? 1 : 0; -+ } -+ return args[0]->val_real() ? 1 : 0; -+ } -+}; -+ -+ -+/* -+ Converts its argument into a number -+*/ -+class Item_xpath_cast_number :public Item_real_func -+{ -+public: -+ Item_xpath_cast_number(Item *a): Item_real_func(a) {} -+ virtual double val_real() { return args[0]->val_real(); } -+}; -+ -+ -+/* -+ Context cache, for predicate -+*/ -+class Item_nodeset_context_cache :public Item_nodeset_func -+{ -+public: -+ String *string_cache; -+ Item_nodeset_context_cache(String *str_arg, String *pxml): -+ Item_nodeset_func(pxml), string_cache(str_arg) { } -+ String *val_nodeset(String *res) -+ { return string_cache; } -+ void fix_length_and_dec() { max_length= MAX_BLOB_WIDTH; } -+}; -+ -+ -+class Item_func_xpath_position :public Item_int_func -+{ -+ String *pxml; -+ String tmp_value; -+public: -+ Item_func_xpath_position(Item *a, String *p) -+ :Item_int_func(a), pxml(p) {} -+ void fix_length_and_dec() { max_length=10; } -+ longlong val_int() -+ { -+ String *flt= args[0]->val_nodeset(&tmp_value); -+ if (flt->length() == sizeof(MY_XPATH_FLT)) -+ return ((MY_XPATH_FLT*)flt->ptr())->pos + 1; -+ return 0; -+ } -+}; -+ -+ -+class Item_func_xpath_count :public Item_int_func -+{ -+ String *pxml; -+ String tmp_value; -+public: -+ Item_func_xpath_count(Item *a, String *p) -+ :Item_int_func(a), pxml(p) {} -+ void fix_length_and_dec() { max_length=10; } -+ longlong val_int() -+ { -+ String *res= args[0]->val_nodeset(&tmp_value); -+ return res->length() / sizeof(MY_XPATH_FLT); -+ } -+}; -+ -+ -+class Item_func_xpath_sum :public Item_real_func -+{ -+ String *pxml; -+ String tmp_value; -+public: -+ Item_func_xpath_sum(Item *a, String *p) -+ :Item_real_func(a), pxml(p) {} -+ -+ double val_real() -+ { -+ double sum= 0; -+ String *res= args[0]->val_nodeset(&tmp_value); -+ MY_XPATH_FLT *fltbeg= (MY_XPATH_FLT*) res->ptr(); -+ MY_XPATH_FLT *fltend= (MY_XPATH_FLT*) (res->ptr() + res->length()); -+ uint numnodes= pxml->length() / sizeof(MY_XML_NODE); -+ MY_XML_NODE *nodebeg= (MY_XML_NODE*) pxml->ptr(); -+ -+ for (MY_XPATH_FLT *flt= fltbeg; flt < fltend; flt++) -+ { -+ MY_XML_NODE *self= &nodebeg[flt->num]; -+ for (uint j= flt->num + 1; j < numnodes; j++) -+ { -+ MY_XML_NODE *node= &nodebeg[j]; -+ if (node->level <= self->level) -+ break; -+ if ((node->parent == flt->num) && -+ (node->type == MY_XML_NODE_TEXT)) -+ { -+ char *end; -+ int err; -+ double add= my_strntod(collation.collation, (char*) node->beg, -+ node->end - node->beg, &end, &err); -+ if (!err) -+ sum+= add; -+ } -+ } -+ } -+ return sum; -+ } -+}; -+ -+ -+class Item_nodeset_to_const_comparator :public Item_bool_func -+{ -+ String *pxml; -+ String tmp_nodeset; -+public: -+ Item_nodeset_to_const_comparator(Item *nodeset, Item *cmpfunc, String *p) -+ :Item_bool_func(nodeset,cmpfunc), pxml(p) {} -+ enum Type type() const { return XPATH_NODESET_CMP; }; -+ bool is_bool_func() { return 1; } -+ -+ longlong val_int() -+ { -+ Item_func *comp= (Item_func*)args[1]; -+ Item_string *fake= (Item_string*)(comp->arguments()[1]); -+ String *res= args[0]->val_nodeset(&tmp_nodeset); -+ MY_XPATH_FLT *fltbeg= (MY_XPATH_FLT*) res->ptr(); -+ MY_XPATH_FLT *fltend= (MY_XPATH_FLT*) (res->ptr() + res->length()); -+ MY_XML_NODE *nodebeg= (MY_XML_NODE*) pxml->ptr(); -+ uint numnodes= pxml->length() / sizeof(MY_XML_NODE); -+ -+ for (MY_XPATH_FLT *flt= fltbeg; flt < fltend; flt++) -+ { -+ MY_XML_NODE *self= &nodebeg[flt->num]; -+ for (uint j= flt->num + 1; j < numnodes; j++) -+ { -+ MY_XML_NODE *node= &nodebeg[j]; -+ if (node->level <= self->level) -+ break; -+ if ((node->parent == flt->num) && -+ (node->type == MY_XML_NODE_TEXT)) -+ { -+ fake->str_value.set(node->beg, node->end - node->beg, -+ collation.collation); -+ if (args[1]->val_int()) -+ return 1; -+ } -+ } -+ } -+ return 0; -+ } -+}; -+ -+ -+String *Item_nodeset_func_rootelement::val_nodeset(String *nodeset) -+{ -+ nodeset->length(0); -+ ((XPathFilter*)nodeset)->append_element(0, 0); -+ return nodeset; -+} -+ -+ -+String * Item_nodeset_func_union::val_nodeset(String *nodeset) -+{ -+ uint numnodes= pxml->length() / sizeof(MY_XML_NODE); -+ String set0, *s0= args[0]->val_nodeset(&set0); -+ String set1, *s1= args[1]->val_nodeset(&set1); -+ String both_str; -+ both_str.alloc(numnodes); -+ char *both= (char*) both_str.ptr(); -+ bzero((void*)both, numnodes); -+ uint pos= 0; -+ MY_XPATH_FLT *flt; -+ -+ fltbeg= (MY_XPATH_FLT*) s0->ptr(); -+ fltend= (MY_XPATH_FLT*) (s0->ptr() + s0->length()); -+ for (flt= fltbeg; flt < fltend; flt++) -+ both[flt->num]= 1; -+ -+ fltbeg= (MY_XPATH_FLT*) s1->ptr(); -+ fltend= (MY_XPATH_FLT*) (s1->ptr() + s1->length()); -+ for (flt= fltbeg; flt < fltend; flt++) -+ both[flt->num]= 1; -+ -+ nodeset->length(0); -+ for (uint i= 0, pos= 0; i < numnodes; i++) -+ { -+ if (both[i]) -+ ((XPathFilter*)nodeset)->append_element(i, pos++); -+ } -+ return nodeset; -+} -+ -+ -+String *Item_nodeset_func_childbyname::val_nodeset(String *nodeset) -+{ -+ prepare(nodeset); -+ for (MY_XPATH_FLT *flt= fltbeg; flt < fltend; flt++) -+ { -+ MY_XML_NODE *self= &nodebeg[flt->num]; -+ for (uint pos= 0, j= flt->num + 1 ; j < numnodes; j++) -+ { -+ MY_XML_NODE *node= &nodebeg[j]; -+ if (node->level <= self->level) -+ break; -+ if ((node->parent == flt->num) && -+ (node->type == MY_XML_NODE_TAG) && -+ validname(node)) -+ ((XPathFilter*)nodeset)->append_element(j, pos++); -+ } -+ } -+ return nodeset; -+} -+ -+ -+String *Item_nodeset_func_descendantbyname::val_nodeset(String *nodeset) -+{ -+ prepare(nodeset); -+ for (MY_XPATH_FLT *flt= fltbeg; flt < fltend; flt++) -+ { -+ uint pos= 0; -+ MY_XML_NODE *self= &nodebeg[flt->num]; -+ if (need_self && validname(self)) -+ ((XPathFilter*)nodeset)->append_element(flt->num,pos++); -+ for (uint j= flt->num + 1 ; j < numnodes ; j++) -+ { -+ MY_XML_NODE *node= &nodebeg[j]; -+ if (node->level <= self->level) -+ break; -+ if ((node->type == MY_XML_NODE_TAG) && validname(node)) -+ ((XPathFilter*)nodeset)->append_element(j,pos++); -+ } -+ } -+ return nodeset; -+} -+ -+ -+String *Item_nodeset_func_ancestorbyname::val_nodeset(String *nodeset) -+{ -+ char *active; -+ String active_str; -+ prepare(nodeset); -+ active_str.alloc(numnodes); -+ active= (char*) active_str.ptr(); -+ bzero((void*)active, numnodes); -+ uint pos= 0; -+ -+ for (MY_XPATH_FLT *flt= fltbeg; flt < fltend; flt++) -+ { -+ /* -+ Go to the root and add all nodes on the way. -+ Don't add the root if context is the root itelf -+ */ -+ MY_XML_NODE *self= &nodebeg[flt->num]; -+ if (need_self && validname(self)) -+ { -+ active[flt->num]= 1; -+ pos++; -+ } -+ -+ for (uint j= self->parent; nodebeg[j].parent != j; j= nodebeg[j].parent) -+ { -+ if (flt->num && validname(&nodebeg[j])) -+ { -+ active[j]= 1; -+ pos++; -+ } -+ } -+ } -+ -+ for (uint j= 0; j < numnodes ; j++) -+ { -+ if (active[j]) -+ ((XPathFilter*)nodeset)->append_element(j, --pos); -+ } -+ return nodeset; -+} -+ -+ -+String *Item_nodeset_func_parentbyname::val_nodeset(String *nodeset) -+{ -+ char *active; -+ String active_str; -+ prepare(nodeset); -+ active_str.alloc(numnodes); -+ active= (char*) active_str.ptr(); -+ bzero((void*)active, numnodes); -+ for (MY_XPATH_FLT *flt= fltbeg; flt < fltend; flt++) -+ { -+ uint j= nodebeg[flt->num].parent; -+ if (flt->num && validname(&nodebeg[j])) -+ active[j]= 1; -+ } -+ for (uint j= 0, pos= 0; j < numnodes ; j++) -+ { -+ if (active[j]) -+ ((XPathFilter*)nodeset)->append_element(j, pos++); -+ } -+ return nodeset; -+} -+ -+ -+String *Item_nodeset_func_attributebyname::val_nodeset(String *nodeset) -+{ -+ prepare(nodeset); -+ for (MY_XPATH_FLT *flt= fltbeg; flt < fltend; flt++) -+ { -+ MY_XML_NODE *self= &nodebeg[flt->num]; -+ for (uint pos=0, j= flt->num + 1 ; j < numnodes; j++) -+ { -+ MY_XML_NODE *node= &nodebeg[j]; -+ if (node->level <= self->level) -+ break; -+ if ((node->parent == flt->num) && -+ (node->type == MY_XML_NODE_ATTR) && -+ validname(node)) -+ ((XPathFilter*)nodeset)->append_element(j, pos++); -+ } -+ } -+ return nodeset; -+} -+ -+ -+String *Item_nodeset_func_predicate::val_nodeset(String *str) -+{ -+ Item_nodeset_func *nodeset_func= (Item_nodeset_func*) args[0]; -+ Item_func *comp_func= (Item_func*)args[1]; -+ uint pos= 0; -+ prepare(str); -+ for (MY_XPATH_FLT *flt= fltbeg; flt < fltend; flt++) -+ { -+ nodeset_func->context_cache.length(0); -+ ((XPathFilter*)(&nodeset_func->context_cache))->append_element(flt->num, -+ flt->pos); -+ if (comp_func->val_int()) -+ ((XPathFilter*)str)->append_element(flt->num, pos++); -+ } -+ return str; -+}; -+ -+ -+String *Item_nodeset_func_elementbyindex::val_nodeset(String *nodeset) -+{ -+ prepare(nodeset); -+ int index= args[1]->val_int() - 1; -+ if (index >= 0) -+ { -+ MY_XPATH_FLT *flt; -+ uint pos; -+ for (pos= 0, flt= fltbeg; flt < fltend; flt++) -+ { -+ if (flt->pos == (uint) index || args[1]->is_bool_func()) -+ ((XPathFilter*)nodeset)->append_element(flt->num, pos++); -+ } -+ } -+ return nodeset; -+} -+ -+ -+/* -+ If item is a node set, then casts it to boolean, -+ otherwise returns the item itself. -+*/ -+static Item* nodeset2bool(MY_XPATH *xpath, Item *item) -+{ -+ if (item->type() == Item::XPATH_NODESET) -+ return new Item_xpath_cast_bool(item, xpath->pxml); -+ return item; -+} -+ -+ -+/* -+ XPath lexical tokens -+*/ -+#define MY_XPATH_LEX_DIGITS 'd' -+#define MY_XPATH_LEX_IDENT 'i' -+#define MY_XPATH_LEX_STRING 's' -+#define MY_XPATH_LEX_SLASH '/' -+#define MY_XPATH_LEX_LB '[' -+#define MY_XPATH_LEX_RB ']' -+#define MY_XPATH_LEX_LP '(' -+#define MY_XPATH_LEX_RP ')' -+#define MY_XPATH_LEX_EQ '=' -+#define MY_XPATH_LEX_LESS '<' -+#define MY_XPATH_LEX_GREATER '>' -+#define MY_XPATH_LEX_AT '@' -+#define MY_XPATH_LEX_COLON ':' -+#define MY_XPATH_LEX_ASTERISK '*' -+#define MY_XPATH_LEX_DOT '.' -+#define MY_XPATH_LEX_VLINE '|' -+#define MY_XPATH_LEX_MINUS '-' -+#define MY_XPATH_LEX_PLUS '+' -+#define MY_XPATH_LEX_EXCL '!' -+#define MY_XPATH_LEX_COMMA ',' -+#define MY_XPATH_LEX_DOLLAR '$' -+#define MY_XPATH_LEX_ERROR 'A' -+#define MY_XPATH_LEX_EOF 'B' -+#define MY_XPATH_LEX_AND 'C' -+#define MY_XPATH_LEX_OR 'D' -+#define MY_XPATH_LEX_DIV 'E' -+#define MY_XPATH_LEX_MOD 'F' -+#define MY_XPATH_LEX_FUNC 'G' -+#define MY_XPATH_LEX_NODETYPE 'H' -+#define MY_XPATH_LEX_AXIS 'I' -+#define MY_XPATH_LEX_LE 'J' -+#define MY_XPATH_LEX_GE 'K' -+ -+ -+/* -+ XPath axis type -+*/ -+#define MY_XPATH_AXIS_ANCESTOR 0 -+#define MY_XPATH_AXIS_ANCESTOR_OR_SELF 1 -+#define MY_XPATH_AXIS_ATTRIBUTE 2 -+#define MY_XPATH_AXIS_CHILD 3 -+#define MY_XPATH_AXIS_DESCENDANT 4 -+#define MY_XPATH_AXIS_DESCENDANT_OR_SELF 5 -+#define MY_XPATH_AXIS_FOLLOWING 6 -+#define MY_XPATH_AXIS_FOLLOWING_SIBLING 7 -+#define MY_XPATH_AXIS_NAMESPACE 8 -+#define MY_XPATH_AXIS_PARENT 9 -+#define MY_XPATH_AXIS_PRECEDING 10 -+#define MY_XPATH_AXIS_PRECEDING_SIBLING 11 -+#define MY_XPATH_AXIS_SELF 12 -+ -+ -+/* -+ Create scalar comparator -+ -+ SYNOPSYS -+ Create a comparator function for scalar arguments, -+ for the given arguments and operation. -+ -+ RETURN -+ The newly created item. -+*/ -+static Item *eq_func(int oper, Item *a, Item *b) -+{ -+ switch (oper) -+ { -+ case '=': return new Item_func_eq(a, b); -+ case '!': return new Item_func_ne(a, b); -+ case MY_XPATH_LEX_GE: return new Item_func_ge(a, b); -+ case MY_XPATH_LEX_LE: return new Item_func_le(a, b); -+ case MY_XPATH_LEX_GREATER: return new Item_func_gt(a, b); -+ case MY_XPATH_LEX_LESS: return new Item_func_lt(a, b); -+ } -+ return 0; -+} -+ -+ -+/* -+ Create scalar comparator -+ -+ SYNOPSYS -+ Create a comparator function for scalar arguments, -+ for the given arguments and reverse operation, e.g. -+ -+ A >= B is converted into A < B -+ -+ RETURN -+ The newly created item. -+*/ -+static Item *eq_func_reverse(int oper, Item *a, Item *b) -+{ -+ switch (oper) -+ { -+ case '=': return new Item_func_eq(a, b); -+ case '!': return new Item_func_ne(a, b); -+ case MY_XPATH_LEX_GE: return new Item_func_lt(a, b); -+ case MY_XPATH_LEX_LE: return new Item_func_gt(a, b); -+ case MY_XPATH_LEX_GREATER: return new Item_func_le(a, b); -+ case MY_XPATH_LEX_LESS: return new Item_func_ge(a, b); -+ } -+ return 0; -+} -+ -+ -+/* -+ Create a comparator -+ -+ SYNOPSYS -+ Create a comparator for scalar or non-scalar arguments, -+ for the given arguments and operation. -+ -+ RETURN -+ The newly created item. -+*/ -+static Item *create_comparator(MY_XPATH *xpath, int oper, Item *a, Item *b) -+{ -+ if (a->type() != Item::XPATH_NODESET && -+ b->type() != Item::XPATH_NODESET) -+ { -+ return eq_func(oper, a, b); // two scalar arguments -+ } -+ else if (a->type() == Item::XPATH_NODESET && -+ b->type() == Item::XPATH_NODESET) -+ { -+ return 0; // TODO: Comparison of two nodesets -+ } -+ else -+ { -+ /* -+ Compare a node set to a scalar value. -+ We just create a fake Item_string() argument, -+ which will be filled to the partular value -+ in a loop through all of the nodes in the node set. -+ */ -+ -+ Item *fake= new Item_string("", 0, xpath->cs); -+ Item_nodeset_func *nodeset; -+ Item *scalar, *comp; -+ if (a->type() == Item::XPATH_NODESET) -+ { -+ nodeset= (Item_nodeset_func*) a; -+ scalar= b; -+ comp= eq_func(oper, scalar, fake); -+ } -+ else -+ { -+ nodeset= (Item_nodeset_func*) b; -+ scalar= a; -+ comp= eq_func_reverse(oper, scalar, fake); -+ } -+ return new Item_nodeset_to_const_comparator(nodeset, comp, xpath->pxml); -+ } -+} -+ -+ -+/* -+ Create a step -+ -+ SYNOPSYS -+ Create a step function for the given argument and axis. -+ -+ RETURN -+ The newly created item. -+*/ -+static Item* nametestfunc(MY_XPATH *xpath, -+ int type, Item *arg, const char *beg, uint len) -+{ -+ DBUG_ASSERT(arg != 0); -+ DBUG_ASSERT(arg->type() == Item::XPATH_NODESET); -+ DBUG_ASSERT(beg != 0); -+ DBUG_ASSERT(len > 0); -+ -+ Item *res; -+ switch (type) -+ { -+ case MY_XPATH_AXIS_ANCESTOR: -+ res= new Item_nodeset_func_ancestorbyname(arg, beg, len, xpath->pxml, 0); -+ break; -+ case MY_XPATH_AXIS_ANCESTOR_OR_SELF: -+ res= new Item_nodeset_func_ancestorbyname(arg, beg, len, xpath->pxml, 1); -+ break; -+ case MY_XPATH_AXIS_PARENT: -+ res= new Item_nodeset_func_parentbyname(arg, beg, len, xpath->pxml); -+ break; -+ case MY_XPATH_AXIS_DESCENDANT: -+ res= new Item_nodeset_func_descendantbyname(arg, beg, len, xpath->pxml, 0); -+ break; -+ case MY_XPATH_AXIS_DESCENDANT_OR_SELF: -+ res= new Item_nodeset_func_descendantbyname(arg, beg, len, xpath->pxml, 1); -+ break; -+ case MY_XPATH_AXIS_ATTRIBUTE: -+ res= new Item_nodeset_func_attributebyname(arg, beg, len, xpath->pxml); -+ break; -+ default: -+ res= new Item_nodeset_func_childbyname(arg, beg, len, xpath->pxml); -+ } -+ return res; -+} -+ -+ -+/* -+ Tokens consisting of one character, for faster lexical analizer. -+*/ -+static char simpletok[128]= -+{ -+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -+/* -+ ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? -+ @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ -+ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~ € -+*/ -+ 0,1,0,0,1,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,0, -+ 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0, -+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0 -+}; -+ -+ -+/* -+ XPath keywords -+*/ -+struct my_xpath_keyword_names_st -+{ -+ int tok; -+ const char *name; -+ size_t length; -+ int extra; -+}; -+ -+ -+static struct my_xpath_keyword_names_st my_keyword_names[] = -+{ -+ {MY_XPATH_LEX_AND , "and" , 3, 0 }, -+ {MY_XPATH_LEX_OR , "or" , 2, 0 }, -+ {MY_XPATH_LEX_DIV , "div" , 3, 0 }, -+ {MY_XPATH_LEX_MOD , "mod" , 3, 0 }, -+ -+ {MY_XPATH_LEX_NODETYPE, "comment" , 7, 0 }, -+ {MY_XPATH_LEX_NODETYPE, "text" , 4, 0 }, -+ {MY_XPATH_LEX_NODETYPE, "processing-instruction" , 22,0 }, -+ {MY_XPATH_LEX_NODETYPE, "node" , 4, 0 }, -+ -+ {MY_XPATH_LEX_AXIS,"ancestor" , 8,MY_XPATH_AXIS_ANCESTOR }, -+ {MY_XPATH_LEX_AXIS,"ancestor-or-self" ,16,MY_XPATH_AXIS_ANCESTOR_OR_SELF }, -+ {MY_XPATH_LEX_AXIS,"attribute" , 9,MY_XPATH_AXIS_ATTRIBUTE }, -+ {MY_XPATH_LEX_AXIS,"child" , 5,MY_XPATH_AXIS_CHILD }, -+ {MY_XPATH_LEX_AXIS,"descendant" ,10,MY_XPATH_AXIS_DESCENDANT }, -+ {MY_XPATH_LEX_AXIS,"descendant-or-self",18,MY_XPATH_AXIS_DESCENDANT_OR_SELF}, -+ {MY_XPATH_LEX_AXIS,"following" , 9,MY_XPATH_AXIS_FOLLOWING }, -+ {MY_XPATH_LEX_AXIS,"following-sibling" ,17,MY_XPATH_AXIS_FOLLOWING_SIBLING }, -+ {MY_XPATH_LEX_AXIS,"namespace" , 9,MY_XPATH_AXIS_NAMESPACE }, -+ {MY_XPATH_LEX_AXIS,"parent" , 6,MY_XPATH_AXIS_PARENT }, -+ {MY_XPATH_LEX_AXIS,"preceding" , 9,MY_XPATH_AXIS_PRECEDING }, -+ {MY_XPATH_LEX_AXIS,"preceding-sibling" ,17,MY_XPATH_AXIS_PRECEDING_SIBLING }, -+ {MY_XPATH_LEX_AXIS,"self" , 4,MY_XPATH_AXIS_SELF }, -+ -+ {0,NULL,0,0} -+}; -+ -+ -+/* -+ Lookup a keyword -+ -+ SYNOPSYS -+ Check that the last scanned identifier is a keyword. -+ -+ RETURN -+ - Token type, on lookup success. -+ - MY_XPATH_LEX_IDENT, on lookup failure. -+*/ -+static int my_xpath_keyword(MY_XPATH *x, const char *beg, const char *end) -+{ -+ struct my_xpath_keyword_names_st *k; -+ size_t length= end-beg; -+ for (k= my_keyword_names; k->name; k++) -+ { -+ if (length == k->length && !strncasecmp(beg, k->name, length)) -+ { -+ x->extra= k->extra; -+ return k->tok; -+ } -+ } -+ return MY_XPATH_LEX_IDENT; -+} -+ -+ -+/* -+ Functions to create an item, a-la those in item_create.cc -+*/ -+ -+static Item *create_func_true(MY_XPATH *xpath, Item **args, uint nargs) -+{ -+ return new Item_bool(1); -+} -+ -+ -+static Item *create_func_false(MY_XPATH *xpath, Item **args, uint nargs) -+{ -+ return new Item_bool(0); -+} -+ -+ -+static Item *create_func_not(MY_XPATH *xpath, Item **args, uint nargs) -+{ -+ return new Item_func_not(nodeset2bool(xpath, args[0])); -+} -+ -+ -+static Item *create_func_ceiling(MY_XPATH *xpath, Item **args, uint nargs) -+{ -+ return new Item_func_ceiling(args[0]); -+} -+ -+ -+static Item *create_func_floor(MY_XPATH *xpath, Item **args, uint nargs) -+{ -+ return new Item_func_floor(args[0]); -+} -+ -+ -+static Item *create_func_bool(MY_XPATH *xpath, Item **args, uint nargs) -+{ -+ return new Item_xpath_cast_bool(args[0], xpath->pxml); -+} -+ -+ -+static Item *create_func_number(MY_XPATH *xpath, Item **args, uint nargs) -+{ -+ return new Item_xpath_cast_number(args[0]); -+} -+ -+ -+static Item *create_func_round(MY_XPATH *xpath, Item **args, uint nargs) -+{ -+ return new Item_func_round(args[0], new Item_int((char*)"0",0,1),0); -+} -+ -+ -+static Item *create_func_last(MY_XPATH *xpath, Item **args, uint nargs) -+{ -+ return new Item_func_xpath_count(xpath->context, xpath->pxml); -+} -+ -+ -+static Item *create_func_position(MY_XPATH *xpath, Item **args, uint nargs) -+{ -+ return new Item_func_xpath_position(xpath->context, xpath->pxml); -+} -+ -+ -+static Item *create_func_contains(MY_XPATH *xpath, Item **args, uint nargs) -+{ -+ return new Item_xpath_cast_bool(new Item_func_locate(args[0], args[1]), -+ xpath->pxml); -+} -+ -+ -+static Item *create_func_concat(MY_XPATH *xpath, Item **args, uint nargs) -+{ -+ return new Item_func_concat(args[0], args[1]); -+} -+ -+ -+static Item *create_func_substr(MY_XPATH *xpath, Item **args, uint nargs) -+{ -+ if (nargs == 2) -+ return new Item_func_substr(args[0], args[1]); -+ else -+ return new Item_func_substr(args[0], args[1], args[2]); -+} -+ -+ -+static Item *create_func_count(MY_XPATH *xpath, Item **args, uint nargs) -+{ -+ if (args[0]->type() != Item::XPATH_NODESET) -+ return 0; -+ return new Item_func_xpath_count(args[0], xpath->pxml); -+} -+ -+ -+static Item *create_func_sum(MY_XPATH *xpath, Item **args, uint nargs) -+{ -+ if (args[0]->type() != Item::XPATH_NODESET) -+ return 0; -+ return new Item_func_xpath_sum(args[0], xpath->pxml); -+} -+ -+ -+/* -+ Functions names. Separate lists for names with -+ lengths 3,4,5 and 6 for faster lookups. -+*/ -+static MY_XPATH_FUNC my_func_names3[]= -+{ -+ {"sum", 3, 1 , 1 , create_func_sum}, -+ {"not", 3, 1 , 1 , create_func_not}, -+ {0 , 0, 0 , 0, 0} -+}; -+ -+ -+static MY_XPATH_FUNC my_func_names4[]= -+{ -+ {"last", 4, 0, 0, create_func_last}, -+ {"true", 4, 0, 0, create_func_true}, -+ {"name", 4, 0, 1, 0}, -+ {"lang", 4, 1, 1, 0}, -+ {0 , 0, 0, 0, 0} -+}; -+ -+ -+static MY_XPATH_FUNC my_func_names5[]= -+{ -+ {"count", 5, 1, 1, create_func_count}, -+ {"false", 5, 0, 0, create_func_false}, -+ {"floor", 5, 1, 1, create_func_floor}, -+ {"round", 5, 1, 1, create_func_round}, -+ {0 , 0, 0, 0, 0} -+}; -+ -+ -+static MY_XPATH_FUNC my_func_names6[]= -+{ -+ {"concat", 6, 2, 255, create_func_concat}, -+ {"number", 6, 0, 1 , create_func_number}, -+ {"string", 6, 0, 1 , 0}, -+ {0 , 0, 0, 0 , 0} -+}; -+ -+ -+/* Other functions, with name longer than 6, all together */ -+static MY_XPATH_FUNC my_func_names[] = -+{ -+ {"id" , 2 , 1 , 1 , 0}, -+ {"boolean" , 7 , 1 , 1 , create_func_bool}, -+ {"ceiling" , 7 , 1 , 1 , create_func_ceiling}, -+ {"position" , 8 , 0 , 0 , create_func_position}, -+ {"contains" , 8 , 2 , 2 , create_func_contains}, -+ {"substring" , 9 , 2 , 3 , create_func_substr}, -+ {"translate" , 9 , 3 , 3 , 0}, -+ -+ {"local-name" , 10 , 0 , 1 , 0}, -+ {"starts-with" , 11 , 2 , 2 , 0}, -+ {"namespace-uri" , 13 , 0 , 1 , 0}, -+ {"substring-after" , 15 , 2 , 2 , 0}, -+ {"normalize-space" , 15 , 0 , 1 , 0}, -+ {"substring-before" , 16 , 2 , 2 , 0}, -+ -+ {NULL,0,0,0,0} -+}; -+ -+ -+/* -+ Lookup a function by name -+ -+ SYNOPSYS -+ Lookup a function by its name. -+ -+ RETURN -+ Pointer to a MY_XPATH_FUNC variable on success. -+ 0 - on failure. -+ -+*/ -+MY_XPATH_FUNC * -+my_xpath_function(const char *beg, const char *end) -+{ -+ MY_XPATH_FUNC *k, *function_names; -+ uint length= end-beg; -+ switch (length) -+ { -+ case 1: return 0; -+ case 3: function_names= my_func_names3; break; -+ case 4: function_names= my_func_names4; break; -+ case 5: function_names= my_func_names5; break; -+ case 6: function_names= my_func_names6; break; -+ default: function_names= my_func_names; -+ } -+ for (k= function_names; k->name; k++) -+ if (k->create && length == k->length && !strncasecmp(beg, k->name, length)) -+ return k; -+ return NULL; -+} -+ -+ -+/* Initialize a lex analizer token */ -+static void -+my_xpath_lex_init(MY_XPATH_LEX *lex, -+ const char *str, const char *strend) -+{ -+ lex->beg= str; -+ lex->end= strend; -+} -+ -+ -+/* Initialize an XPath query parser */ -+static void -+my_xpath_init(MY_XPATH *xpath) -+{ -+ bzero((void*)xpath, sizeof(xpath[0])); -+} -+ -+ -+/* -+ Some ctype-alike helper functions. Note, we cannot -+ reuse cs->ident_map[], because in Xpath, unlike in SQL, -+ dash character is a valid identifier part. -+*/ -+static int -+my_xident_beg(int c) -+{ -+ return (((c) >= 'a' && (c) <= 'z') || -+ ((c) >= 'A' && (c) <= 'Z') || -+ ((c) == '_')); -+} -+ -+ -+static int -+my_xident_body(int c) -+{ -+ return (((c) >= 'a' && (c) <= 'z') || -+ ((c) >= 'A' && (c) <= 'Z') || -+ ((c) >= '0' && (c) <= '9') || -+ ((c)=='-')); -+} -+ -+ -+static int -+my_xdigit(int c) -+{ -+ return ((c) >= '0' && (c) <= '9'); -+} -+ -+ -+/* -+ Scan the next token -+ -+ SYNOPSYS -+ Scan the next token from the input. -+ lex->term is set to the scanned token type. -+ lex->beg and lex->end are set to the beginnig -+ and to the end of the token. -+ RETURN -+ N/A -+*/ -+static void -+my_xpath_lex_scan(MY_XPATH *xpath, -+ MY_XPATH_LEX *lex, const char *beg, const char *end) -+{ -+ int ch; -+ for ( ; beg < end && *beg == ' ' ; beg++); // skip leading spaces -+ lex->beg= beg; -+ -+ if (beg >= end) -+ { -+ lex->end= beg; -+ lex->term= MY_XPATH_LEX_EOF; // end of line reached -+ return; -+ } -+ ch= *beg++; -+ -+ if (ch > 0 && ch < 128 && simpletok[ch]) -+ { -+ // a token consisting of one character found -+ lex->end= beg; -+ lex->term= ch; -+ return; -+ } -+ -+ if (my_xident_beg(ch)) // ident, or a function call, or a keyword -+ { -+ // scan until the end of the identifier -+ for ( ; beg < end && my_xident_body(*beg); beg++); -+ lex->end= beg; -+ -+ // check if a function call -+ if (*beg == '(' && (xpath->func= my_xpath_function(lex->beg, beg))) -+ { -+ lex->term= MY_XPATH_LEX_FUNC; -+ return; -+ } -+ -+ // check if a keyword -+ lex->term= my_xpath_keyword(xpath, lex->beg, beg); -+ return; -+ } -+ -+ if (my_xdigit(ch)) // a sequence of digits -+ { -+ for ( ; beg < end && my_xdigit(*beg) ; beg++); -+ lex->end= beg; -+ lex->term= MY_XPATH_LEX_DIGITS; -+ return; -+ } -+ -+ if (ch == '"' || ch == '\'') // a string: either '...' or "..." -+ { -+ for ( ; beg < end && *beg != ch ; beg++); -+ if (beg < end) -+ { -+ lex->end= beg+1; -+ lex->term= MY_XPATH_LEX_STRING; -+ return; -+ } -+ else -+ { -+ // unexpected end-of-line, without closing quot sign -+ lex->end= end; -+ lex->term= MY_XPATH_LEX_ERROR; -+ return; -+ } -+ } -+ -+ lex->end= beg; -+ lex->term= MY_XPATH_LEX_ERROR; // unknown character -+ return; -+} -+ -+ -+/* -+ Scan the given token -+ -+ SYNOPSYS -+ Scan the given token and rotate lasttok to prevtok on success. -+ -+ RETURN -+ 1 - success -+ 0 - failure -+*/ -+static int -+my_xpath_parse_term(MY_XPATH *xpath, int term) -+{ -+ if (xpath->lasttok.term == term) -+ { -+ xpath->prevtok= xpath->lasttok; -+ my_xpath_lex_scan(xpath, &xpath->lasttok, -+ xpath->lasttok.end, xpath->query.end); -+ return 1; -+ } -+ return 0; -+} -+ -+ -+/* -+ Scan AxisName -+ -+ SYNOPSYS -+ Scan an axis name and store the scanned axis type into xpath->axis. -+ -+ RETURN -+ 1 - success -+ 0 - failure -+*/ -+static int my_xpath_parse_AxisName(MY_XPATH *xpath) -+{ -+ int rc= my_xpath_parse_term(xpath, MY_XPATH_LEX_AXIS); -+ xpath->axis= xpath->extra; -+ return rc; -+} -+ -+ -+/********************************************* -+** Grammar rules, according to http://www.w3.org/TR/xpath -+** Implemented using recursive descendant method. -+** All the following grammar processing functions accept -+** a signle "xpath" argument and return 1 on success and 0 on error. -+** They also modify "xpath" argument by creating new items. -+*/ -+ -+/* [9] PredicateExpr ::= Expr */ -+#define my_xpath_parse_PredicateExpr(x) my_xpath_parse_Expr((x)) -+ -+/* [14] Expr ::= OrExpr */ -+#define my_xpath_parse_Expr(x) my_xpath_parse_OrExpr((x)) -+ -+static int my_xpath_parse_LocationPath(MY_XPATH *xpath); -+static int my_xpath_parse_AbsoluteLocationPath(MY_XPATH *xpath); -+static int my_xpath_parse_RelativeLocationPath(MY_XPATH *xpath); -+static int my_xpath_parse_AbbreviatedAbsoluteLocationPath(MY_XPATH *xpath); -+static int my_xpath_parse_AbbreviatedStep(MY_XPATH *xpath); -+static int my_xpath_parse_Step(MY_XPATH *xpath); -+static int my_xpath_parse_AxisSpecifier(MY_XPATH *xpath); -+static int my_xpath_parse_NodeTest(MY_XPATH *xpath); -+static int my_xpath_parse_AbbreviatedAxisSpecifier(MY_XPATH *xpath); -+static int my_xpath_parse_NameTest(MY_XPATH *xpath); -+static int my_xpath_parse_FunctionCall(MY_XPATH *xpath); -+static int my_xpath_parse_Number(MY_XPATH *xpath); -+static int my_xpath_parse_FilterExpr(MY_XPATH *xpath); -+static int my_xpath_parse_PathExpr(MY_XPATH *xpath); -+static int my_xpath_parse_OrExpr(MY_XPATH *xpath); -+static int my_xpath_parse_UnaryExpr(MY_XPATH *xpath); -+static int my_xpath_parse_MultiplicativeExpr(MY_XPATH *xpath); -+static int my_xpath_parse_AdditiveExpr(MY_XPATH *xpath); -+static int my_xpath_parse_RelationalExpr(MY_XPATH *xpath); -+static int my_xpath_parse_AndExpr(MY_XPATH *xpath); -+static int my_xpath_parse_EqualityExpr(MY_XPATH *xpath); -+static int my_xpath_parse_VariableReference(MY_XPATH *xpath); -+static int my_xpath_parse_slash_opt_slash(MY_XPATH *xpath); -+ -+ -+/* -+ Scan LocationPath -+ -+ SYNOPSYS -+ -+ [1] LocationPath ::= RelativeLocationPath -+ | AbsoluteLocationPath -+ -+ RETURN -+ 1 - success -+ 0 - failure -+*/ -+static int my_xpath_parse_LocationPath(MY_XPATH *xpath) -+{ -+ Item *context= xpath->context; -+ -+ int rc= my_xpath_parse_RelativeLocationPath(xpath) || -+ my_xpath_parse_AbsoluteLocationPath(xpath); -+ -+ xpath->item= xpath->context; -+ xpath->context= context; -+ return rc; -+} -+ -+ -+/* -+ Scan Absolute Location Path -+ -+ SYNOPSYS -+ -+ [2] AbsoluteLocationPath ::= '/' RelativeLocationPath? -+ | AbbreviatedAbsoluteLocationPath -+ [10] AbbreviatedAbsoluteLocationPath ::= '//' RelativeLocationPath -+ -+ We combine these two rules into one rule for better performance: -+ -+ [2,10] AbsoluteLocationPath ::= '/' RelativeLocationPath? -+ | '//' RelativeLocationPath -+ -+ RETURN -+ 1 - success -+ 0 - failure -+*/ -+static int my_xpath_parse_AbsoluteLocationPath(MY_XPATH *xpath) -+{ -+ if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_SLASH)) -+ return 0; -+ -+ xpath->context= new Item_nodeset_func_rootelement(xpath->pxml); -+ -+ if (my_xpath_parse_term(xpath, MY_XPATH_LEX_SLASH)) -+ { -+ xpath->context= new Item_nodeset_func_descendantbyname(xpath->context, -+ "*", 1, -+ xpath->pxml, 1); -+ return my_xpath_parse_RelativeLocationPath(xpath); -+ } -+ -+ if (my_xpath_parse_RelativeLocationPath(xpath)) -+ return 1; -+ -+ return 1; -+} -+ -+ -+/* -+ Scan Relative Location Path -+ -+ SYNOPSYS -+ -+ For better performance we combine these two rules -+ -+ [3] RelativeLocationPath ::= Step -+ | RelativeLocationPath '/' Step -+ | AbbreviatedRelativeLocationPath -+ [11] AbbreviatedRelativeLocationPath ::= RelativeLocationPath '//' Step -+ -+ -+ Into this one: -+ -+ [3-11] RelativeLocationPath ::= Step -+ | RelativeLocationPath '/' Step -+ | RelativeLocationPath '//' Step -+ RETURN -+ 1 - success -+ 0 - failure -+*/ -+static int my_xpath_parse_RelativeLocationPath(MY_XPATH *xpath) -+{ -+ if (!my_xpath_parse_Step(xpath)) -+ return 0; -+ while (my_xpath_parse_term(xpath, MY_XPATH_LEX_SLASH)) -+ { -+ if (my_xpath_parse_term(xpath, MY_XPATH_LEX_SLASH)) -+ xpath->context= new Item_nodeset_func_descendantbyname(xpath->context, -+ "*", 1, -+ xpath->pxml, 1); -+ if (!my_xpath_parse_Step(xpath)) -+ return 0; -+ } -+ return 1; -+} -+ -+ -+/* -+ Scan non-abbreviated or abbreviated Step -+ -+ SYNOPSYS -+ -+ [4] Step ::= AxisSpecifier NodeTest Predicate* -+ | AbbreviatedStep -+ [8] Predicate ::= '[' PredicateExpr ']' -+ -+ RETURN -+ 1 - success -+ 0 - failure -+*/ -+static int -+my_xpath_parse_AxisSpecifier_NodeTest_opt_Predicate_list(MY_XPATH *xpath) -+{ -+ if (!my_xpath_parse_AxisSpecifier(xpath)) -+ return 0; -+ -+ if (!my_xpath_parse_NodeTest(xpath)) -+ return 0; -+ -+ while (my_xpath_parse_term(xpath, MY_XPATH_LEX_LB)) -+ { -+ Item *prev_context= xpath->context; -+ String *context_cache; -+ context_cache= &((Item_nodeset_func*)xpath->context)->context_cache; -+ xpath->context= new Item_nodeset_context_cache(context_cache, xpath->pxml); -+ xpath->context_cache= context_cache; -+ -+ if(!my_xpath_parse_PredicateExpr(xpath)) -+ return 0; -+ -+ if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_RB)) -+ return 0; -+ -+ xpath->item= nodeset2bool(xpath, xpath->item); -+ -+ if (xpath->item->is_bool_func()) -+ { -+ xpath->context= new Item_nodeset_func_predicate(prev_context, -+ xpath->item, -+ xpath->pxml); -+ } -+ else -+ { -+ xpath->context= new Item_nodeset_func_elementbyindex(prev_context, -+ xpath->item, -+ xpath->pxml); -+ } -+ } -+ return 1; -+} -+ -+ -+static int my_xpath_parse_Step(MY_XPATH *xpath) -+{ -+ return -+ my_xpath_parse_AxisSpecifier_NodeTest_opt_Predicate_list(xpath) || -+ my_xpath_parse_AbbreviatedStep(xpath); -+} -+ -+ -+/* -+ Scan Abbreviated Axis Specifier -+ -+ SYNOPSYS -+ [5] AxisSpecifier ::= AxisName '::' -+ | AbbreviatedAxisSpecifier -+ -+ RETURN -+ 1 - success -+ 0 - failure -+*/ -+static int my_xpath_parse_AbbreviatedAxisSpecifier(MY_XPATH *xpath) -+{ -+ if (my_xpath_parse_term(xpath, MY_XPATH_LEX_AT)) -+ xpath->axis= MY_XPATH_AXIS_ATTRIBUTE; -+ else -+ xpath->axis= MY_XPATH_AXIS_CHILD; -+ return 1; -+} -+ -+ -+/* -+ Scan non-abbreviated axis specifier -+ -+ SYNOPSYS -+ -+ RETURN -+ 1 - success -+ 0 - failure -+*/ -+static int my_xpath_parse_AxisName_colon_colon(MY_XPATH *xpath) -+{ -+ return my_xpath_parse_AxisName(xpath) && -+ my_xpath_parse_term(xpath, MY_XPATH_LEX_COLON) && -+ my_xpath_parse_term(xpath, MY_XPATH_LEX_COLON); -+} -+ -+ -+/* -+ Scan Abbreviated AxisSpecifier -+ -+ SYNOPSYS -+ [13] AbbreviatedAxisSpecifier ::= '@'? -+ -+ RETURN -+ 1 - success -+ 0 - failure -+*/ -+static int my_xpath_parse_AxisSpecifier(MY_XPATH *xpath) -+{ -+ return my_xpath_parse_AxisName_colon_colon(xpath) || -+ my_xpath_parse_AbbreviatedAxisSpecifier(xpath); -+} -+ -+ -+/* -+ Scan NodeType followed by parens -+ -+ SYNOPSYS -+ -+ RETURN -+ 1 - success -+ 0 - failure -+*/ -+static int my_xpath_parse_NodeTest_lp_rp(MY_XPATH *xpath) -+{ -+ return my_xpath_parse_term(xpath, MY_XPATH_LEX_NODETYPE) && -+ my_xpath_parse_term(xpath, MY_XPATH_LEX_LP) && -+ my_xpath_parse_term(xpath, MY_XPATH_LEX_RP); -+} -+ -+ -+/* -+ Scan NodeTest -+ -+ SYNOPSYS -+ -+ [7] NodeTest ::= NameTest -+ | NodeType '(' ')' -+ | 'processing-instruction' '(' Literal ')' -+ RETURN -+ 1 - success -+ 0 - failure -+*/ -+static int my_xpath_parse_NodeTest(MY_XPATH *xpath) -+{ -+ return my_xpath_parse_NameTest(xpath) || -+ my_xpath_parse_NodeTest_lp_rp(xpath); -+} -+ -+ -+/* -+ Scan Abbreviated Step -+ -+ SYNOPSYS -+ -+ [12] AbbreviatedStep ::= '.' | '..' -+ -+ RETURN -+ 1 - success -+ 0 - failure -+*/ -+static int my_xpath_parse_AbbreviatedStep(MY_XPATH *xpath) -+{ -+ if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_DOT)) -+ return 0; -+ if (my_xpath_parse_term(xpath, MY_XPATH_LEX_DOT)) -+ xpath->context= new Item_nodeset_func_parentbyname(xpath->context, "*", 1, -+ xpath->pxml); -+ return 1; -+} -+ -+ -+/* -+ Scan Primary Expression -+ -+ SYNOPSYS -+ -+ [15] PrimaryExpr ::= VariableReference -+ | '(' Expr ')' -+ | Literal -+ | Number -+ | FunctionCall -+ RETURN -+ 1 - success -+ 0 - failure -+*/ -+static int my_xpath_parse_lp_Expr_rp(MY_XPATH *xpath) -+{ -+ return my_xpath_parse_term(xpath, MY_XPATH_LEX_LP) && -+ my_xpath_parse_Expr(xpath) && -+ my_xpath_parse_term(xpath, MY_XPATH_LEX_RP); -+} -+static int my_xpath_parse_PrimaryExpr_literal(MY_XPATH *xpath) -+{ -+ if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_STRING)) -+ return 0; -+ xpath->item= new Item_string(xpath->prevtok.beg + 1, -+ xpath->prevtok.end - xpath->prevtok.beg - 2, -+ xpath->cs); -+ return 1; -+} -+static int my_xpath_parse_PrimaryExpr(MY_XPATH *xpath) -+{ -+ return -+ my_xpath_parse_lp_Expr_rp(xpath) || -+ my_xpath_parse_VariableReference(xpath) || -+ my_xpath_parse_PrimaryExpr_literal(xpath) || -+ my_xpath_parse_Number(xpath) || -+ my_xpath_parse_FunctionCall(xpath); -+} -+ -+ -+/* -+ Scan Function Call -+ -+ SYNOPSYS -+ [16] FunctionCall ::= FunctionName '(' ( Argument ( ',' Argument )* )? ')' -+ [17] Argument ::= Expr -+ -+ RETURN -+ 1 - success -+ 0 - failure -+ -+*/ -+static int my_xpath_parse_FunctionCall(MY_XPATH *xpath) -+{ -+ Item *args[256]; -+ uint nargs; -+ -+ if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_FUNC)) -+ return 0; -+ -+ MY_XPATH_FUNC *func= xpath->func; -+ -+ if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_LP)) -+ return 0; -+ -+ for (nargs= 0 ; nargs < func->maxargs; ) -+ { -+ if (!my_xpath_parse_Expr(xpath)) -+ return 0; -+ args[nargs++]= xpath->item; -+ if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_COMMA)) -+ { -+ if (nargs < func->minargs) -+ return 0; -+ else -+ break; -+ } -+ } -+ if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_RP)) -+ return 0; -+ -+ return ((xpath->item= func->create(xpath, args, nargs))) ? 1 : 0; -+} -+ -+ -+/* -+ Scan Union Expression -+ -+ SYNOPSYS -+ [18] UnionExpr ::= PathExpr -+ | UnionExpr '|' PathExpr -+ -+ RETURN -+ 1 - success -+ 0 - failure -+*/ -+static int my_xpath_parse_UnionExpr(MY_XPATH *xpath) -+{ -+ if (!my_xpath_parse_PathExpr(xpath)) -+ return 0; -+ -+ while (my_xpath_parse_term(xpath, MY_XPATH_LEX_VLINE)) -+ { -+ Item *prev= xpath->item; -+ if (prev->type() != Item::XPATH_NODESET) -+ return 0; -+ -+ if (!my_xpath_parse_PathExpr(xpath) -+ || xpath->item->type() != Item::XPATH_NODESET) -+ return 0; -+ xpath->item= new Item_nodeset_func_union(prev, xpath->item, xpath->pxml); -+ } -+ return 1; -+} -+ -+ -+/* -+ Scan Path Expression -+ -+ SYNOPSYS -+ -+ [19] PathExpr ::= LocationPath -+ | FilterExpr -+ | FilterExpr '/' RelativeLocationPath -+ | FilterExpr '//' RelativeLocationPath -+ RETURN -+ 1 - success -+ 0 - failure -+*/ -+static int -+my_xpath_parse_FilterExpr_opt_slashes_RelativeLocationPath(MY_XPATH *xpath) -+{ -+ if (!my_xpath_parse_FilterExpr(xpath)) -+ return 0; -+ -+ if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_SLASH)) -+ return 1; -+ -+ my_xpath_parse_term(xpath, MY_XPATH_LEX_SLASH); -+ return my_xpath_parse_RelativeLocationPath(xpath); -+} -+static int my_xpath_parse_PathExpr(MY_XPATH *xpath) -+{ -+ return my_xpath_parse_LocationPath(xpath) || -+ my_xpath_parse_FilterExpr_opt_slashes_RelativeLocationPath(xpath); -+} -+ -+ -+ -+/* -+ Scan Filter Expression -+ -+ SYNOPSYS -+ [20] FilterExpr ::= PrimaryExpr -+ | FilterExpr Predicate -+ -+ or in other words: -+ -+ [20] FilterExpr ::= PrimaryExpr Predicate* -+ -+ RETURN -+ 1 - success -+ 0 - failure -+ -+*/ -+static int my_xpath_parse_FilterExpr(MY_XPATH *xpath) -+{ -+ return my_xpath_parse_PrimaryExpr(xpath); -+} -+ -+ -+/* -+ Scan Or Expression -+ -+ SYNOPSYS -+ [21] OrExpr ::= AndExpr -+ | OrExpr 'or' AndExpr -+ -+ RETURN -+ 1 - success -+ 0 - failure -+*/ -+static int my_xpath_parse_OrExpr(MY_XPATH *xpath) -+{ -+ if (!my_xpath_parse_AndExpr(xpath)) -+ return 0; -+ -+ while (my_xpath_parse_term(xpath, MY_XPATH_LEX_OR)) -+ { -+ Item *prev= xpath->item; -+ if (!my_xpath_parse_AndExpr(xpath)) -+ return 0; -+ xpath->item= new Item_cond_or(nodeset2bool(xpath, prev), -+ nodeset2bool(xpath, xpath->item)); -+ } -+ return 1; -+} -+ -+ -+/* -+ Scan And Expression -+ -+ SYNOPSYS -+ [22] AndExpr ::= EqualityExpr -+ | AndExpr 'and' EqualityExpr -+ -+ RETURN -+ 1 - success -+ 0 - failure -+*/ -+static int my_xpath_parse_AndExpr(MY_XPATH *xpath) -+{ -+ if (!my_xpath_parse_EqualityExpr(xpath)) -+ return 0; -+ -+ while (my_xpath_parse_term(xpath, MY_XPATH_LEX_AND)) -+ { -+ Item *prev= xpath->item; -+ if (!my_xpath_parse_EqualityExpr(xpath)) -+ return 0; -+ -+ xpath->item= new Item_cond_and(nodeset2bool(xpath,prev), -+ nodeset2bool(xpath,xpath->item)); -+ } -+ return 1; -+} -+ -+ -+/* -+ Scan Equality Expression -+ -+ SYNOPSYS -+ [23] EqualityExpr ::= RelationalExpr -+ | EqualityExpr '=' RelationalExpr -+ | EqualityExpr '!=' RelationalExpr -+ or in other words: -+ -+ [23] EqualityExpr ::= RelationalExpr ( EqualityOperator EqualityExpr )* -+ -+ RETURN -+ 1 - success -+ 0 - failure -+*/ -+static int my_xpath_parse_ne(MY_XPATH *xpath) -+{ -+ return my_xpath_parse_term(xpath, MY_XPATH_LEX_EXCL) && -+ my_xpath_parse_term(xpath, MY_XPATH_LEX_EQ); -+} -+static int my_xpath_parse_EqualityOperator(MY_XPATH *xpath) -+{ -+ if (my_xpath_parse_ne(xpath)) -+ { -+ xpath->extra= '!'; -+ return 1; -+ } -+ if (my_xpath_parse_term(xpath, MY_XPATH_LEX_EQ)) -+ { -+ xpath->extra= '='; -+ return 1; -+ } -+ return 0; -+} -+static int my_xpath_parse_EqualityExpr(MY_XPATH *xpath) -+{ -+ if (!my_xpath_parse_RelationalExpr(xpath)) -+ return 0; -+ while (my_xpath_parse_EqualityOperator(xpath)) -+ { -+ Item *prev= xpath->item; -+ int oper= xpath->extra; -+ if (!my_xpath_parse_RelationalExpr(xpath)) -+ return 0; -+ -+ if (!(xpath->item= create_comparator(xpath, oper, prev, xpath->item))) -+ return 0; -+ } -+ return 1; -+} -+ -+ -+/* -+ Scan Relational Expression -+ -+ SYNOPSYS -+ -+ [24] RelationalExpr ::= AdditiveExpr -+ | RelationalExpr '<' AdditiveExpr -+ | RelationalExpr '>' AdditiveExpr -+ | RelationalExpr '<=' AdditiveExpr -+ | RelationalExpr '>=' AdditiveExpr -+ or in other words: -+ -+ [24] RelationalExpr ::= AdditiveExpr (RelationalOperator RelationalExpr)* -+ -+ RETURN -+ 1 - success -+ 0 - failure -+*/ -+static int my_xpath_parse_RelationalOperator(MY_XPATH *xpath) -+{ -+ if (my_xpath_parse_term(xpath, MY_XPATH_LEX_LESS)) -+ { -+ xpath->extra= my_xpath_parse_term(xpath, MY_XPATH_LEX_EQ) ? -+ MY_XPATH_LEX_LE : MY_XPATH_LEX_LESS; -+ return 1; -+ } -+ else if (my_xpath_parse_term(xpath, MY_XPATH_LEX_GREATER)) -+ { -+ xpath->extra= my_xpath_parse_term(xpath, MY_XPATH_LEX_EQ) ? -+ MY_XPATH_LEX_GE : MY_XPATH_LEX_GREATER; -+ return 1; -+ } -+ return 0; -+} -+static int my_xpath_parse_RelationalExpr(MY_XPATH *xpath) -+{ -+ if (!my_xpath_parse_AdditiveExpr(xpath)) -+ return 0; -+ while (my_xpath_parse_RelationalOperator(xpath)) -+ { -+ Item *prev= xpath->item; -+ int oper= xpath->extra; -+ -+ if (!my_xpath_parse_AdditiveExpr(xpath)) -+ return 0; -+ -+ if (!(xpath->item= create_comparator(xpath, oper, prev, xpath->item))) -+ return 0; -+ } -+ return 1; -+} -+ -+ -+/* -+ Scan Additive Expression -+ -+ SYNOPSYS -+ -+ [25] AdditiveExpr ::= MultiplicativeExpr -+ | AdditiveExpr '+' MultiplicativeExpr -+ | AdditiveExpr '-' MultiplicativeExpr -+ RETURN -+ 1 - success -+ 0 - failure -+*/ -+static int my_xpath_parse_AdditiveOperator(MY_XPATH *xpath) -+{ -+ return my_xpath_parse_term(xpath, MY_XPATH_LEX_PLUS) || -+ my_xpath_parse_term(xpath, MY_XPATH_LEX_MINUS); -+} -+static int my_xpath_parse_AdditiveExpr(MY_XPATH *xpath) -+{ -+ if (!my_xpath_parse_MultiplicativeExpr(xpath)) -+ return 0; -+ -+ while (my_xpath_parse_AdditiveOperator(xpath)) -+ { -+ int oper= xpath->prevtok.term; -+ Item *prev= xpath->item; -+ if (!my_xpath_parse_MultiplicativeExpr(xpath)) -+ return 0; -+ -+ if (oper == MY_XPATH_LEX_PLUS) -+ xpath->item= new Item_func_plus(prev, xpath->item); -+ else -+ xpath->item= new Item_func_minus(prev, xpath->item); -+ }; -+ return 1; -+} -+ -+ -+/* -+ Scan Multiplicative Expression -+ -+ SYNOPSYS -+ -+ [26] MultiplicativeExpr ::= UnaryExpr -+ | MultiplicativeExpr MultiplyOperator UnaryExpr -+ | MultiplicativeExpr 'div' UnaryExpr -+ | MultiplicativeExpr 'mod' UnaryExpr -+ or in other words: -+ -+ [26] MultiplicativeExpr ::= UnaryExpr (MulOper MultiplicativeExpr)* -+ -+ RETURN -+ 1 - success -+ 0 - failure -+*/ -+static int my_xpath_parse_MultiplicativeOperator(MY_XPATH *xpath) -+{ -+ return -+ my_xpath_parse_term(xpath, MY_XPATH_LEX_ASTERISK) || -+ my_xpath_parse_term(xpath, MY_XPATH_LEX_DIV) || -+ my_xpath_parse_term(xpath, MY_XPATH_LEX_MOD); -+} -+static int my_xpath_parse_MultiplicativeExpr(MY_XPATH *xpath) -+{ -+ if (!my_xpath_parse_UnaryExpr(xpath)) -+ return 0; -+ -+ while (my_xpath_parse_MultiplicativeOperator(xpath)) -+ { -+ int oper= xpath->prevtok.term; -+ Item *prev= xpath->item; -+ if (!my_xpath_parse_UnaryExpr(xpath)) -+ return 0; -+ switch (oper) -+ { -+ case MY_XPATH_LEX_ASTERISK: -+ xpath->item= new Item_func_mul(prev, xpath->item); -+ break; -+ case MY_XPATH_LEX_DIV: -+ xpath->item= new Item_func_int_div(prev, xpath->item); -+ break; -+ case MY_XPATH_LEX_MOD: -+ xpath->item= new Item_func_mod(prev, xpath->item); -+ break; -+ } -+ } -+ return 1; -+} -+ -+ -+/* -+ Scan Unary Expression -+ -+ SYNOPSYS -+ -+ [27] UnaryExpr ::= UnionExpr -+ | '-' UnaryExpr -+ RETURN -+ 1 - success -+ 0 - failure -+*/ -+static int my_xpath_parse_UnaryExpr(MY_XPATH *xpath) -+{ -+ if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_MINUS)) -+ return my_xpath_parse_UnionExpr(xpath); -+ if (!my_xpath_parse_UnaryExpr(xpath)) -+ return 0; -+ xpath->item= new Item_func_neg(xpath->item); -+ return 1; -+} -+ -+ -+/* -+ Scan Number -+ -+ SYNOPSYS -+ -+ [30] Number ::= Digits ('.' Digits?)? | '.' Digits) -+ -+ or in other words: -+ -+ [30] Number ::= Digits -+ | Digits '.' -+ | Digits '.' Digits -+ | '.' Digits -+ -+ Note: the last rule is not supported yet, -+ as it is in conflict with abbreviated step. -+ 1 + .123 does not work, -+ 1 + 0.123 does. -+ Perhaps it is better to move this code into lex analizer. -+ -+ RETURN -+ 1 - success -+ 0 - failure -+*/ -+static int my_xpath_parse_Number(MY_XPATH *xpath) -+{ -+ const char *beg; -+ if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_DIGITS)) -+ return 0; -+ beg= xpath->prevtok.beg; -+ if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_DOT)) -+ { -+ xpath->item= new Item_int(xpath->prevtok.beg, -+ xpath->prevtok.end - xpath->prevtok.beg); -+ return 1; -+ } -+ my_xpath_parse_term(xpath, MY_XPATH_LEX_DIGITS); -+ -+ xpath->item= new Item_float(beg, xpath->prevtok.end - beg); -+ return 1; -+} -+ -+ -+/* -+ Scan Variable reference -+ -+ SYNOPSYS -+ -+ [36] VariableReference ::= '$' QName -+ RETURN -+ 1 - success -+ 0 - failure -+*/ -+static int -+my_xpath_parse_VariableReference(MY_XPATH *xpath) -+{ -+ return my_xpath_parse_term(xpath, MY_XPATH_LEX_DOLLAR) && -+ my_xpath_parse_term(xpath, MY_XPATH_LEX_IDENT); -+} -+ -+ -+/* -+ Scan Name Test -+ -+ SYNOPSYS -+ -+ [37] NameTest ::= '*' -+ | NCName ':' '*' -+ | QName -+ RETURN -+ 1 - success -+ 0 - failure -+*/ -+static int -+my_xpath_parse_NodeTest_QName(MY_XPATH *xpath) -+{ -+ if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_IDENT)) -+ return 0; -+ DBUG_ASSERT(xpath->context); -+ uint len= xpath->prevtok.end - xpath->prevtok.beg; -+ xpath->context= nametestfunc(xpath, xpath->axis, xpath->context, -+ xpath->prevtok.beg, len); -+ return 1; -+} -+static int -+my_xpath_parse_NodeTest_asterisk(MY_XPATH *xpath) -+{ -+ if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_ASTERISK)) -+ return 0; -+ DBUG_ASSERT(xpath->context); -+ xpath->context= nametestfunc(xpath, xpath->axis, xpath->context, "*", 1); -+ return 1; -+} -+static int -+my_xpath_parse_NameTest(MY_XPATH *xpath) -+{ -+ return my_xpath_parse_NodeTest_asterisk(xpath) || -+ my_xpath_parse_NodeTest_QName(xpath); -+} -+ -+ -+/* -+ Scan an XPath expression -+ -+ SYNOPSYS -+ Scan xpath expression. -+ The expression is returned in xpath->expr. -+ -+ RETURN -+ 1 - success -+ 0 - failure -+*/ -+static int -+my_xpath_parse(MY_XPATH *xpath, const char *str, const char *strend) -+{ -+ my_xpath_lex_init(&xpath->query, str, strend); -+ my_xpath_lex_init(&xpath->prevtok, str, strend); -+ my_xpath_lex_scan(xpath, &xpath->lasttok, str, strend); -+ -+ return -+ my_xpath_parse_Expr(xpath) && -+ my_xpath_parse_term(xpath, MY_XPATH_LEX_EOF); -+} -+ -+ -+void Item_xml_str_func::fix_length_and_dec() -+{ -+ String *xp, tmp; -+ MY_XPATH xpath; -+ int rc; -+ -+ nodeset_func= 0; -+ -+ if (agg_arg_charsets(collation, args, arg_count, MY_COLL_CMP_CONV)) -+ return; -+ -+ if (collation.collation->mbminlen > 1) -+ { -+ /* UCS2 is not supported */ -+ my_printf_error(ER_UNKNOWN_ERROR, -+ "Character set '%s' is not supported by XPATH", -+ MYF(0), collation.collation->csname); -+ return; -+ } -+ -+ if (!args[1]->const_item()) -+ { -+ my_printf_error(ER_UNKNOWN_ERROR, -+ "Only constant XPATH queries are supported", MYF(0)); -+ return; -+ } -+ -+ xp= args[1]->val_str(&tmp); -+ my_xpath_init(&xpath); -+ xpath.cs= collation.collation; -+ xpath.debug= 0; -+ xpath.pxml= &pxml; -+ -+ rc= my_xpath_parse(&xpath, xp->ptr(), xp->ptr() + xp->length()); -+ -+ if (!rc) -+ { -+ char context[32]; -+ uint clen= xpath.query.end - xpath.lasttok.beg; -+ set_if_bigger(clen, sizeof(context) - 1); -+ memcpy(context, xpath.lasttok.beg, clen); -+ context[clen]= '\0'; -+ my_printf_error(ER_UNKNOWN_ERROR, "XPATH syntax error: '%s'", -+ MYF(0), context); -+ return; -+ } -+ -+ nodeset_func= xpath.item; -+ if (nodeset_func) -+ nodeset_func->fix_fields(current_thd, 0, &nodeset_func); -+ max_length= MAX_BLOB_WIDTH; -+} -+ -+ -+#define MAX_LEVEL 256 -+typedef struct -+{ -+ uint level; -+ String *pxml; // parsed XML -+ uint pos[MAX_LEVEL]; // Tag position stack -+} MY_XML_USER_DATA; -+ -+ -+/* -+ Find the parent node -+ -+ SYNOPSYS -+ Find the parent node, i.e. a tag or attrubute node on the given level. -+ -+ RETURN -+ 1 - success -+ 0 - failure -+*/ -+static uint xml_parent_tag(MY_XML_NODE *items, uint nitems, uint level) -+{ -+ if (!nitems) -+ return 0; -+ -+ MY_XML_NODE *p, *last= &items[nitems-1]; -+ for (p= last; p >= items; p--) -+ { -+ if (p->level == level && -+ (p->type == MY_XML_NODE_TAG || -+ p->type == MY_XML_NODE_ATTR)) -+ { -+ return p - items; -+ } -+ } -+ return 0; -+} -+ -+ -+/* -+ Process tag beginning -+ -+ SYNOPSYS -+ -+ A call-back function executed when XML parser -+ is entering a tag or an attribue. -+ Appends the new node into data->pxml. -+ Increments data->level. -+ -+ RETURN -+ Currently only MY_XML_OK -+*/ -+static int xml_enter(MY_XML_PARSER *st,const char *attr, uint len) -+{ -+ MY_XML_USER_DATA *data= (MY_XML_USER_DATA*)st->user_data; -+ MY_XML_NODE *nodes= (MY_XML_NODE*) data->pxml->ptr(); -+ uint numnodes= data->pxml->length() / sizeof(MY_XML_NODE); -+ uint parent= xml_parent_tag(nodes, numnodes, data->level - 1); -+ MY_XML_NODE node; -+ -+ data->pos[data->level]= numnodes; -+ node.level= data->level++; -+ node.type= st->current_node_type; // TAG or ATTR -+ node.beg= attr; -+ node.end= attr + len; -+ node.parent= parent; -+ data->pxml->append((const char*) &node, sizeof(MY_XML_NODE)); -+ return MY_XML_OK; -+} -+ -+ -+/* -+ Process text node -+ -+ SYNOPSYS -+ -+ A call-back function executed when XML parser -+ is entering into a tag or an attribue textual value. -+ The value is appended into data->pxml. -+ -+ RETURN -+ Currently only MY_XML_OK -+*/ -+static int xml_value(MY_XML_PARSER *st,const char *attr, uint len) -+{ -+ MY_XML_USER_DATA *data= (MY_XML_USER_DATA*)st->user_data; -+ MY_XML_NODE *nodes= (MY_XML_NODE*) data->pxml->ptr(); -+ uint numnodes= data->pxml->length() / sizeof(MY_XML_NODE); -+ uint parent= xml_parent_tag(nodes, numnodes, data->level - 1); -+ MY_XML_NODE node; -+ -+ node.level= data->level; -+ node.type= MY_XML_NODE_TEXT; -+ node.beg= attr; -+ node.end= attr + len; -+ node.parent= parent; -+ data->pxml->append((const char*) &node, sizeof(MY_XML_NODE)); -+ return MY_XML_OK; -+} -+ -+ -+/* -+ Leave a tag or an attribute -+ -+ SYNOPSYS -+ -+ A call-back function executed when XML parser -+ is leaving a tag or an attribue. -+ Decrements data->level. -+ -+ RETURN -+ Currently only MY_XML_OK -+*/ -+static int xml_leave(MY_XML_PARSER *st,const char *attr, uint len) -+{ -+ MY_XML_USER_DATA *data= (MY_XML_USER_DATA*)st->user_data; -+ DBUG_ASSERT(data->level > 0); -+ data->level--; -+ -+ MY_XML_NODE *nodes= (MY_XML_NODE*) data->pxml->ptr(); -+ nodes+= data->pos[data->level]; -+ nodes->tagend= st->cur; -+ -+ return MY_XML_OK; -+} -+ -+ -+/* -+ Parse raw XML -+ -+ SYNOPSYS -+ -+ -+ RETURN -+ Currently pointer to parsed XML on success -+ 0 on parse error -+*/ -+String *Item_xml_str_func::parse_xml(String *raw_xml, String *parsed_xml_buf) -+{ -+ MY_XML_PARSER p; -+ MY_XML_USER_DATA user_data; -+ int rc; -+ -+ parsed_xml_buf->length(0); -+ -+ /* Prepare XML parser */ -+ my_xml_parser_create(&p); -+ p.flags= MY_XML_FLAG_RELATIVE_NAMES | MY_XML_FLAG_SKIP_TEXT_NORMALIZATION; -+ user_data.level= 0; -+ user_data.pxml= parsed_xml_buf; -+ my_xml_set_enter_handler(&p, xml_enter); -+ my_xml_set_value_handler(&p, xml_value); -+ my_xml_set_leave_handler(&p, xml_leave); -+ my_xml_set_user_data(&p, (void*) &user_data); -+ -+ /* Add root node */ -+ p.current_node_type= MY_XML_NODE_TAG; -+ xml_enter(&p, raw_xml->ptr(), 0); -+ -+ /* Execute XML parser */ -+ rc= my_xml_parse(&p, raw_xml->ptr(), raw_xml->length()); -+ my_xml_parser_free(&p); -+ -+ return rc == MY_XML_OK ? parsed_xml_buf : 0; -+} -+ -+ -+String *Item_func_xml_extractvalue::val_str(String *str) -+{ -+ String *res; -+ if (!nodeset_func || -+ !(res= args[0]->val_str(str)) || -+ !parse_xml(res, &pxml)) -+ { -+ null_value= 1; -+ return 0; -+ } -+ res= nodeset_func->val_str(&tmp_value); -+ return res; -+} -+ -+ -+String *Item_func_xml_update::val_str(String *str) -+{ -+ String *res, *nodeset, *rep; -+ -+ if (!nodeset_func || -+ !(res= args[0]->val_str(str)) || -+ !(rep= args[2]->val_str(&tmp_value3)) || -+ !parse_xml(res, &pxml) || -+ !(nodeset= nodeset_func->val_nodeset(&tmp_value2))) -+ { -+ null_value= 1; -+ return 0; -+ } -+ -+ MY_XML_NODE *nodebeg= (MY_XML_NODE*) pxml.ptr(); -+ MY_XML_NODE *nodeend= (MY_XML_NODE*) pxml.ptr() + pxml.length(); -+ MY_XPATH_FLT *fltbeg= (MY_XPATH_FLT*) nodeset->ptr(); -+ MY_XPATH_FLT *fltend= (MY_XPATH_FLT*) (nodeset->ptr() + nodeset->length()); -+ -+ /* Allow replacing of one tag only */ -+ if (fltend - fltbeg != 1) -+ { -+ /* TODO: perhaps add a warning that more than one tag selected */ -+ return res; -+ } -+ -+ nodebeg+= fltbeg->num; -+ -+ tmp_value.length(0); -+ tmp_value.set_charset(collation.collation); -+ uint offs= nodebeg->type == MY_XML_NODE_TAG ? 1 : 0; -+ tmp_value.append(res->ptr(), nodebeg->beg - res->ptr() - offs); -+ tmp_value.append(rep->ptr(), rep->length()); -+ const char *end= nodebeg->tagend + offs; -+ tmp_value.append(end, res->ptr() + res->length() - end); -+ return &tmp_value; -+} -diff -Naur mysql.orig/sql/item_xmlfunc.h mysql.xml/sql/item_xmlfunc.h ---- mysql.orig/sql/item_xmlfunc.h 1970-01-01 01:00:00.000000000 +0100 -+++ mysql.xml/sql/item_xmlfunc.h 2005-04-13 07:03:10.000000000 +0200 -@@ -0,0 +1,54 @@ -+/* Copyright (C) 2000-2005 MySQL AB -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 2 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the Free Software -+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -+ -+ -+/* This file defines all XML functions */ -+ -+ -+#ifdef __GNUC__ -+#pragma interface /* gcc class implementation */ -+#endif -+ -+ -+class Item_xml_str_func: public Item_str_func -+{ -+protected: -+ String tmp_value, pxml; -+ Item *nodeset_func; -+public: -+ Item_xml_str_func(Item *a, Item *b): Item_str_func(a,b) {} -+ Item_xml_str_func(Item *a, Item *b, Item *c): Item_str_func(a,b,c) {} -+ void fix_length_and_dec(); -+ String *parse_xml(String *raw_xml, String *parsed_xml_buf); -+}; -+ -+ -+class Item_func_xml_extractvalue: public Item_xml_str_func -+{ -+public: -+ Item_func_xml_extractvalue(Item *a,Item *b) :Item_xml_str_func(a,b) {} -+ String *val_str(String *); -+}; -+ -+ -+class Item_func_xml_update: public Item_xml_str_func -+{ -+ String tmp_value2, tmp_value3; -+public: -+ Item_func_xml_update(Item *a,Item *b,Item *c) :Item_xml_str_func(a,b,c) {} -+ String *val_str(String *); -+}; -+ -diff -Naur mysql.orig/sql/lex.h mysql.xml/sql/lex.h ---- mysql.orig/sql/lex.h 2005-05-15 06:16:51.000000000 +0200 -+++ mysql.xml/sql/lex.h 2005-05-20 15:19:29.000000000 +0200 -@@ -607,6 +607,7 @@ - { "EQUALS", F_SYM(FUNC_ARG2),0,CREATE_FUNC_GEOM(create_func_equals)}, - { "EXTERIORRING", F_SYM(FUNC_ARG1),0,CREATE_FUNC_GEOM(create_func_exteriorring)}, - { "EXTRACT", SYM(EXTRACT_SYM)}, -+ { "EXTRACTVALUE", F_SYM(FUNC_ARG2),0,CREATE_FUNC(create_func_xml_extractvalue)}, - { "EXP", F_SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_exp)}, - { "EXPORT_SET", SYM(EXPORT_SET)}, - { "FIELD", SYM(FIELD_FUNC)}, /* For compability */ -@@ -759,6 +760,7 @@ - { "UNHEX", F_SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_unhex)}, - { "UNIQUE_USERS", SYM(UNIQUE_USERS)}, - { "UNIX_TIMESTAMP", SYM(UNIX_TIMESTAMP)}, -+ { "UPDATEXML", F_SYM(FUNC_ARG3),0,CREATE_FUNC(create_func_xml_update)}, - { "UPPER", F_SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_ucase)}, - { "UUID", F_SYM(FUNC_ARG0),0,CREATE_FUNC(create_func_uuid)}, - { "VARIANCE", SYM(VARIANCE_SYM)}, -diff -Naur mysql.orig/strings/xml.c mysql.xml/strings/xml.c ---- mysql.orig/strings/xml.c 2005-05-15 06:16:51.000000000 +0200 -+++ mysql.xml/strings/xml.c 2005-05-20 15:19:29.000000000 +0200 -@@ -104,7 +104,8 @@ - a->end=p->cur; - if (a->beg[0]==p->cur[0])p->cur++; - a->beg++; -- my_xml_norm_text(a); -+ if (!(p->flags & MY_XML_FLAG_SKIP_TEXT_NORMALIZATION)) -+ my_xml_norm_text(a); - lex=MY_XML_STRING; - } - else -@@ -148,7 +149,11 @@ - memcpy(st->attrend,str,len); - st->attrend+=len; - st->attrend[0]='\0'; -- return st->enter ? st->enter(st,st->attr,st->attrend-st->attr) : MY_XML_OK; -+ -+ if (st->flags & MY_XML_FLAG_RELATIVE_NAMES) -+ return st->enter ? st->enter(st, str, len) : MY_XML_OK; -+ else -+ return st->enter ? st->enter(st,st->attr,st->attrend-st->attr) : MY_XML_OK; - } - - -@@ -167,7 +172,7 @@ - char s[32]; - char g[32]; - int rc; -- -+ - /* Find previous '.' or beginning */ - for( e=p->attrend; (e>p->attr) && (e[0]!='.') ; e--); - glen = (e[0]=='.') ? (p->attrend-e-1) : p->attrend-e; -@@ -179,9 +184,12 @@ - sprintf(p->errstr,"'</%s>' unexpected ('</%s>' wanted)",s,g); - return MY_XML_ERROR; - } -- -- rc = p->leave_xml ? p->leave_xml(p,p->attr,p->attrend-p->attr) : MY_XML_OK; -- -+ -+ if (p->flags & MY_XML_FLAG_RELATIVE_NAMES) -+ rc= p->leave_xml ? p->leave_xml(p, str, slen) : MY_XML_OK; -+ else -+ rc= p->leave_xml ? p->leave_xml(p,p->attr,p->attrend-p->attr) : MY_XML_OK; -+ - *e='\0'; - p->attrend=e; - -@@ -240,6 +248,7 @@ - - if (MY_XML_IDENT==lex) - { -+ p->current_node_type= MY_XML_NODE_TAG; - if(MY_XML_OK!=my_xml_enter(p,a.beg,a.end-a.beg)) - return MY_XML_ERROR; - } -@@ -258,6 +267,7 @@ - lex=my_xml_scan(p,&b); - if ( (lex==MY_XML_IDENT) || (lex==MY_XML_STRING) ) - { -+ p->current_node_type= MY_XML_NODE_ATTR; - if((MY_XML_OK!=my_xml_enter(p,a.beg,a.end-a.beg)) || - (MY_XML_OK!=my_xml_value(p,b.beg,b.end-b.beg)) || - (MY_XML_OK!=my_xml_leave(p,a.beg,a.end-a.beg))) -@@ -272,6 +282,7 @@ - } - else if ( (MY_XML_STRING==lex) || (MY_XML_IDENT==lex) ) - { -+ p->current_node_type= MY_XML_NODE_ATTR; - if((MY_XML_OK!=my_xml_enter(p,a.beg,a.end-a.beg)) || - (MY_XML_OK!=my_xml_leave(p,a.beg,a.end-a.beg))) - return MY_XML_ERROR; -@@ -318,7 +329,8 @@ - for ( ; (p->cur < p->end) && (p->cur[0]!='<') ; p->cur++); - a.end=p->cur; - -- my_xml_norm_text(&a); -+ if (!(p->flags & MY_XML_FLAG_SKIP_TEXT_NORMALIZATION)) -+ my_xml_norm_text(&a); - if (a.beg!=a.end) - { - my_xml_value(p,a.beg,a.end-a.beg); diff --git a/070_all_make-test.patch b/070_all_make-test.patch deleted file mode 100644 index 7bb65c9..0000000 --- a/070_all_make-test.patch +++ /dev/null @@ -1,14 +0,0 @@ -###MY_VER_RANGE [5.0.6_beta,5.0.6_beta] [5.1.0_alpha20050531,5.1.0_alpha20050531] ---- mysql.Makefile.am/Makefile.am 2005-06-02 22:44:41.000000000 +0200 -+++ mysql-5.0.6-beta/Makefile.am 2005-06-02 22:46:19.000000000 +0200 -@@ -104,8 +104,8 @@ - - test-force: - cd mysql-test; \ -- mysql-test-run --force ;\ -- mysql-test-run --ps-protocol --force -+ ./mysql-test-run --force ;\ -+ ./mysql-test-run --ps-protocol --force - - # Don't update the files from bitkeeper - %::SCCS/s.% diff --git a/080_all_slot_script-r0.patch b/080_all_slot_script-r0.patch new file mode 100644 index 0000000..35652e3 --- /dev/null +++ b/080_all_slot_script-r0.patch @@ -0,0 +1,359 @@ +diff -Naur mysql4.old/scripts/Makefile.am mysql4.new/scripts/Makefile.am +--- mysql4.old/scripts/Makefile.am 2005-09-02 22:38:04.000000000 +0000 ++++ mysql4.new/scripts/Makefile.am 2005-11-15 18:20:49.000000000 +0000 +@@ -64,6 +64,16 @@ + mysqlaccess.conf \ + mysqlbug + ++# list of names to be replaced in the .sh scripts (full list of executables) ++EXTRA_REPLACE_BIN = mysqld \ ++ mysql mysqladmin mysqlcheck mysqlshow mysqldump \ ++ mysqlimport mysqltest mysqlbinlog mysqlmanagerc mysqlmanager-pwgen \ ++ replace comp_err perror resolveip my_print_defaults resolve_stack_dump \ ++ mysql_install mysql_waitpid \ ++ isamchk isamlog pack_isam \ ++ myisamchk myisamlog myisampack myisam_ftdump \ ++ mysqlmanager ++ + # mysqlbug should be distributed built so that people can report build + # failures with it. + CLEANFILES = @server_scripts@ \ +@@ -91,9 +101,18 @@ + + SUFFIXES = .sh + ++# also replace mybin_* with the appropriate binary name + .sh: + @RM@ -f $@ $@-t ++ bin_REPLACE='';\ ++ list='$(EXTRA_SCRIPTS) $(EXTRA_REPLACE_BIN)'; \ ++ for p in $${list}; do \ ++ f1=$${p/\.sh}; \ ++ f2=`echo "$${p}" | sed 's|^.*/||;$(transform)'`; \ ++ bin_REPLACE="$${bin_REPLACE}s!@mybin_$${f1}@!$${f2}!g;";\ ++ done; \ + @SED@ \ ++ -e "$${bin_REPLACE}" \ + -e 's!@''bindir''@!$(bindir)!g' \ + -e 's!@''sbindir''@!$(sbindir)!g' \ + -e 's!@''scriptdir''@!$(bindir)!g' \ +diff -Naur mysql4.old/scripts/msql2mysql.sh mysql4.new/scripts/msql2mysql.sh +--- mysql4.old/scripts/msql2mysql.sh 2005-09-02 22:38:10.000000000 +0000 ++++ mysql4.new/scripts/msql2mysql.sh 2005-11-15 16:53:23.000000000 +0000 +@@ -13,4 +13,4 @@ + # described in the License. Among other things, the License requires that + # the copyright notice and this notice be preserved on all copies. + +-@bindir@/replace msqlConnect mysql_connect msqlListDBs mysql_list_dbs msqlNumRows mysql_num_rows msqlFetchRow mysql_fetch_row msqlFetchField mysql_fetch_field msqlFreeResult mysql_free_result msqlListFields mysql_list_fields msqlListTables mysql_list_tables msqlErrMsg 'mysql_error(mysql)' msqlStoreResult mysql_store_result msqlQuery mysql_query msqlField mysql_field msqlSelect mysql_select msqlSelectDB mysql_select_db msqlNumFields mysql_num_fields msqlClose mysql_close msqlDataSeek mysql_data_seek m_field MYSQL_FIELD m_result MYSQL_RES m_row MYSQL_ROW msql mysql mSQL mySQL MSQL MYSQL msqlCreateDB mysql_create_db msqlDropDB mysql_drop_db msqlFieldSeek mysql_field_seek -- $* ++@bindir@/@mybin_replace@ msqlConnect mysql_connect msqlListDBs mysql_list_dbs msqlNumRows mysql_num_rows msqlFetchRow mysql_fetch_row msqlFetchField mysql_fetch_field msqlFreeResult mysql_free_result msqlListFields mysql_list_fields msqlListTables mysql_list_tables msqlErrMsg 'mysql_error(mysql)' msqlStoreResult mysql_store_result msqlQuery mysql_query msqlField mysql_field msqlSelect mysql_select msqlSelectDB mysql_select_db msqlNumFields mysql_num_fields msqlClose mysql_close msqlDataSeek mysql_data_seek m_field MYSQL_FIELD m_result MYSQL_RES m_row MYSQL_ROW msql mysql mSQL mySQL MSQL MYSQL msqlCreateDB mysql_create_db msqlDropDB mysql_drop_db msqlFieldSeek mysql_field_seek -- $* +diff -Naur mysql4.old/scripts/mysql_config.sh mysql4.new/scripts/mysql_config.sh +--- mysql4.old/scripts/mysql_config.sh 2005-09-02 22:37:59.000000000 +0000 ++++ mysql4.new/scripts/mysql_config.sh 2005-11-15 16:56:31.000000000 +0000 +@@ -69,7 +69,7 @@ + + me=`get_full_path $0` + +-basedir=`echo $me | sed -e 's;/bin/mysql_config;;'` ++basedir=`echo $me | sed -e 's;/bin/@mybin_mysql_config@;;'` + + ldata='@localstatedir@' + execdir='@libexecdir@' +diff -Naur mysql4.old/scripts/mysql_fix_privilege_tables.sh mysql4.new/scripts/mysql_fix_privilege_tables.sh +--- mysql4.old/scripts/mysql_fix_privilege_tables.sh 2005-09-02 22:38:09.000000000 +0000 ++++ mysql4.new/scripts/mysql_fix_privilege_tables.sh 2005-11-15 17:00:07.000000000 +0000 +@@ -74,7 +74,7 @@ + parse_arguments "$@" + + if test -z "$cmd"; then +- cmd="$bindir/mysql --no-defaults --force --user=$user --host=$host" ++ cmd="$bindir/@mybin_mysql@ --no-defaults --force --user=$user --host=$host" + if test ! -z "$root_password"; then + cmd="$cmd --password=$root_password" + fi +diff -Naur mysql4.old/scripts/mysql_install_db.sh mysql4.new/scripts/mysql_install_db.sh +--- mysql4.old/scripts/mysql_install_db.sh 2005-09-02 22:38:00.000000000 +0000 ++++ mysql4.new/scripts/mysql_install_db.sh 2005-11-15 17:06:13.000000000 +0000 +@@ -61,20 +61,20 @@ + + # Get first arguments from the my.cfg file, groups [mysqld] and + # [mysql_install_db], and then merge with the command line arguments +-if test -x ./bin/my_print_defaults ++if test -x ./bin/@mybin_my_print_defaults@ + then +- print_defaults="./bin/my_print_defaults" +-elif test -x ./extra/my_print_defaults ++ print_defaults="./bin/@mybin_my_print_defaults@" ++elif test -x ./extra/@mybin_my_print_defaults@ + then +- print_defaults="./extra/my_print_defaults" +-elif test -x @bindir@/my_print_defaults ++ print_defaults="./extra/@mybin_my_print_defaults@" ++elif test -x @bindir@/@mybin_my_print_defaults@ + then +- print_defaults="@bindir@/my_print_defaults" +-elif test -x @bindir@/mysql_print_defaults ++ print_defaults="@bindir@/@mybin_my_print_defaults@" ++elif test -x @bindir@/@mybin_mysql_print_defaults@ + then +- print_defaults="@bindir@/mysql_print_defaults" ++ print_defaults="@bindir@/@mybin_mysql_print_defaults@" + else +- print_defaults="my_print_defaults" ++ print_defaults="@mybin_my_print_defaults@" + fi + + args= +@@ -95,10 +95,10 @@ + pkgdatadir=@pkgdatadir@ + else + bindir="$basedir/bin" +-if test -x "$basedir/libexec/mysqld" ++if test -x "$basedir/libexec/@mybin_mysqld@" + then + execdir="$basedir/libexec" +-elif test -x "$basedir/sbin/mysqld" ++elif test -x "$basedir/sbin/@mybin_mysqld@" + then + execdir="$basedir/sbin" + else +@@ -107,7 +107,7 @@ + fi + + mdata=$ldata/mysql +-mysqld=$execdir/mysqld ++mysqld=$execdir/@mybin_mysqld@ + mysqld_opt="" + scriptdir=$bindir + +@@ -137,14 +137,14 @@ + # Check if hostname is valid + if test "$windows" = 0 -a "$in_rpm" = 0 -a $force = 0 + then +- resolved=`$bindir/resolveip $hostname 2>&1` ++ resolved=`$bindir/@mybin_resolveip@ $hostname 2>&1` + if [ $? -ne 0 ] + then +- resolved=`$bindir/resolveip localhost 2>&1` ++ resolved=`$bindir/@mybin_resolveip@ localhost 2>&1` + if [ $? -ne 0 ] + then + echo "Neither host '$hostname' nor 'localhost' could not be looked up with" +- echo "$bindir/resolveip" ++ echo "$bindir/@mybin_resolveip@" + echo "Please configure the 'hostname' command to return a correct hostname." + echo "If you want to solve this at a later stage, restart this script with" + echo "the --force option" +@@ -371,8 +371,8 @@ + fi + echo "PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !" + echo "To do so, start the server, then issue the following commands:" +- echo "$bindir/mysqladmin -u root password 'new-password'" +- echo "$bindir/mysqladmin -u root -h $hostname password 'new-password'" ++ echo "$bindir/@mybin_mysqladmin@ -u root password 'new-password'" ++ echo "$bindir/@mybin_mysqladmin@ -u root -h $hostname password 'new-password'" + echo "See the manual for more instructions." + # + # Print message about upgrading unless we have created a new db table. +@@ -380,14 +380,14 @@ + then + echo + echo "NOTE: If you are upgrading from a MySQL <= 3.22.10 you should run" +- echo "the $bindir/mysql_fix_privilege_tables. Otherwise you will not be" ++ echo "the $bindir/@mybin_mysql_fix_privilege_tables@. Otherwise you will not be" + echo "able to use the new GRANT command!" + fi + echo + if test "$in_rpm" = "0" + then + echo "You can start the MySQL daemon with:" +- echo "cd @prefix@ ; $bindir/mysqld_safe &" ++ echo "cd @prefix@ ; $bindir/@mybin_mysqld_safe@ &" + echo + echo "You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:" + echo "cd sql-bench ; perl run-all-tests" +@@ -405,12 +405,12 @@ + echo + echo "Examine the logs in $ldata for more information." + echo "You can also try to start the mysqld daemon with:" +- echo "$execdir/mysqld --skip-grant &" ++ echo "$execdir/@mybin_mysqld@ --skip-grant &" + echo "You can use the command line tool" +- echo "$bindir/mysql to connect to the mysql" ++ echo "$bindir/@mybin_mysql@ to connect to the mysql" + echo "database and look at the grant tables:" + echo +- echo "shell> $bindir/mysql -u root mysql" ++ echo "shell> $bindir/@mybin_mysql@ -u root mysql" + echo "mysql> show tables" + echo + echo "Try 'mysqld --help' if you have problems with paths. Using --log" +diff -Naur mysql4.old/scripts/mysql_secure_installation.sh mysql4.new/scripts/mysql_secure_installation.sh +--- mysql4.old/scripts/mysql_secure_installation.sh 2005-09-02 22:37:55.000000000 +0000 ++++ mysql4.new/scripts/mysql_secure_installation.sh 2005-11-15 17:10:03.000000000 +0000 +@@ -30,7 +30,7 @@ + + do_query() { + echo $1 >$command +- mysql --defaults-file=$config <$command ++ @mybin_mysql@ --defaults-file=$config <$command + return $? + } + +diff -Naur mysql4.old/scripts/mysqlaccess.sh mysql4.new/scripts/mysqlaccess.sh +--- mysql4.old/scripts/mysqlaccess.sh 2005-09-02 22:37:59.000000000 +0000 ++++ mysql4.new/scripts/mysqlaccess.sh 2005-11-15 17:14:48.000000000 +0000 +@@ -17,7 +17,7 @@ + + # **************************** + # information on MySQL +- $MYSQL = '@bindir@/mysql'; # path to mysql executable ++ $MYSQL = '@bindir@/@mybin_mysql@'; # path to mysql executable + $SERVER = '3.21'; + $MYSQL_OPT = ' --batch --unbuffered'; + $ACCESS_DB = 'mysql'; # name of DB with grant-tables +@@ -32,7 +32,7 @@ + $ACCESS_U_BCK = 'user_backup'; + $ACCESS_D_BCK = 'db_backup'; + $DIFF = '/usr/bin/diff'; +- $MYSQLDUMP = '@bindir@/mysqldump'; ++ $MYSQLDUMP = '@bindir@/@mybin_mysqldump@'; + #path to mysqldump executable + + $MYSQLADMIN= 'http://foobar.com/MySQLadmin'; +diff -Naur mysql4.old/scripts/mysqld_multi.sh mysql4.new/scripts/mysqld_multi.sh +--- mysql4.old/scripts/mysqld_multi.sh 2005-09-02 22:38:07.000000000 +0000 ++++ mysql4.new/scripts/mysqld_multi.sh 2005-11-15 17:17:48.000000000 +0000 +@@ -10,8 +10,8 @@ + $opt_example = 0; + $opt_help = 0; + $opt_log = undef(); +-$opt_mysqladmin = "@bindir@/mysqladmin"; +-$opt_mysqld = "@libexecdir@/mysqld"; ++$opt_mysqladmin = "@bindir@/@mybin_mysqladmin@"; ++$opt_mysqld = "@libexecdir@/@mybin_mysqld@"; + $opt_no_log = 0; + $opt_password = undef(); + $opt_tcp_ip = 0; +@@ -548,7 +548,7 @@ + # MY_PWD=`pwd` + # Check if we are starting this relative (for the binary release) + # if test -d $MY_PWD/data/mysql -a -f ./share/mysql/english/errmsg.sys -a \ +-# -x ./bin/mysqld ++# -x ./bin/@mybin_mysqld@ + # -------------------------------------------------------------------------- + # The above test should be successful, or you may encounter problems. + # 3.Beware of the dangers starting multiple mysqlds in the same data directory. +@@ -574,8 +574,8 @@ + # give you extra performance in a threaded system! + # + [mysqld_multi] +-mysqld = @bindir@/mysqld_safe +-mysqladmin = @bindir@/mysqladmin ++mysqld = @bindir@/@mybin_mysqld_safe@ ++mysqladmin = @bindir@/@mybin_mysqladmin@ + user = root + password = your_password + +diff -Naur mysql4.old/scripts/mysqld_safe.sh mysql4.new/scripts/mysqld_safe.sh +--- mysql4.old/scripts/mysqld_safe.sh 2005-09-02 22:37:59.000000000 +0000 ++++ mysql4.new/scripts/mysqld_safe.sh 2005-11-15 17:22:32.000000000 +0000 +@@ -67,7 +67,7 @@ + then + MYSQLD="mysqld-$tmp" + else +- MYSQLD="mysqld" ++ MYSQLD="@mybin_mysqld@" + fi + ;; + --nice=*) niceness=`echo "$arg" | sed -e "s;--nice=;;"` ;; +@@ -87,7 +87,7 @@ + MY_PWD=`pwd` + # Check if we are starting this relative (for the binary release) + if test -d $MY_PWD/data/mysql -a -f ./share/mysql/english/errmsg.sys -a \ +- -x ./bin/mysqld ++ -x ./bin/@mybin_mysqld@ + then + MY_BASEDIR_VERSION=$MY_PWD # Where bin, share and data are + ledir=$MY_BASEDIR_VERSION/bin # Where mysqld is +@@ -113,11 +113,11 @@ + niceness=0 + + # Use the mysqld-max binary by default if the user doesn't specify a binary +-if test -x $ledir/mysqld-max ++if test -x $ledir/@mybin_mysqld-max@ + then +- MYSQLD=mysqld-max ++ MYSQLD=@mybin_mysqld-max@ + else +- MYSQLD=mysqld ++ MYSQLD=@mybin_mysqld@ + fi + + # these rely on $DATADIR by default, so we'll set them later on +@@ -126,17 +126,17 @@ + + # Get first arguments from the my.cnf file, groups [mysqld] and [mysqld_safe] + # and then merge with the command line arguments +-if test -x ./bin/my_print_defaults ++if test -x "./bin/@mybin_my_print_defaults@" + then +- print_defaults="./bin/my_print_defaults" +-elif test -x @bindir@/my_print_defaults ++ print_defaults="./bin/@mybin_my_print_defaults@" ++elif test -x "@bindir@/@mybin_my_print_defaults@" + then +- print_defaults="@bindir@/my_print_defaults" +-elif test -x @bindir@/mysql_print_defaults ++ print_defaults="@bindir@/@mybin_my_print_defaults@" ++elif test -x "@bindir@/@mybin_mysql_print_defaults@" + then +- print_defaults="@bindir@/mysql_print_defaults" ++ print_defaults="@bindir@/@mybin_mysql_print_defaults@" + else +- print_defaults="my_print_defaults" ++ print_defaults="@mybin_my_print_defaults@" + fi + + args= +@@ -155,7 +155,7 @@ + echo "The file $ledir/$MYSQLD doesn't exist or is not executable" + echo "Please do a cd to the mysql installation directory and restart" + echo "this script from there as follows:" +- echo "./bin/mysqld_safe". ++ echo "./bin/@mybin_mysqld_safe@". + echo "See http://dev.mysql.com/doc/mysql/en/mysqld_safe.html for more" + echo "information" + exit 1 +@@ -288,8 +288,8 @@ + # the manual for details. + # + # echo "Checking tables in $DATADIR" +-# $MY_BASEDIR_VERSION/bin/myisamchk --silent --force --fast --medium-check $DATADIR/*/*.MYI +-# $MY_BASEDIR_VERSION/bin/isamchk --silent --force $DATADIR/*/*.ISM ++# $MY_BASEDIR_VERSION/bin/@mybin_myisamchk@ --silent --force --fast --medium-check $DATADIR/*/*.MYI ++# $MY_BASEDIR_VERSION/bin/@mybin_isamchk@ --silent --force $DATADIR/*/*.ISM + + echo "Starting $MYSQLD daemon with databases from $DATADIR" + +diff -Naur mysql4.old/scripts/mysqldumpslow.sh mysql4.new/scripts/mysqldumpslow.sh +--- mysql4.old/scripts/mysqldumpslow.sh 2005-09-02 22:37:59.000000000 +0000 ++++ mysql4.new/scripts/mysqldumpslow.sh 2005-11-15 17:24:20.000000000 +0000 +@@ -32,15 +32,15 @@ + + + unless (@ARGV) { +- my $defaults = `my_print_defaults mysqld`; ++ my $defaults = `@mybin_my_print_defaults@ mysqld`; + my $basedir = ($defaults =~ m/--basedir=(.*)/)[0] +- or die "Can't determine basedir from 'my_print_defaults mysqld' output: $defaults"; ++ or die "Can't determine basedir from '@mybin_my_print_defaults@ mysqld' output: $defaults"; + warn "basedir=$basedir\n" if $opt{v}; + + my $datadir = ($defaults =~ m/--datadir=(.*)/)[0]; + if (!$datadir or $opt{i}) { + # determine the datadir from the instances section of /etc/my.cnf, if any +- my $instances = `my_print_defaults instances`; ++ my $instances = `@mybin_my_print_defaults@ instances`; + die "Can't determine datadir from 'my_print_defaults mysqld' output: $defaults" + unless $instances; + my @instances = ($instances =~ m/^--(\w+)-/mg); diff --git a/080_all_slot_script-r1.patch b/080_all_slot_script-r1.patch new file mode 100644 index 0000000..6c7a50b --- /dev/null +++ b/080_all_slot_script-r1.patch @@ -0,0 +1,541 @@ +diff -Naur mysql-4.1.15/scripts/Makefile.am mysql-4.1.15.new/scripts/Makefile.am +--- mysql-4.1.15/scripts/Makefile.am 2005-10-09 22:46:33.000000000 +0000 ++++ mysql-4.1.15.new/scripts/Makefile.am 2005-11-21 11:56:30.000000000 +0000 +@@ -66,6 +66,32 @@ + mysqlaccess.conf \ + mysqlbug + ++sql_libexec_REPLACE = mysqld ++instance_manager_libexec_REPLACE= mysqlmanager ++client_bin_REPLACE = mysql mysqladmin mysqlcheck mysqlshow \ ++ mysqldump mysqlimport mysqltest mysqlbinlog \ ++ mysqltestmanagerc mysqltestmanager-pwgen ++extra_bin_REPLACE = replace comp_err perror resolveip my_print_defaults \ ++ resolve_stack_dump mysql_waitpid innochecksum ++myisam_bin_REPLACE = myisamchk myisamlog myisampack myisam_ftdump ++tools_bin_REPLACE = mysqltestmanager ++cw_cpcd_ndbbin_REPLACE = ndb_cpcd ++kernel_ndbbin_REPLACE = ndbd ++mgmsrv_ndbbin_REPLACE = ndb_mgmd ++sql_bin_REPLACE = mysql_tzinfo_to_sql ++tests_bin_REPLACE = mysql_client_test ++ndbtools_bin_REPLACE = ndb_test_platform ndb_waiter \ ++ ndb_drop_table ndb_delete_all \ ++ ndb_desc ndb_drop_index \ ++ ndb_show_tables ndb_select_all \ ++ ndb_select_count ndb_restore ndb_config ++EXTRA_REPLACE_BIN = safe_mysqld mysqlanalyze mysqloptimize mysqlrepair mysqld-max isamchk \ ++ $(sql_libexec_REPLACE) $(ndbtools_bin_REPLACE) \ ++ $(instance_manager_libexec_REPLACE) $(client_bin_REPLACE) \ ++ $(extra_bin_REPLACE) $(myisam_bin_REPLACE) $(tools_bin_REPLACE) \ ++ $(cw_cpcd_ndbbin_REPLACE) $(kernel_ndbbin_REPLACE) $(mgmsrv_ndbbin_REPLACE) \ ++ $(sql_bin_REPLACE) $(tests_bin_REPLACE) ++ + dist_pkgdata_DATA = fill_help_tables.sql mysql_fix_privilege_tables.sql + + # mysqlbug should be distributed built so that people can report build +@@ -85,6 +111,8 @@ + mysql_find_rows \ + mysqlhotcopy \ + mysqldumpslow \ ++ mysql_explain_log \ ++ mysql_tableinfo \ + mysqld_multi \ + make_win_src_distribution \ + make_win_binary_distribution \ +@@ -99,8 +127,17 @@ + + .sh: + @RM@ -f $@ $@-t ++ bin_REPLACE='';\ ++ list='$(EXTRA_SCRIPTS) $(EXTRA_REPLACE_BIN)'; \ ++ for p in $${list}; do \ ++ f1=$${p/\.sh}; \ ++ f2=`echo "$${p}" | @SED@ -e 's|\.sh$$||' -e 's|^.*/||;$(transform)'`; \ ++ bin_REPLACE="$${bin_REPLACE}s!@mybin_$${f1}@!$${f2}!g;";\ ++ done; \ + @SED@ \ ++ -e "$${bin_REPLACE}" \ + -e 's!@''bindir''@!$(bindir)!g' \ ++ -e 's!@''sharedstatedir''@!$(sharedstatedir)!g' \ + -e 's!@''sbindir''@!$(sbindir)!g' \ + -e 's!@''scriptdir''@!$(bindir)!g' \ + -e 's!@''prefix''@!$(prefix)!g' \ +diff -Naur mysql-4.1.15/scripts/msql2mysql.sh mysql-4.1.15.new/scripts/msql2mysql.sh +--- mysql-4.1.15/scripts/msql2mysql.sh 2005-10-09 22:46:44.000000000 +0000 ++++ mysql-4.1.15.new/scripts/msql2mysql.sh 2005-11-21 11:56:30.000000000 +0000 +@@ -13,4 +13,4 @@ + # described in the License. Among other things, the License requires that + # the copyright notice and this notice be preserved on all copies. + +-@bindir@/replace msqlConnect mysql_connect msqlListDBs mysql_list_dbs msqlNumRows mysql_num_rows msqlFetchRow mysql_fetch_row msqlFetchField mysql_fetch_field msqlFreeResult mysql_free_result msqlListFields mysql_list_fields msqlListTables mysql_list_tables msqlErrMsg 'mysql_error(mysql)' msqlStoreResult mysql_store_result msqlQuery mysql_query msqlField mysql_field msqlSelect mysql_select msqlSelectDB mysql_select_db msqlNumFields mysql_num_fields msqlClose mysql_close msqlDataSeek mysql_data_seek m_field MYSQL_FIELD m_result MYSQL_RES m_row MYSQL_ROW msql mysql mSQL mySQL MSQL MYSQL msqlCreateDB mysql_create_db msqlDropDB mysql_drop_db msqlFieldSeek mysql_field_seek -- $* ++@bindir@/@mybin_replace@ msqlConnect mysql_connect msqlListDBs mysql_list_dbs msqlNumRows mysql_num_rows msqlFetchRow mysql_fetch_row msqlFetchField mysql_fetch_field msqlFreeResult mysql_free_result msqlListFields mysql_list_fields msqlListTables mysql_list_tables msqlErrMsg 'mysql_error(mysql)' msqlStoreResult mysql_store_result msqlQuery mysql_query msqlField mysql_field msqlSelect mysql_select msqlSelectDB mysql_select_db msqlNumFields mysql_num_fields msqlClose mysql_close msqlDataSeek mysql_data_seek m_field MYSQL_FIELD m_result MYSQL_RES m_row MYSQL_ROW msql mysql mSQL mySQL MSQL MYSQL msqlCreateDB mysql_create_db msqlDropDB mysql_drop_db msqlFieldSeek mysql_field_seek -- $* +diff -Naur mysql-4.1.15/scripts/mysql_config.sh mysql-4.1.15.new/scripts/mysql_config.sh +--- mysql-4.1.15/scripts/mysql_config.sh 2005-10-09 22:46:25.000000000 +0000 ++++ mysql-4.1.15.new/scripts/mysql_config.sh 2005-11-21 11:56:30.000000000 +0000 +@@ -77,7 +77,7 @@ + + me=`get_full_path $0` + +-basedir=`echo $me | sed -e 's;/bin/mysql_config;;'` ++basedir=`echo $me | sed -e 's;/bin/@mybin_mysql_config@;;'` + + ldata='@localstatedir@' + execdir='@libexecdir@' +diff -Naur mysql-4.1.15/scripts/mysql_create_system_tables.sh mysql-4.1.15.new/scripts/mysql_create_system_tables.sh +--- mysql-4.1.15/scripts/mysql_create_system_tables.sh 2005-10-09 22:46:35.000000000 +0000 ++++ mysql-4.1.15.new/scripts/mysql_create_system_tables.sh 2005-11-21 11:56:30.000000000 +0000 +@@ -19,7 +19,7 @@ + new context from the manual (from fill_help_tables.sql). + + Usage: +- mysql_create_system_tables [test|verbose|real] <path to mysql-database directory> <hostname> <windows option> ++ @mybin_mysql_create_system_tables@ [test|verbose|real] <path to mysql-database directory> <hostname> <windows option> + " + exit + fi +diff -Naur mysql-4.1.15/scripts/mysql_fix_privilege_tables.sh mysql-4.1.15.new/scripts/mysql_fix_privilege_tables.sh +--- mysql-4.1.15/scripts/mysql_fix_privilege_tables.sh 2005-10-09 22:46:40.000000000 +0000 ++++ mysql-4.1.15.new/scripts/mysql_fix_privilege_tables.sh 2005-11-21 11:57:45.000000000 +0000 +@@ -76,17 +76,17 @@ + # Get first arguments from the my.cfg file, groups [mysqld] and + # [mysql_install_db], and then merge with the command line arguments + +-print_defaults=my_print_defaults ++print_defaults=@mybin_my_print_defaults@ + for dir in ./bin @bindir@ @bindir@ extra $print_defaults_bindir/../bin $print_defaults_bindir/../extra + do +- if test -x $dir/my_print_defaults ++ if test -x $dir/@mybin_my_print_defaults@ + then +- print_defaults="$dir/my_print_defaults" ++ print_defaults="$dir/@mybin_my_print_defaults@" + break + fi + done + +-parse_arguments `$print_defaults $defaults mysql_install_db mysql_fix_privilege_tables` ++parse_arguments `$print_defaults $defaults @mybin_mysql_install_db@ @mybin_mysql_fix_privilege_tables@` + parse_arguments PICK-ARGS-FROM-ARGV "$@" + + if test -z "$basedir" +@@ -119,7 +119,7 @@ + password=$old_style_password + fi + +-cmd="$bindir/mysql --no-defaults --force --user=$user --host=$host" ++cmd="$bindir/@mybin_mysql@ --no-defaults --force --user=$user --host=$host" + if test ! -z "$password" ; then + cmd="$cmd --password=$password" + fi +@@ -137,7 +137,7 @@ + fi + + # Find where first mysql_fix_privilege_tables.sql is located +-for i in $basedir/support-files $basedir/share $basedir/share/mysql \ ++for i in @sharedstatedir@ $basedir/support-files $basedir/share $basedir/share/mysql \ + $basedir/scripts @pkgdatadir@ . ./scripts + do + if test -f $i/$file +diff -Naur mysql-4.1.15/scripts/mysql_install_db.sh mysql-4.1.15.new/scripts/mysql_install_db.sh +--- mysql-4.1.15/scripts/mysql_install_db.sh 2005-10-09 22:46:26.000000000 +0000 ++++ mysql-4.1.15.new/scripts/mysql_install_db.sh 2005-11-21 11:56:30.000000000 +0000 +@@ -57,20 +57,20 @@ + + # Get first arguments from the my.cfg file, groups [mysqld] and + # [mysql_install_db], and then merge with the command line arguments +-if test -x ./bin/my_print_defaults ++if test -x "./bin/@mybin_my_print_defaults@" + then +- print_defaults="./bin/my_print_defaults" +-elif test -x ./extra/my_print_defaults ++ print_defaults="./bin/@mybin_my_print_defaults@" ++elif test -x "./extra/@mybin_my_print_defaults@" + then +- print_defaults="./extra/my_print_defaults" +-elif test -x @bindir@/my_print_defaults ++ print_defaults="./extra/@mybin_my_print_defaults@" ++elif test -x "@bindir@/@mybin_my_print_defaults@" + then +- print_defaults="@bindir@/my_print_defaults" +-elif test -x @bindir@/mysql_print_defaults ++ print_defaults="@bindir@/@mybin_my_print_defaults@" ++elif test -x "@bindir@/@mybin_my_print_defaults@" + then +- print_defaults="@bindir@/mysql_print_defaults" ++ print_defaults="@bindir@/@mybin_my_print_defaults@" + else +- print_defaults="my_print_defaults" ++ print_defaults="@mybin_my_print_defaults@" + fi + + args= +@@ -94,10 +94,10 @@ + pkgdatadir=@pkgdatadir@ + else + bindir="$basedir/bin" +- if test -x "$basedir/libexec/mysqld" ++ if test -x "$basedir/libexec/@mybin_mysqld@" + then + execdir="$basedir/libexec" +- elif test -x "$basedir/sbin/mysqld" ++ elif test -x "$basedir/sbin/@mybin_mysqld@" + then + execdir="$basedir/sbin" + else +@@ -106,7 +106,7 @@ + fi + + # find fill_help_tables.sh +-for i in $basedir/support-files $basedir/share $basedir/share/mysql $basedir/scripts `pwd` `pwd`/scripts @pkgdatadir@ ++for i in @sharedstatedir@ $basedir/support-files $basedir/share $basedir/share/mysql $basedir/scripts `pwd` `pwd`/scripts @pkgdatadir@ + do + if test -f $i/fill_help_tables.sql + then +@@ -123,13 +123,13 @@ + fi + + mdata=$ldata/mysql +-mysqld=$execdir/mysqld ++mysqld=$execdir/@mybin_mysqld@ + mysqld_opt="" + scriptdir=$bindir + + if test "$windows" = 1 + then +- mysqld="./sql/mysqld" ++ mysqld="./sql/@mybin_mysqld@" + mysqld_opt="--language=./sql/share/english" + scriptdir="./scripts" + fi +@@ -153,14 +153,14 @@ + # Check if hostname is valid + if test "$windows" = 0 -a "$in_rpm" = 0 -a $force = 0 + then +- resolved=`$bindir/resolveip $hostname 2>&1` ++ resolved=`$bindir/@mybin_resolveip@ $hostname 2>&1` + if [ $? -ne 0 ] + then +- resolved=`$bindir/resolveip localhost 2>&1` ++ resolved=`$bindir/@mybin_resolveip@ localhost 2>&1` + if [ $? -ne 0 ] + then + echo "Neither host '$hostname' nor 'localhost' could be looked up with" +- echo "$bindir/resolveip" ++ echo "$bindir/@mybin_resolveip@" + echo "Please configure the 'hostname' command to return a correct hostname." + echo "If you want to solve this at a later stage, restart this script with" + echo "the --force option" +@@ -168,7 +168,7 @@ + fi + echo "WARNING: The host '$hostname' could not be looked up with resolveip." + echo "This probably means that your libc libraries are not 100 % compatible" +- echo "with this binary MySQL version. The MySQL daemon, mysqld, should work" ++ echo "with this binary MySQL version. The MySQL daemon, @mybin_mysqld@, should work" + echo "normally with the exception that host name resolving will not work." + echo "This means that you should use IP addresses instead of hostnames" + echo "when specifying MySQL privileges !" +@@ -213,7 +213,7 @@ + mysqld_install_cmd_line="$mysqld $defaults $mysqld_opt --bootstrap \ + --skip-grant-tables --basedir=$basedir --datadir=$ldata --skip-innodb \ + --skip-bdb --skip-ndbcluster $args --max_allowed_packet=8M --net_buffer_length=16K" +-if $scriptdir/mysql_create_system_tables $create_option $mdata $hostname $windows \ ++if $scriptdir/@mybin_mysql_create_system_tables@ $create_option $mdata $hostname $windows \ + | eval "$mysqld_install_cmd_line" + then + if test -n "$fill_help_tables" +@@ -243,8 +243,8 @@ + then + echo "PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !" + echo "To do so, start the server, then issue the following commands:" +- echo "$bindir/mysqladmin -u root password 'new-password'" +- echo "$bindir/mysqladmin -u root -h $hostname password 'new-password'" ++ echo "$bindir/@mybin_mysqladmin@ -u root password 'new-password'" ++ echo "$bindir/@mybin_mysqladmin@ -u root -h $hostname password 'new-password'" + echo "See the manual for more instructions." + # + # Print message about upgrading unless we have created a new db table. +@@ -252,14 +252,14 @@ + then + echo + echo "NOTE: If you are upgrading from a MySQL <= 3.22.10 you should run" +- echo "the $bindir/mysql_fix_privilege_tables. Otherwise you will not be" ++ echo "the $bindir/@mybin_mysql_fix_privilege_tables@. Otherwise you will not be" + echo "able to use the new GRANT command!" + fi + echo + if test "$in_rpm" = "0" + then + echo "You can start the MySQL daemon with:" +- echo "cd @prefix@ ; $bindir/mysqld_safe &" ++ echo "cd @prefix@ ; $bindir/@mybin_mysqld_safe@ &" + echo + echo "You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:" + echo "cd sql-bench ; perl run-all-tests" +@@ -279,13 +279,13 @@ + echo "You can also try to start the mysqld daemon with:" + echo "$mysqld --skip-grant &" + echo "You can use the command line tool" +- echo "$bindir/mysql to connect to the mysql" ++ echo "$bindir/@mybin_mysql@ to connect to the mysql" + echo "database and look at the grant tables:" + echo +- echo "shell> $bindir/mysql -u root mysql" ++ echo "shell> $bindir/@mybin_mysql@ -u root mysql" + echo "mysql> show tables" + echo +- echo "Try 'mysqld --help' if you have problems with paths. Using --log" ++ echo "Try '@mybin_mysqld@ --help' if you have problems with paths. Using --log" + echo "gives you a log in $ldata that may be helpful." + echo + echo "The latest information about MySQL is available on the web at" +@@ -294,6 +294,6 @@ + echo "and the manual section that describes problems on your OS." + echo "Another information source is the MySQL email archive." + echo "Please check all of the above before mailing us!" +- echo "And if you do mail us, you MUST use the @scriptdir@/mysqlbug script!" ++ echo "And if you do mail us, you MUST use the @scriptdir@/@mybin_mysqlbug@ script!" + exit 1 + fi +diff -Naur mysql-4.1.15/scripts/mysql_secure_installation.sh mysql-4.1.15.new/scripts/mysql_secure_installation.sh +--- mysql-4.1.15/scripts/mysql_secure_installation.sh 2005-10-09 22:46:44.000000000 +0000 ++++ mysql-4.1.15.new/scripts/mysql_secure_installation.sh 2005-11-21 11:56:30.000000000 +0000 +@@ -30,7 +30,7 @@ + + do_query() { + echo $1 >$command +- mysql --defaults-file=$config <$command ++ @mybin_mysql@ --defaults-file=$config <$command + return $? + } + +diff -Naur mysql-4.1.15/scripts/mysqlaccess.sh mysql-4.1.15.new/scripts/mysqlaccess.sh +--- mysql-4.1.15/scripts/mysqlaccess.sh 2005-10-09 22:46:25.000000000 +0000 ++++ mysql-4.1.15.new/scripts/mysqlaccess.sh 2005-11-21 11:56:30.000000000 +0000 +@@ -17,7 +17,7 @@ + + # **************************** + # information on MySQL +- $MYSQL = '@bindir@/mysql'; # path to mysql executable ++ $MYSQL = '@bindir@/@mybin_mysql@'; # path to mysql executable + $SERVER = '3.21'; + $MYSQL_OPT = ' --batch --unbuffered'; + $ACCESS_DB = 'mysql'; # name of DB with grant-tables +@@ -32,7 +32,7 @@ + $ACCESS_U_BCK = 'user_backup'; + $ACCESS_D_BCK = 'db_backup'; + $DIFF = '/usr/bin/diff'; +- $MYSQLDUMP = '@bindir@/mysqldump'; ++ $MYSQLDUMP = '@bindir@/@mybin_mysqldump@'; + #path to mysqldump executable + + $MYSQLADMIN= 'http://foobar.com/MySQLadmin'; +diff -Naur mysql-4.1.15/scripts/mysqld_multi.sh mysql-4.1.15.new/scripts/mysqld_multi.sh +--- mysql-4.1.15/scripts/mysqld_multi.sh 2005-10-09 22:46:39.000000000 +0000 ++++ mysql-4.1.15.new/scripts/mysqld_multi.sh 2005-11-21 13:12:13.000000000 +0000 +@@ -10,8 +10,8 @@ + $opt_example = 0; + $opt_help = 0; + $opt_log = undef(); +-$opt_mysqladmin = "@bindir@/mysqladmin"; +-$opt_mysqld = "@libexecdir@/mysqld"; ++$opt_mysqladmin = "@bindir@/@mybin_mysqladmin@"; ++$opt_mysqld = "@libexecdir@/@mybin_mysqld@"; + $opt_no_log = 0; + $opt_password = undef(); + $opt_tcp_ip = 0; +@@ -39,11 +39,11 @@ + { + my ($flag_exit); + +- if (!defined(my_which(my_print_defaults))) ++ if (!defined(my_which(@mybin_my_print_defaults@))) + { + # We can't throw out yet, since --version, --help, or --example may + # have been given +- print "WARNING! my_print_defaults command not found!\n"; ++ print "WARNING! @mybin_my_print_defaults@ command not found!\n"; + print "Please make sure you have this command available and\n"; + print "in your path. The command is available from the latest\n"; + print "MySQL distribution.\n"; +@@ -69,9 +69,9 @@ + } + } + } +- my $com= "my_print_defaults "; ++ my $com= "@mybin_my_print_defaults@ "; + $com.= "--config-file=$opt_config_file " if (defined($opt_config_file)); +- $com.= "mysqld_multi"; ++ $com.= "@mybin_mysqld_multi@"; + my @defops = `$com`; + chop @defops; + splice @ARGV, 0, 0, @defops; +@@ -101,9 +101,9 @@ + print "Error with an option, see $my_progname --help for more info!\n"; + exit(1); + } +- if (!defined(my_which(my_print_defaults))) ++ if (!defined(my_which(@mybin_my_print_defaults@))) + { +- print "ABORT: Can't find command 'my_print_defaults'!\n"; ++ print "ABORT: Can't find command '@mybin_my_print_defaults@'!\n"; + print "This command is available from the latest MySQL\n"; + print "distribution. Please make sure you have the command\n"; + print "in your PATH.\n"; +@@ -165,7 +165,7 @@ + { + if ($my_print_defaults_exists) + { +- @mysqld_opts= `my_print_defaults mysqld`; ++ @mysqld_opts= `@mybin_my_print_defaults@ mysqld`; + chomp @mysqld_opts; + foreach my $opt (@mysqld_opts) + { +@@ -266,7 +266,7 @@ + @groups = &find_groups($groupids); + for ($i = 0; defined($groups[$i]); $i++) + { +- $com = "my_print_defaults"; ++ $com = "@mybin_my_print_defaults@"; + $com.= defined($opt_config_file) ? " --config-file=$opt_config_file" : ""; + $com.= " $groups[$i]"; + @options = `$com`; +@@ -295,7 +295,7 @@ + $tmp.= " '$options[$j]'"; + } + } +- if ($opt_verbose && $com =~ m/\/safe_mysqld$/ && !$info_sent) ++ if ($opt_verbose && $com =~ m/\/@mybin_safe_mysqld@$/ && !$info_sent) + { + print "WARNING: safe_mysqld is being used to start mysqld. In this case you "; + print "may need to pass\n\"ledir=...\" under groups [mysqldN] to "; +@@ -366,7 +366,7 @@ + my ($i, @groups)= @_; + my ($mysqladmin_found, $com, $tmp, $j); + +- $com = "my_print_defaults"; ++ $com = "@mybin_my_print_defaults@"; + $com.= defined($opt_config_file) ? " --config-file=$opt_config_file" : ""; + $com.= " $groups[$i]"; + @options = `$com`; +diff -Naur mysql-4.1.15/scripts/mysqld_safe.sh mysql-4.1.15.new/scripts/mysqld_safe.sh +--- mysql-4.1.15/scripts/mysqld_safe.sh 2005-10-09 22:46:44.000000000 +0000 ++++ mysql-4.1.15.new/scripts/mysqld_safe.sh 2005-11-21 11:56:30.000000000 +0000 +@@ -67,7 +67,7 @@ + then + MYSQLD="mysqld-$tmp" + else +- MYSQLD="mysqld" ++ MYSQLD="@mybin_mysqld@" + fi + ;; + --nice=*) niceness=`echo "$arg" | sed -e "s;--nice=;;"` ;; +@@ -90,13 +90,13 @@ + + MY_PWD=`pwd` + # Check for the directories we would expect from a binary release install +-if test -f ./share/mysql/english/errmsg.sys -a -x ./bin/mysqld ++if test -f ./share/mysql/english/errmsg.sys -a -x ./bin/@mybin_mysqld@ + then + MY_BASEDIR_VERSION=$MY_PWD # Where bin, share and data are + ledir=$MY_BASEDIR_VERSION/bin # Where mysqld is + # Check for the directories we would expect from a source install + elif test -f ./share/mysql/english/errmsg.sys -a \ +- -x ./libexec/mysqld ++ -x ./libexec/@mybin_mysqld@ + then + MY_BASEDIR_VERSION=$MY_PWD # Where libexec, share and var are + ledir=$MY_BASEDIR_VERSION/libexec # Where mysqld is +@@ -131,11 +131,11 @@ + niceness=0 + + # Use the mysqld-max binary by default if the user doesn't specify a binary +-if test -x $ledir/mysqld-max ++if test -x $ledir/@mybin_mysqld-max@ + then +- MYSQLD=mysqld-max ++ MYSQLD=@mybin_mysqld-max@ + else +- MYSQLD=mysqld ++ MYSQLD=@mybin_mysqld@ + fi + + # these rely on $DATADIR by default, so we'll set them later on +@@ -144,17 +144,17 @@ + + # Get first arguments from the my.cnf file, groups [mysqld] and [mysqld_safe] + # and then merge with the command line arguments +-if test -x ./bin/my_print_defaults ++if test -x "./bin/@mybin_my_print_defaults@" + then +- print_defaults="./bin/my_print_defaults" +-elif test -x @bindir@/my_print_defaults ++ print_defaults="./bin/@mybin_my_print_defaults@" ++elif test -x "@bindir@/@mybin_my_print_defaults@" + then +- print_defaults="@bindir@/my_print_defaults" +-elif test -x @bindir@/mysql_print_defaults ++ print_defaults="@bindir@/@mybin_my_print_defaults@" ++elif test -x "@bindir@/@mybin_my_print_defaults@" + then +- print_defaults="@bindir@/mysql_print_defaults" ++ print_defaults="@bindir@/@mybin_my_print_defaults@" + else +- print_defaults="my_print_defaults" ++ print_defaults="@mybin_my_print_defaults@" + fi + + args= +@@ -182,7 +182,7 @@ + echo "The file $ledir/$MYSQLD doesn't exist or is not executable" + echo "Please do a cd to the mysql installation directory and restart" + echo "this script from there as follows:" +- echo "./bin/mysqld_safe". ++ echo "./bin/@mybin_mysqld_safe@". + echo "See http://dev.mysql.com/doc/mysql/en/mysqld_safe.html for more" + echo "information" + exit 1 +@@ -315,8 +315,8 @@ + # the manual for details. + # + # echo "Checking tables in $DATADIR" +-# $MY_BASEDIR_VERSION/bin/myisamchk --silent --force --fast --medium-check $DATADIR/*/*.MYI +-# $MY_BASEDIR_VERSION/bin/isamchk --silent --force $DATADIR/*/*.ISM ++# $MY_BASEDIR_VERSION/bin/@mybin_myisamchk@ --silent --force --fast --medium-check $DATADIR/*/*.MYI ++# $MY_BASEDIR_VERSION/bin/@mybin_isamchk@ --silent --force $DATADIR/*/*.ISM + + echo "Starting $MYSQLD daemon with databases from $DATADIR" + +diff -Naur mysql-4.1.15/scripts/mysqldumpslow.sh mysql-4.1.15.new/scripts/mysqldumpslow.sh +--- mysql-4.1.15/scripts/mysqldumpslow.sh 2005-10-09 22:46:45.000000000 +0000 ++++ mysql-4.1.15.new/scripts/mysqldumpslow.sh 2005-11-21 11:56:30.000000000 +0000 +@@ -34,16 +34,16 @@ + $opt{'help'} and usage(); + + unless (@ARGV) { +- my $defaults = `my_print_defaults mysqld`; ++ my $defaults = `@mybin_my_print_defaults@ mysqld`; + my $basedir = ($defaults =~ m/--basedir=(.*)/)[0] +- or die "Can't determine basedir from 'my_print_defaults mysqld' output: $defaults"; ++ or die "Can't determine basedir from '@mybin_my_print_defaults@ mysqld' output: $defaults"; + warn "basedir=$basedir\n" if $opt{v}; + + my $datadir = ($defaults =~ m/--datadir=(.*)/)[0]; + if (!$datadir or $opt{i}) { + # determine the datadir from the instances section of /etc/my.cnf, if any +- my $instances = `my_print_defaults instances`; +- die "Can't determine datadir from 'my_print_defaults mysqld' output: $defaults" ++ my $instances = `@mybin_my_print_defaults@ instances`; ++ die "Can't determine datadir from '@mybin_my_print_defaults@ mysqld' output: $defaults" + unless $instances; + my @instances = ($instances =~ m/^--(\w+)-/mg); + die "No -i 'instance_name' specified to select among known instances: @instances.\n" +@@ -51,7 +51,7 @@ + die "Instance '$opt{i}' is unknown (known instances: @instances)\n" + unless grep { $_ eq $opt{i} } @instances; + $datadir = ($instances =~ m/--$opt{i}-datadir=(.*)/)[0] +- or die "Can't determine --$opt{i}-datadir from 'my_print_defaults instances' output: $instances"; ++ or die "Can't determine --$opt{i}-datadir from '@mybin_my_print_defaults@ instances' output: $instances"; + warn "datadir=$datadir\n" if $opt{v}; + } + diff --git a/080_all_slot_script-r2.patch b/080_all_slot_script-r2.patch new file mode 100644 index 0000000..bdabd3b --- /dev/null +++ b/080_all_slot_script-r2.patch @@ -0,0 +1,541 @@ +diff -Naur mysql-5.0.15/scripts/Makefile.am mysql-5.0.15.new/scripts/Makefile.am +--- mysql-5.0.15/scripts/Makefile.am 2005-10-17 01:27:44.000000000 +0000 ++++ mysql-5.0.15.new/scripts/Makefile.am 2005-11-20 11:41:29.000000000 +0000 +@@ -66,6 +66,32 @@ + mysqlaccess.conf \ + mysqlbug + ++sql_libexec_REPLACE = mysqld ++instance_manager_libexec_REPLACE= mysqlmanager ++client_bin_REPLACE = mysql mysqladmin mysqlcheck mysqlshow \ ++ mysqldump mysqlimport mysqltest mysqlbinlog \ ++ mysqltestmanagerc mysqltestmanager-pwgen ++extra_bin_REPLACE = replace comp_err perror resolveip my_print_defaults \ ++ resolve_stack_dump mysql_waitpid innochecksum ++myisam_bin_REPLACE = myisamchk myisamlog myisampack myisam_ftdump ++tools_bin_REPLACE = mysqltestmanager ++cw_cpcd_ndbbin_REPLACE = ndb_cpcd ++kernel_ndbbin_REPLACE = ndbd ++mgmsrv_ndbbin_REPLACE = ndb_mgmd ++sql_bin_REPLACE = mysql_tzinfo_to_sql ++tests_bin_REPLACE = mysql_client_test ++ndbtools_bin_REPLACE = ndb_test_platform ndb_waiter \ ++ ndb_drop_table ndb_delete_all \ ++ ndb_desc ndb_drop_index \ ++ ndb_show_tables ndb_select_all \ ++ ndb_select_count ndb_restore ndb_config ++EXTRA_REPLACE_BIN = safe_mysqld mysqlanalyze mysqloptimize mysqlrepair mysqld-max isamchk \ ++ $(sql_libexec_REPLACE) $(ndbtools_bin_REPLACE) \ ++ $(instance_manager_libexec_REPLACE) $(client_bin_REPLACE) \ ++ $(extra_bin_REPLACE) $(myisam_bin_REPLACE) $(tools_bin_REPLACE) \ ++ $(cw_cpcd_ndbbin_REPLACE) $(kernel_ndbbin_REPLACE) $(mgmsrv_ndbbin_REPLACE) \ ++ $(sql_bin_REPLACE) $(tests_bin_REPLACE) ++ + dist_pkgdata_DATA = fill_help_tables.sql mysql_fix_privilege_tables.sql + + # mysqlbug should be distributed built so that people can report build +@@ -85,6 +111,8 @@ + mysql_find_rows \ + mysqlhotcopy \ + mysqldumpslow \ ++ mysql_explain_log \ ++ mysql_tableinfo \ + mysqld_multi \ + make_win_src_distribution \ + make_win_binary_distribution \ +@@ -99,8 +127,17 @@ + + .sh: + @RM@ -f $@ $@-t ++ bin_REPLACE='';\ ++ list='$(EXTRA_SCRIPTS) $(EXTRA_REPLACE_BIN)'; \ ++ for p in $${list}; do \ ++ f1=$${p/\.sh}; \ ++ f2=`echo "$${p}" | @SED@ -e 's|\.sh$$||' -e 's|^.*/||;$(transform)'`; \ ++ bin_REPLACE="$${bin_REPLACE}s!@mybin_$${f1}@!$${f2}!g;";\ ++ done; \ + @SED@ \ ++ -e "$${bin_REPLACE}" \ + -e 's!@''bindir''@!$(bindir)!g' \ ++ -e 's!@''sharedstatedir''@!$(sharedstatedir)!g' \ + -e 's!@''sbindir''@!$(sbindir)!g' \ + -e 's!@''scriptdir''@!$(bindir)!g' \ + -e 's!@''prefix''@!$(prefix)!g' \ +diff -Naur mysql-5.0.15/scripts/msql2mysql.sh mysql-5.0.15.new/scripts/msql2mysql.sh +--- mysql-5.0.15/scripts/msql2mysql.sh 2005-10-17 01:27:55.000000000 +0000 ++++ mysql-5.0.15.new/scripts/msql2mysql.sh 2005-11-20 11:33:17.000000000 +0000 +@@ -13,4 +13,4 @@ + # described in the License. Among other things, the License requires that + # the copyright notice and this notice be preserved on all copies. + +-@bindir@/replace msqlConnect mysql_connect msqlListDBs mysql_list_dbs msqlNumRows mysql_num_rows msqlFetchRow mysql_fetch_row msqlFetchField mysql_fetch_field msqlFreeResult mysql_free_result msqlListFields mysql_list_fields msqlListTables mysql_list_tables msqlErrMsg 'mysql_error(mysql)' msqlStoreResult mysql_store_result msqlQuery mysql_query msqlField mysql_field msqlSelect mysql_select msqlSelectDB mysql_select_db msqlNumFields mysql_num_fields msqlClose mysql_close msqlDataSeek mysql_data_seek m_field MYSQL_FIELD m_result MYSQL_RES m_row MYSQL_ROW msql mysql mSQL mySQL MSQL MYSQL msqlCreateDB mysql_create_db msqlDropDB mysql_drop_db msqlFieldSeek mysql_field_seek -- $* ++@bindir@/@mybin_replace@ msqlConnect mysql_connect msqlListDBs mysql_list_dbs msqlNumRows mysql_num_rows msqlFetchRow mysql_fetch_row msqlFetchField mysql_fetch_field msqlFreeResult mysql_free_result msqlListFields mysql_list_fields msqlListTables mysql_list_tables msqlErrMsg 'mysql_error(mysql)' msqlStoreResult mysql_store_result msqlQuery mysql_query msqlField mysql_field msqlSelect mysql_select msqlSelectDB mysql_select_db msqlNumFields mysql_num_fields msqlClose mysql_close msqlDataSeek mysql_data_seek m_field MYSQL_FIELD m_result MYSQL_RES m_row MYSQL_ROW msql mysql mSQL mySQL MSQL MYSQL msqlCreateDB mysql_create_db msqlDropDB mysql_drop_db msqlFieldSeek mysql_field_seek -- $* +diff -Naur mysql-5.0.15/scripts/mysql_config.sh mysql-5.0.15.new/scripts/mysql_config.sh +--- mysql-5.0.15/scripts/mysql_config.sh 2005-10-17 01:27:32.000000000 +0000 ++++ mysql-5.0.15.new/scripts/mysql_config.sh 2005-11-20 11:33:17.000000000 +0000 +@@ -77,7 +77,7 @@ + + me=`get_full_path $0` + +-basedir=`echo $me | sed -e 's;/bin/mysql_config;;'` ++basedir=`echo $me | sed -e 's;/bin/@mybin_mysql_config@;;'` + + ldata='@localstatedir@' + execdir='@libexecdir@' +diff -Naur mysql-5.0.15/scripts/mysql_create_system_tables.sh mysql-5.0.15.new/scripts/mysql_create_system_tables.sh +--- mysql-5.0.15/scripts/mysql_create_system_tables.sh 2005-10-17 01:27:45.000000000 +0000 ++++ mysql-5.0.15.new/scripts/mysql_create_system_tables.sh 2005-11-20 11:33:17.000000000 +0000 +@@ -19,7 +19,7 @@ + new context from the manual (from fill_help_tables.sql). + + Usage: +- mysql_create_system_tables [test|verbose|real] <path to mysql-database directory> <hostname> <windows option> ++ @mybin_mysql_create_system_tables@ [test|verbose|real] <path to mysql-database directory> <hostname> <windows option> + " + exit + fi +diff -Naur mysql-5.0.15/scripts/mysql_fix_privilege_tables.sh mysql-5.0.15.new/scripts/mysql_fix_privilege_tables.sh +--- mysql-5.0.15/scripts/mysql_fix_privilege_tables.sh 2005-10-17 01:27:55.000000000 +0000 ++++ mysql-5.0.15.new/scripts/mysql_fix_privilege_tables.sh 2005-11-20 11:33:17.000000000 +0000 +@@ -77,17 +77,17 @@ + # Get first arguments from the my.cfg file, groups [mysqld] and + # [mysql_install_db], and then merge with the command line arguments + +-print_defaults=my_print_defaults ++print_defaults=@mybin_my_print_defaults@ + for dir in ./bin @bindir@ @bindir@ extra $print_defaults_bindir/../bin $print_defaults_bindir/../extra + do +- if test -x $dir/my_print_defaults ++ if test -x $dir/@mybin_my_print_defaults@ + then +- print_defaults="$dir/my_print_defaults" ++ print_defaults="$dir/@mybin_my_print_defaults@" + break + fi + done + +-parse_arguments `$print_defaults $defaults mysql_install_db mysql_fix_privilege_tables` ++parse_arguments `$print_defaults $defaults @mybin_mysql_install_db@ @mybin_mysql_fix_privilege_tables@` + parse_arguments PICK-ARGS-FROM-ARGV "$@" + + if test -z "$password" +@@ -118,7 +118,7 @@ + exit 1 + fi + +-cmd="$bindir/mysql --no-defaults --force --user=$user --host=$host" ++cmd="$bindir/@mybin_mysql@ --no-defaults --force --user=$user --host=$host" + if test ! -z "$password" ; then + cmd="$cmd --password=$password" + fi +@@ -136,7 +136,7 @@ + fi + + # Find where first mysql_fix_privilege_tables.sql is located +-for i in $basedir/support-files $basedir/share $basedir/share/mysql \ ++for i in @sharedstatedir@ $basedir/support-files $basedir/share $basedir/share/mysql \ + $basedir/scripts $pkgdatadir . "$dirname" + do + if test -f $i/$file +diff -Naur mysql-5.0.15/scripts/mysql_install_db.sh mysql-5.0.15.new/scripts/mysql_install_db.sh +--- mysql-5.0.15/scripts/mysql_install_db.sh 2005-10-17 01:27:42.000000000 +0000 ++++ mysql-5.0.15.new/scripts/mysql_install_db.sh 2005-11-20 11:33:17.000000000 +0000 +@@ -57,20 +57,20 @@ + + # Get first arguments from the my.cfg file, groups [mysqld] and + # [mysql_install_db], and then merge with the command line arguments +-if test -x ./bin/my_print_defaults ++if test -x "./bin/@mybin_my_print_defaults@" + then +- print_defaults="./bin/my_print_defaults" +-elif test -x ./extra/my_print_defaults ++ print_defaults="./bin/@mybin_my_print_defaults@" ++elif test -x "./extra/@mybin_my_print_defaults@" + then +- print_defaults="./extra/my_print_defaults" +-elif test -x @bindir@/my_print_defaults ++ print_defaults="./extra/@mybin_my_print_defaults@" ++elif test -x "@bindir@/@mybin_my_print_defaults@" + then +- print_defaults="@bindir@/my_print_defaults" +-elif test -x @bindir@/mysql_print_defaults ++ print_defaults="@bindir@/@mybin_my_print_defaults@" ++elif test -x "@bindir@/@mybin_my_print_defaults@" + then +- print_defaults="@bindir@/mysql_print_defaults" ++ print_defaults="@bindir@/@mybin_my_print_defaults@" + else +- print_defaults="my_print_defaults" ++ print_defaults="@mybin_my_print_defaults@" + fi + + args= +@@ -94,10 +94,10 @@ + pkgdatadir=@pkgdatadir@ + else + bindir="$basedir/bin" +- if test -x "$basedir/libexec/mysqld" ++ if test -x "$basedir/libexec/@mybin_mysqld@" + then + execdir="$basedir/libexec" +- elif test -x "$basedir/sbin/mysqld" ++ elif test -x "$basedir/sbin/@mybin_mysqld@" + then + execdir="$basedir/sbin" + else +@@ -106,7 +106,7 @@ + fi + + # find fill_help_tables.sh +-for i in $basedir/support-files $basedir/share $basedir/share/mysql $basedir/scripts `pwd` `pwd`/scripts @pkgdatadir@ ++for i in @sharedstatedir@ $basedir/support-files $basedir/share $basedir/share/mysql $basedir/scripts `pwd` `pwd`/scripts @pkgdatadir@ + do + if test -f $i/fill_help_tables.sql + then +@@ -123,13 +123,13 @@ + fi + + mdata=$ldata/mysql +-mysqld=$execdir/mysqld ++mysqld=$execdir/@mybin_mysqld@ + mysqld_opt="" + scriptdir=$bindir + + if test "$windows" = 1 + then +- mysqld="./sql/mysqld" ++ mysqld="./sql/@mybin_mysqld@" + mysqld_opt="--language=./sql/share/english" + scriptdir="./scripts" + fi +@@ -153,14 +153,14 @@ + # Check if hostname is valid + if test "$windows" = 0 -a "$in_rpm" = 0 -a $force = 0 + then +- resolved=`$bindir/resolveip $hostname 2>&1` ++ resolved=`$bindir/@mybin_resolveip@ $hostname 2>&1` + if [ $? -ne 0 ] + then +- resolved=`$bindir/resolveip localhost 2>&1` ++ resolved=`$bindir/@mybin_resolveip@ localhost 2>&1` + if [ $? -ne 0 ] + then + echo "Neither host '$hostname' nor 'localhost' could be looked up with" +- echo "$bindir/resolveip" ++ echo "$bindir/@mybin_resolveip@" + echo "Please configure the 'hostname' command to return a correct hostname." + echo "If you want to solve this at a later stage, restart this script with" + echo "the --force option" +@@ -168,7 +168,7 @@ + fi + echo "WARNING: The host '$hostname' could not be looked up with resolveip." + echo "This probably means that your libc libraries are not 100 % compatible" +- echo "with this binary MySQL version. The MySQL daemon, mysqld, should work" ++ echo "with this binary MySQL version. The MySQL daemon, @mybin_mysqld@, should work" + echo "normally with the exception that host name resolving will not work." + echo "This means that you should use IP addresses instead of hostnames" + echo "when specifying MySQL privileges !" +@@ -213,7 +213,7 @@ + mysqld_install_cmd_line="$mysqld $defaults $mysqld_opt --bootstrap \ + --skip-grant-tables --basedir=$basedir --datadir=$ldata --skip-innodb \ + --skip-bdb --skip-ndbcluster $args --max_allowed_packet=8M --net_buffer_length=16K" +-if $scriptdir/mysql_create_system_tables $create_option $mdata $hostname $windows \ ++if $scriptdir/@mybin_mysql_create_system_tables@ $create_option $mdata $hostname $windows \ + | eval "$mysqld_install_cmd_line" + then + if test -n "$fill_help_tables" +@@ -243,8 +243,8 @@ + then + echo "PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !" + echo "To do so, start the server, then issue the following commands:" +- echo "$bindir/mysqladmin -u root password 'new-password'" +- echo "$bindir/mysqladmin -u root -h $hostname password 'new-password'" ++ echo "$bindir/@mybin_mysqladmin@ -u root password 'new-password'" ++ echo "$bindir/@mybin_mysqladmin@ -u root -h $hostname password 'new-password'" + echo "See the manual for more instructions." + # + # Print message about upgrading unless we have created a new db table. +@@ -252,14 +252,14 @@ + then + echo + echo "NOTE: If you are upgrading from a MySQL <= 3.22.10 you should run" +- echo "the $bindir/mysql_fix_privilege_tables. Otherwise you will not be" ++ echo "the $bindir/@mybin_mysql_fix_privilege_tables@. Otherwise you will not be" + echo "able to use the new GRANT command!" + fi + echo + if test "$in_rpm" = "0" + then + echo "You can start the MySQL daemon with:" +- echo "cd @prefix@ ; $bindir/mysqld_safe &" ++ echo "cd @prefix@ ; $bindir/@mybin_mysqld_safe@ &" + echo + echo "You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:" + echo "cd sql-bench ; perl run-all-tests" +@@ -279,13 +279,13 @@ + echo "You can also try to start the mysqld daemon with:" + echo "$mysqld --skip-grant &" + echo "You can use the command line tool" +- echo "$bindir/mysql to connect to the mysql" ++ echo "$bindir/@mybin_mysql@ to connect to the mysql" + echo "database and look at the grant tables:" + echo +- echo "shell> $bindir/mysql -u root mysql" ++ echo "shell> $bindir/@mybin_mysql@ -u root mysql" + echo "mysql> show tables" + echo +- echo "Try 'mysqld --help' if you have problems with paths. Using --log" ++ echo "Try '@mybin_mysqld@ --help' if you have problems with paths. Using --log" + echo "gives you a log in $ldata that may be helpful." + echo + echo "The latest information about MySQL is available on the web at" +@@ -294,6 +294,6 @@ + echo "and the manual section that describes problems on your OS." + echo "Another information source is the MySQL email archive." + echo "Please check all of the above before mailing us!" +- echo "And if you do mail us, you MUST use the @scriptdir@/mysqlbug script!" ++ echo "And if you do mail us, you MUST use the @scriptdir@/@mybin_mysqlbug@ script!" + exit 1 + fi +diff -Naur mysql-5.0.15/scripts/mysql_secure_installation.sh mysql-5.0.15.new/scripts/mysql_secure_installation.sh +--- mysql-5.0.15/scripts/mysql_secure_installation.sh 2005-10-17 01:27:55.000000000 +0000 ++++ mysql-5.0.15.new/scripts/mysql_secure_installation.sh 2005-11-20 11:33:17.000000000 +0000 +@@ -30,7 +30,7 @@ + + do_query() { + echo $1 >$command +- mysql --defaults-file=$config <$command ++ @mybin_mysql@ --defaults-file=$config <$command + return $? + } + +diff -Naur mysql-5.0.15/scripts/mysqlaccess.sh mysql-5.0.15.new/scripts/mysqlaccess.sh +--- mysql-5.0.15/scripts/mysqlaccess.sh 2005-10-17 01:27:31.000000000 +0000 ++++ mysql-5.0.15.new/scripts/mysqlaccess.sh 2005-11-20 11:33:17.000000000 +0000 +@@ -17,7 +17,7 @@ + + # **************************** + # information on MySQL +- $MYSQL = '@bindir@/mysql'; # path to mysql executable ++ $MYSQL = '@bindir@/@mybin_mysql@'; # path to mysql executable + $SERVER = '3.21'; + $MYSQL_OPT = ' --batch --unbuffered'; + $ACCESS_DB = 'mysql'; # name of DB with grant-tables +@@ -32,7 +32,7 @@ + $ACCESS_U_BCK = 'user_backup'; + $ACCESS_D_BCK = 'db_backup'; + $DIFF = '/usr/bin/diff'; +- $MYSQLDUMP = '@bindir@/mysqldump'; ++ $MYSQLDUMP = '@bindir@/@mybin_mysqldump@'; + #path to mysqldump executable + + $MYSQLADMIN= 'http://foobar.com/MySQLadmin'; +diff -Naur mysql-5.0.15/scripts/mysqld_multi.sh mysql-5.0.15.new/scripts/mysqld_multi.sh +--- mysql-5.0.15/scripts/mysqld_multi.sh 2005-10-17 01:27:50.000000000 +0000 ++++ mysql-5.0.15.new/scripts/mysqld_multi.sh 2005-11-20 11:33:17.000000000 +0000 +@@ -10,8 +10,8 @@ + $opt_example = 0; + $opt_help = 0; + $opt_log = undef(); +-$opt_mysqladmin = "@bindir@/mysqladmin"; +-$opt_mysqld = "@libexecdir@/mysqld"; ++$opt_mysqladmin = "@bindir@/@mybin_mysqladmin@"; ++$opt_mysqld = "@libexecdir@/@mybin_mysqld@"; + $opt_no_log = 0; + $opt_password = undef(); + $opt_tcp_ip = 0; +@@ -39,11 +39,11 @@ + { + my $flag_exit= 0; + +- if (!defined(my_which(my_print_defaults))) ++ if (!defined(my_which(@mybin_my_print_defaults@))) + { + # We can't throw out yet, since --version, --help, or --example may + # have been given +- print "WARNING: my_print_defaults command not found.\n"; ++ print "WARNING: @mybin_my_print_defaults@ command not found.\n"; + print "Please make sure you have this command available and\n"; + print "in your path. The command is available from the latest\n"; + print "MySQL distribution.\n"; +@@ -74,9 +74,9 @@ + } + } + } +- my $com= "my_print_defaults "; ++ my $com= "@mybin_my_print_defaults@ "; + $com.= "--config-file=$opt_config_file " if (defined($opt_config_file)); +- $com.= "mysqld_multi"; ++ $com.= "@mybin_mysqld_multi@"; + my @defops = `$com`; + chop @defops; + splice @ARGV, 0, 0, @defops; +@@ -113,9 +113,9 @@ + print "Error with an option, see $my_progname --help for more info.\n"; + exit(1); + } +- if (!defined(my_which(my_print_defaults))) ++ if (!defined(my_which(@mybin_my_print_defaults@))) + { +- print "ABORT: Can't find command 'my_print_defaults'.\n"; ++ print "ABORT: Can't find command '@mybin_my_print_defaults@'.\n"; + print "This command is available from the latest MySQL\n"; + print "distribution. Please make sure you have the command\n"; + print "in your PATH.\n"; +@@ -202,7 +202,7 @@ + { + if ($my_print_defaults_exists) + { +- @mysqld_opts= `my_print_defaults mysqld`; ++ @mysqld_opts= `@mybin_my_print_defaults@ mysqld`; + chomp @mysqld_opts; + foreach my $opt (@mysqld_opts) + { +@@ -303,7 +303,7 @@ + @groups = &find_groups($groupids); + for ($i = 0; defined($groups[$i]); $i++) + { +- $com = "my_print_defaults"; ++ $com = "@mybin_my_print_defaults@"; + $com.= defined($opt_config_file) ? " --config-file=$opt_config_file" : ""; + $com.= " $groups[$i]"; + @options = `$com`; +@@ -330,7 +330,7 @@ + $tmp.= " $options[$j]"; + } + } +- if ($opt_verbose && $com =~ m/\/safe_mysqld$/ && !$info_sent) ++ if ($opt_verbose && $com =~ m/\/@mybin_safe_mysqld@$/ && !$info_sent) + { + print "WARNING: safe_mysqld is being used to start mysqld. In this case you "; + print "may need to pass\n\"ledir=...\" under groups [mysqldN] to "; +@@ -401,7 +401,7 @@ + my ($i, @groups)= @_; + my ($mysqladmin_found, $com, $tmp, $j); + +- $com = "my_print_defaults"; ++ $com = "@mybin_my_print_defaults@"; + $com.= defined($opt_config_file) ? " --config-file=$opt_config_file" : ""; + $com.= " $groups[$i]"; + @options = `$com`; +diff -Naur mysql-5.0.15/scripts/mysqld_safe.sh mysql-5.0.15.new/scripts/mysqld_safe.sh +--- mysql-5.0.15/scripts/mysqld_safe.sh 2005-10-17 01:27:56.000000000 +0000 ++++ mysql-5.0.15.new/scripts/mysqld_safe.sh 2005-11-20 11:33:17.000000000 +0000 +@@ -86,7 +86,7 @@ + then + MYSQLD="mysqld-$tmp" + else +- MYSQLD="mysqld" ++ MYSQLD="@mybin_mysqld@" + fi + ;; + --nice=*) niceness=`echo "$arg" | sed -e "s;--nice=;;"` ;; +@@ -112,13 +112,13 @@ + + MY_PWD=`pwd` + # Check for the directories we would expect from a binary release install +-if test -f ./share/mysql/english/errmsg.sys -a -x ./bin/mysqld ++if test -f ./share/mysql/english/errmsg.sys -a -x ./bin/@mybin_mysqld@ + then + MY_BASEDIR_VERSION=$MY_PWD # Where bin, share and data are + ledir=$MY_BASEDIR_VERSION/bin # Where mysqld is + # Check for the directories we would expect from a source install + elif test -f ./share/mysql/english/errmsg.sys -a \ +- -x ./libexec/mysqld ++ -x ./libexec/@mybin_mysqld@ + then + MY_BASEDIR_VERSION=$MY_PWD # Where libexec, share and var are + ledir=$MY_BASEDIR_VERSION/libexec # Where mysqld is +@@ -175,11 +175,11 @@ + niceness=0 + + # Use the mysqld-max binary by default if the user doesn't specify a binary +-if test -x $ledir/mysqld-max ++if test -x $ledir/@mybin_mysqld-max@ + then +- MYSQLD=mysqld-max ++ MYSQLD=@mybin_mysqld-max@ + else +- MYSQLD=mysqld ++ MYSQLD=@mybin_mysqld@ + fi + + # these rely on $DATADIR by default, so we'll set them later on +@@ -188,17 +188,17 @@ + + # Get first arguments from the my.cnf file, groups [mysqld] and [mysqld_safe] + # and then merge with the command line arguments +-if test -x ./bin/my_print_defaults ++if test -x "./bin/@mybin_my_print_defaults@" + then +- print_defaults="./bin/my_print_defaults" +-elif test -x @bindir@/my_print_defaults ++ print_defaults="./bin/@mybin_my_print_defaults@" ++elif test -x "@bindir@/@mybin_my_print_defaults@" + then +- print_defaults="@bindir@/my_print_defaults" +-elif test -x @bindir@/mysql_print_defaults ++ print_defaults="@bindir@/@mybin_my_print_defaults@" ++elif test -x "@bindir@/@mybin_my_print_defaults@" + then +- print_defaults="@bindir@/mysql_print_defaults" ++ print_defaults="@bindir@/@mybin_my_print_defaults@" + else +- print_defaults="my_print_defaults" ++ print_defaults="@mybin_my_print_defaults@" + fi + + args= +@@ -226,7 +226,7 @@ + echo "The file $ledir/$MYSQLD doesn't exist or is not executable" + echo "Please do a cd to the mysql installation directory and restart" + echo "this script from there as follows:" +- echo "./bin/mysqld_safe". ++ echo "./bin/@mybin_mysqld_safe@". + echo "See http://dev.mysql.com/doc/mysql/en/mysqld_safe.html for more" + echo "information" + exit 1 +@@ -359,8 +359,8 @@ + # the manual for details. + # + # echo "Checking tables in $DATADIR" +-# $MY_BASEDIR_VERSION/bin/myisamchk --silent --force --fast --medium-check $DATADIR/*/*.MYI +-# $MY_BASEDIR_VERSION/bin/isamchk --silent --force $DATADIR/*/*.ISM ++# $MY_BASEDIR_VERSION/bin/@mybin_myisamchk@ --silent --force --fast --medium-check $DATADIR/*/*.MYI ++# $MY_BASEDIR_VERSION/bin/@mybin_isamchk@ --silent --force $DATADIR/*/*.ISM + + echo "Starting $MYSQLD daemon with databases from $DATADIR" + +diff -Naur mysql-5.0.15/scripts/mysqldumpslow.sh mysql-5.0.15.new/scripts/mysqldumpslow.sh +--- mysql-5.0.15/scripts/mysqldumpslow.sh 2005-10-17 01:27:56.000000000 +0000 ++++ mysql-5.0.15.new/scripts/mysqldumpslow.sh 2005-11-20 11:33:17.000000000 +0000 +@@ -34,16 +34,16 @@ + $opt{'help'} and usage(); + + unless (@ARGV) { +- my $defaults = `my_print_defaults mysqld`; ++ my $defaults = `@mybin_my_print_defaults@ mysqld`; + my $basedir = ($defaults =~ m/--basedir=(.*)/)[0] +- or die "Can't determine basedir from 'my_print_defaults mysqld' output: $defaults"; ++ or die "Can't determine basedir from '@mybin_my_print_defaults@ mysqld' output: $defaults"; + warn "basedir=$basedir\n" if $opt{v}; + + my $datadir = ($defaults =~ m/--datadir=(.*)/)[0]; + if (!$datadir or $opt{i}) { + # determine the datadir from the instances section of /etc/my.cnf, if any +- my $instances = `my_print_defaults instances`; +- die "Can't determine datadir from 'my_print_defaults mysqld' output: $defaults" ++ my $instances = `@mybin_my_print_defaults@ instances`; ++ die "Can't determine datadir from '@mybin_my_print_defaults@ mysqld' output: $defaults" + unless $instances; + my @instances = ($instances =~ m/^--(\w+)-/mg); + die "No -i 'instance_name' specified to select among known instances: @instances.\n" +@@ -51,7 +51,7 @@ + die "Instance '$opt{i}' is unknown (known instances: @instances)\n" + unless grep { $_ eq $opt{i} } @instances; + $datadir = ($instances =~ m/--$opt{i}-datadir=(.*)/)[0] +- or die "Can't determine --$opt{i}-datadir from 'my_print_defaults instances' output: $instances"; ++ or die "Can't determine --$opt{i}-datadir from '@mybin_my_print_defaults@ instances' output: $instances"; + warn "datadir=$datadir\n" if $opt{v}; + } + diff --git a/080_all_slot_script-r3.patch b/080_all_slot_script-r3.patch new file mode 100644 index 0000000..83210cc --- /dev/null +++ b/080_all_slot_script-r3.patch @@ -0,0 +1,541 @@ +diff -Naur mysql-5.0.16/scripts/Makefile.am mysql-5.0.16.new/scripts/Makefile.am +--- mysql-5.0.16/scripts/Makefile.am 2005-11-15 00:12:45.000000000 +0000 ++++ mysql-5.0.16.new/scripts/Makefile.am 2005-11-22 20:49:45.000000000 +0000 +@@ -66,6 +66,32 @@ + mysqlaccess.conf \ + mysqlbug + ++sql_libexec_REPLACE = mysqld ++instance_manager_libexec_REPLACE= mysqlmanager ++client_bin_REPLACE = mysql mysqladmin mysqlcheck mysqlshow \ ++ mysqldump mysqlimport mysqltest mysqlbinlog \ ++ mysqltestmanagerc mysqltestmanager-pwgen ++extra_bin_REPLACE = replace comp_err perror resolveip my_print_defaults \ ++ resolve_stack_dump mysql_waitpid innochecksum ++myisam_bin_REPLACE = myisamchk myisamlog myisampack myisam_ftdump ++tools_bin_REPLACE = mysqltestmanager ++cw_cpcd_ndbbin_REPLACE = ndb_cpcd ++kernel_ndbbin_REPLACE = ndbd ++mgmsrv_ndbbin_REPLACE = ndb_mgmd ++sql_bin_REPLACE = mysql_tzinfo_to_sql ++tests_bin_REPLACE = mysql_client_test ++ndbtools_bin_REPLACE = ndb_test_platform ndb_waiter \ ++ ndb_drop_table ndb_delete_all \ ++ ndb_desc ndb_drop_index \ ++ ndb_show_tables ndb_select_all \ ++ ndb_select_count ndb_restore ndb_config ++EXTRA_REPLACE_BIN = safe_mysqld mysqlanalyze mysqloptimize mysqlrepair mysqld-max isamchk \ ++ $(sql_libexec_REPLACE) $(ndbtools_bin_REPLACE) \ ++ $(instance_manager_libexec_REPLACE) $(client_bin_REPLACE) \ ++ $(extra_bin_REPLACE) $(myisam_bin_REPLACE) $(tools_bin_REPLACE) \ ++ $(cw_cpcd_ndbbin_REPLACE) $(kernel_ndbbin_REPLACE) $(mgmsrv_ndbbin_REPLACE) \ ++ $(sql_bin_REPLACE) $(tests_bin_REPLACE) ++ + dist_pkgdata_DATA = fill_help_tables.sql mysql_fix_privilege_tables.sql + + # mysqlbug should be distributed built so that people can report build +@@ -85,6 +111,8 @@ + mysql_find_rows \ + mysqlhotcopy \ + mysqldumpslow \ ++ mysql_explain_log \ ++ mysql_tableinfo \ + mysqld_multi \ + make_win_src_distribution \ + make_win_binary_distribution \ +@@ -99,8 +127,17 @@ + + .sh: + @RM@ -f $@ $@-t ++ bin_REPLACE='';\ ++ list='$(EXTRA_SCRIPTS) $(EXTRA_REPLACE_BIN)'; \ ++ for p in $${list}; do \ ++ f1=$${p/\.sh}; \ ++ f2=`echo "$${p}" | @SED@ -e 's|\.sh$$||' -e 's|^.*/||;$(transform)'`; \ ++ bin_REPLACE="$${bin_REPLACE}s!@mybin_$${f1}@!$${f2}!g;";\ ++ done; \ + @SED@ \ ++ -e "$${bin_REPLACE}" \ + -e 's!@''bindir''@!$(bindir)!g' \ ++ -e 's!@''sharedstatedir''@!$(sharedstatedir)!g' \ + -e 's!@''sbindir''@!$(sbindir)!g' \ + -e 's!@''scriptdir''@!$(bindir)!g' \ + -e 's!@''prefix''@!$(prefix)!g' \ +diff -Naur mysql-5.0.16/scripts/msql2mysql.sh mysql-5.0.16.new/scripts/msql2mysql.sh +--- mysql-5.0.16/scripts/msql2mysql.sh 2005-11-15 00:12:47.000000000 +0000 ++++ mysql-5.0.16.new/scripts/msql2mysql.sh 2005-11-22 20:49:45.000000000 +0000 +@@ -13,4 +13,4 @@ + # described in the License. Among other things, the License requires that + # the copyright notice and this notice be preserved on all copies. + +-@bindir@/replace msqlConnect mysql_connect msqlListDBs mysql_list_dbs msqlNumRows mysql_num_rows msqlFetchRow mysql_fetch_row msqlFetchField mysql_fetch_field msqlFreeResult mysql_free_result msqlListFields mysql_list_fields msqlListTables mysql_list_tables msqlErrMsg 'mysql_error(mysql)' msqlStoreResult mysql_store_result msqlQuery mysql_query msqlField mysql_field msqlSelect mysql_select msqlSelectDB mysql_select_db msqlNumFields mysql_num_fields msqlClose mysql_close msqlDataSeek mysql_data_seek m_field MYSQL_FIELD m_result MYSQL_RES m_row MYSQL_ROW msql mysql mSQL mySQL MSQL MYSQL msqlCreateDB mysql_create_db msqlDropDB mysql_drop_db msqlFieldSeek mysql_field_seek -- $* ++@bindir@/@mybin_replace@ msqlConnect mysql_connect msqlListDBs mysql_list_dbs msqlNumRows mysql_num_rows msqlFetchRow mysql_fetch_row msqlFetchField mysql_fetch_field msqlFreeResult mysql_free_result msqlListFields mysql_list_fields msqlListTables mysql_list_tables msqlErrMsg 'mysql_error(mysql)' msqlStoreResult mysql_store_result msqlQuery mysql_query msqlField mysql_field msqlSelect mysql_select msqlSelectDB mysql_select_db msqlNumFields mysql_num_fields msqlClose mysql_close msqlDataSeek mysql_data_seek m_field MYSQL_FIELD m_result MYSQL_RES m_row MYSQL_ROW msql mysql mSQL mySQL MSQL MYSQL msqlCreateDB mysql_create_db msqlDropDB mysql_drop_db msqlFieldSeek mysql_field_seek -- $* +diff -Naur mysql-5.0.16/scripts/mysql_config.sh mysql-5.0.16.new/scripts/mysql_config.sh +--- mysql-5.0.16/scripts/mysql_config.sh 2005-11-15 00:12:33.000000000 +0000 ++++ mysql-5.0.16.new/scripts/mysql_config.sh 2005-11-22 20:49:45.000000000 +0000 +@@ -77,7 +77,7 @@ + + me=`get_full_path $0` + +-basedir=`echo $me | sed -e 's;/bin/mysql_config;;'` ++basedir=`echo $me | sed -e 's;/bin/@mybin_mysql_config@;;'` + + ldata='@localstatedir@' + execdir='@libexecdir@' +diff -Naur mysql-5.0.16/scripts/mysql_create_system_tables.sh mysql-5.0.16.new/scripts/mysql_create_system_tables.sh +--- mysql-5.0.16/scripts/mysql_create_system_tables.sh 2005-11-15 00:12:45.000000000 +0000 ++++ mysql-5.0.16.new/scripts/mysql_create_system_tables.sh 2005-11-22 20:49:45.000000000 +0000 +@@ -19,7 +19,7 @@ + new context from the manual (from fill_help_tables.sql). + + Usage: +- mysql_create_system_tables [test|verbose|real] <path to mysql-database directory> <hostname> <windows option> ++ @mybin_mysql_create_system_tables@ [test|verbose|real] <path to mysql-database directory> <hostname> <windows option> + " + exit + fi +diff -Naur mysql-5.0.16/scripts/mysql_fix_privilege_tables.sh mysql-5.0.16.new/scripts/mysql_fix_privilege_tables.sh +--- mysql-5.0.16/scripts/mysql_fix_privilege_tables.sh 2005-11-15 00:12:47.000000000 +0000 ++++ mysql-5.0.16.new/scripts/mysql_fix_privilege_tables.sh 2005-11-22 20:49:45.000000000 +0000 +@@ -77,17 +77,17 @@ + # Get first arguments from the my.cfg file, groups [mysqld] and + # [mysql_install_db], and then merge with the command line arguments + +-print_defaults=my_print_defaults ++print_defaults=@mybin_my_print_defaults@ + for dir in ./bin @bindir@ @bindir@ extra $print_defaults_bindir/../bin $print_defaults_bindir/../extra + do +- if test -x $dir/my_print_defaults ++ if test -x $dir/@mybin_my_print_defaults@ + then +- print_defaults="$dir/my_print_defaults" ++ print_defaults="$dir/@mybin_my_print_defaults@" + break + fi + done + +-parse_arguments `$print_defaults $defaults mysql_install_db mysql_fix_privilege_tables` ++parse_arguments `$print_defaults $defaults @mybin_mysql_install_db@ @mybin_mysql_fix_privilege_tables@` + parse_arguments PICK-ARGS-FROM-ARGV "$@" + + if test -z "$password" +@@ -118,7 +118,7 @@ + exit 1 + fi + +-cmd="$bindir/mysql --no-defaults --force --user=$user --host=$host" ++cmd="$bindir/@mybin_mysql@ --no-defaults --force --user=$user --host=$host" + if test ! -z "$password" ; then + cmd="$cmd --password=$password" + fi +@@ -136,7 +136,7 @@ + fi + + # Find where first mysql_fix_privilege_tables.sql is located +-for i in $basedir/support-files $basedir/share $basedir/share/mysql \ ++for i in @sharedstatedir@ $basedir/support-files $basedir/share $basedir/share/mysql \ + $basedir/scripts $pkgdatadir . "$dirname" + do + if test -f $i/$file +diff -Naur mysql-5.0.16/scripts/mysql_install_db.sh mysql-5.0.16.new/scripts/mysql_install_db.sh +--- mysql-5.0.16/scripts/mysql_install_db.sh 2005-11-15 00:12:35.000000000 +0000 ++++ mysql-5.0.16.new/scripts/mysql_install_db.sh 2005-11-22 20:49:45.000000000 +0000 +@@ -57,20 +57,20 @@ + + # Get first arguments from the my.cfg file, groups [mysqld] and + # [mysql_install_db], and then merge with the command line arguments +-if test -x ./bin/my_print_defaults ++if test -x "./bin/@mybin_my_print_defaults@" + then +- print_defaults="./bin/my_print_defaults" +-elif test -x ./extra/my_print_defaults ++ print_defaults="./bin/@mybin_my_print_defaults@" ++elif test -x "./extra/@mybin_my_print_defaults@" + then +- print_defaults="./extra/my_print_defaults" +-elif test -x @bindir@/my_print_defaults ++ print_defaults="./extra/@mybin_my_print_defaults@" ++elif test -x "@bindir@/@mybin_my_print_defaults@" + then +- print_defaults="@bindir@/my_print_defaults" +-elif test -x @bindir@/mysql_print_defaults ++ print_defaults="@bindir@/@mybin_my_print_defaults@" ++elif test -x "@bindir@/@mybin_my_print_defaults@" + then +- print_defaults="@bindir@/mysql_print_defaults" ++ print_defaults="@bindir@/@mybin_my_print_defaults@" + else +- print_defaults="my_print_defaults" ++ print_defaults="@mybin_my_print_defaults@" + fi + + args= +@@ -94,10 +94,10 @@ + pkgdatadir=@pkgdatadir@ + else + bindir="$basedir/bin" +- if test -x "$basedir/libexec/mysqld" ++ if test -x "$basedir/libexec/@mybin_mysqld@" + then + execdir="$basedir/libexec" +- elif test -x "$basedir/sbin/mysqld" ++ elif test -x "$basedir/sbin/@mybin_mysqld@" + then + execdir="$basedir/sbin" + else +@@ -106,7 +106,7 @@ + fi + + # find fill_help_tables.sh +-for i in $basedir/support-files $basedir/share $basedir/share/mysql $basedir/scripts `pwd` `pwd`/scripts @pkgdatadir@ ++for i in @sharedstatedir@ $basedir/support-files $basedir/share $basedir/share/mysql $basedir/scripts `pwd` `pwd`/scripts @pkgdatadir@ + do + if test -f $i/fill_help_tables.sql + then +@@ -123,13 +123,13 @@ + fi + + mdata=$ldata/mysql +-mysqld=$execdir/mysqld ++mysqld=$execdir/@mybin_mysqld@ + mysqld_opt="" + scriptdir=$bindir + + if test "$windows" = 1 + then +- mysqld="./sql/mysqld" ++ mysqld="./sql/@mybin_mysqld@" + mysqld_opt="--language=./sql/share/english" + scriptdir="./scripts" + fi +@@ -153,14 +153,14 @@ + # Check if hostname is valid + if test "$windows" = 0 -a "$in_rpm" = 0 -a $force = 0 + then +- resolved=`$bindir/resolveip $hostname 2>&1` ++ resolved=`$bindir/@mybin_resolveip@ $hostname 2>&1` + if [ $? -ne 0 ] + then +- resolved=`$bindir/resolveip localhost 2>&1` ++ resolved=`$bindir/@mybin_resolveip@ localhost 2>&1` + if [ $? -ne 0 ] + then + echo "Neither host '$hostname' nor 'localhost' could be looked up with" +- echo "$bindir/resolveip" ++ echo "$bindir/@mybin_resolveip@" + echo "Please configure the 'hostname' command to return a correct hostname." + echo "If you want to solve this at a later stage, restart this script with" + echo "the --force option" +@@ -168,7 +168,7 @@ + fi + echo "WARNING: The host '$hostname' could not be looked up with resolveip." + echo "This probably means that your libc libraries are not 100 % compatible" +- echo "with this binary MySQL version. The MySQL daemon, mysqld, should work" ++ echo "with this binary MySQL version. The MySQL daemon, @mybin_mysqld@, should work" + echo "normally with the exception that host name resolving will not work." + echo "This means that you should use IP addresses instead of hostnames" + echo "when specifying MySQL privileges !" +@@ -213,7 +213,7 @@ + mysqld_install_cmd_line="$mysqld $defaults $mysqld_opt --bootstrap \ + --skip-grant-tables --basedir=$basedir --datadir=$ldata --skip-innodb \ + --skip-bdb --skip-ndbcluster $args --max_allowed_packet=8M --net_buffer_length=16K" +-if $scriptdir/mysql_create_system_tables $create_option $mdata $hostname $windows \ ++if $scriptdir/@mybin_mysql_create_system_tables@ $create_option $mdata $hostname $windows \ + | eval "$mysqld_install_cmd_line" + then + if test -n "$fill_help_tables" +@@ -243,8 +243,8 @@ + then + echo "PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !" + echo "To do so, start the server, then issue the following commands:" +- echo "$bindir/mysqladmin -u root password 'new-password'" +- echo "$bindir/mysqladmin -u root -h $hostname password 'new-password'" ++ echo "$bindir/@mybin_mysqladmin@ -u root password 'new-password'" ++ echo "$bindir/@mybin_mysqladmin@ -u root -h $hostname password 'new-password'" + echo "See the manual for more instructions." + # + # Print message about upgrading unless we have created a new db table. +@@ -252,14 +252,14 @@ + then + echo + echo "NOTE: If you are upgrading from a MySQL <= 3.22.10 you should run" +- echo "the $bindir/mysql_fix_privilege_tables. Otherwise you will not be" ++ echo "the $bindir/@mybin_mysql_fix_privilege_tables@. Otherwise you will not be" + echo "able to use the new GRANT command!" + fi + echo + if test "$in_rpm" = "0" + then + echo "You can start the MySQL daemon with:" +- echo "cd @prefix@ ; $bindir/mysqld_safe &" ++ echo "cd @prefix@ ; $bindir/@mybin_mysqld_safe@ &" + echo + echo "You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:" + echo "cd sql-bench ; perl run-all-tests" +@@ -279,13 +279,13 @@ + echo "You can also try to start the mysqld daemon with:" + echo "$mysqld --skip-grant &" + echo "You can use the command line tool" +- echo "$bindir/mysql to connect to the mysql" ++ echo "$bindir/@mybin_mysql@ to connect to the mysql" + echo "database and look at the grant tables:" + echo +- echo "shell> $bindir/mysql -u root mysql" ++ echo "shell> $bindir/@mybin_mysql@ -u root mysql" + echo "mysql> show tables" + echo +- echo "Try 'mysqld --help' if you have problems with paths. Using --log" ++ echo "Try '@mybin_mysqld@ --help' if you have problems with paths. Using --log" + echo "gives you a log in $ldata that may be helpful." + echo + echo "The latest information about MySQL is available on the web at" +@@ -294,6 +294,6 @@ + echo "and the manual section that describes problems on your OS." + echo "Another information source is the MySQL email archive." + echo "Please check all of the above before mailing us!" +- echo "And if you do mail us, you MUST use the @scriptdir@/mysqlbug script!" ++ echo "And if you do mail us, you MUST use the @scriptdir@/@mybin_mysqlbug@ script!" + exit 1 + fi +diff -Naur mysql-5.0.16/scripts/mysql_secure_installation.sh mysql-5.0.16.new/scripts/mysql_secure_installation.sh +--- mysql-5.0.16/scripts/mysql_secure_installation.sh 2005-11-15 00:12:47.000000000 +0000 ++++ mysql-5.0.16.new/scripts/mysql_secure_installation.sh 2005-11-22 20:49:45.000000000 +0000 +@@ -30,7 +30,7 @@ + + do_query() { + echo $1 >$command +- mysql --defaults-file=$config <$command ++ @mybin_mysql@ --defaults-file=$config <$command + return $? + } + +diff -Naur mysql-5.0.16/scripts/mysqlaccess.sh mysql-5.0.16.new/scripts/mysqlaccess.sh +--- mysql-5.0.16/scripts/mysqlaccess.sh 2005-11-15 00:12:32.000000000 +0000 ++++ mysql-5.0.16.new/scripts/mysqlaccess.sh 2005-11-22 20:49:45.000000000 +0000 +@@ -17,7 +17,7 @@ + + # **************************** + # information on MySQL +- $MYSQL = '@bindir@/mysql'; # path to mysql executable ++ $MYSQL = '@bindir@/@mybin_mysql@'; # path to mysql executable + $SERVER = '3.21'; + $MYSQL_OPT = ' --batch --unbuffered'; + $ACCESS_DB = 'mysql'; # name of DB with grant-tables +@@ -32,7 +32,7 @@ + $ACCESS_U_BCK = 'user_backup'; + $ACCESS_D_BCK = 'db_backup'; + $DIFF = '/usr/bin/diff'; +- $MYSQLDUMP = '@bindir@/mysqldump'; ++ $MYSQLDUMP = '@bindir@/@mybin_mysqldump@'; + #path to mysqldump executable + + $MYSQLADMIN= 'http://foobar.com/MySQLadmin'; +diff -Naur mysql-5.0.16/scripts/mysqld_multi.sh mysql-5.0.16.new/scripts/mysqld_multi.sh +--- mysql-5.0.16/scripts/mysqld_multi.sh 2005-11-15 00:12:46.000000000 +0000 ++++ mysql-5.0.16.new/scripts/mysqld_multi.sh 2005-11-22 20:49:45.000000000 +0000 +@@ -10,8 +10,8 @@ + $opt_example = 0; + $opt_help = 0; + $opt_log = undef(); +-$opt_mysqladmin = "@bindir@/mysqladmin"; +-$opt_mysqld = "@libexecdir@/mysqld"; ++$opt_mysqladmin = "@bindir@/@mybin_mysqladmin@"; ++$opt_mysqld = "@libexecdir@/@mybin_mysqld@"; + $opt_no_log = 0; + $opt_password = undef(); + $opt_tcp_ip = 0; +@@ -39,11 +39,11 @@ + { + my $flag_exit= 0; + +- if (!defined(my_which(my_print_defaults))) ++ if (!defined(my_which(@mybin_my_print_defaults@))) + { + # We can't throw out yet, since --version, --help, or --example may + # have been given +- print "WARNING: my_print_defaults command not found.\n"; ++ print "WARNING: @mybin_my_print_defaults@ command not found.\n"; + print "Please make sure you have this command available and\n"; + print "in your path. The command is available from the latest\n"; + print "MySQL distribution.\n"; +@@ -74,9 +74,9 @@ + } + } + } +- my $com= "my_print_defaults "; ++ my $com= "@mybin_my_print_defaults@ "; + $com.= "--config-file=$opt_config_file " if (defined($opt_config_file)); +- $com.= "mysqld_multi"; ++ $com.= "@mybin_mysqld_multi@"; + my @defops = `$com`; + chop @defops; + splice @ARGV, 0, 0, @defops; +@@ -113,9 +113,9 @@ + print "Error with an option, see $my_progname --help for more info.\n"; + exit(1); + } +- if (!defined(my_which(my_print_defaults))) ++ if (!defined(my_which(@mybin_my_print_defaults@))) + { +- print "ABORT: Can't find command 'my_print_defaults'.\n"; ++ print "ABORT: Can't find command '@mybin_my_print_defaults@'.\n"; + print "This command is available from the latest MySQL\n"; + print "distribution. Please make sure you have the command\n"; + print "in your PATH.\n"; +@@ -202,7 +202,7 @@ + { + if ($my_print_defaults_exists) + { +- @mysqld_opts= `my_print_defaults mysqld`; ++ @mysqld_opts= `@mybin_my_print_defaults@ mysqld`; + chomp @mysqld_opts; + foreach my $opt (@mysqld_opts) + { +@@ -303,7 +303,7 @@ + @groups = &find_groups($groupids); + for ($i = 0; defined($groups[$i]); $i++) + { +- $com = "my_print_defaults"; ++ $com = "@mybin_my_print_defaults@"; + $com.= defined($opt_config_file) ? " --config-file=$opt_config_file" : ""; + $com.= " $groups[$i]"; + @options = `$com`; +@@ -330,7 +330,7 @@ + $tmp.= " $options[$j]"; + } + } +- if ($opt_verbose && $com =~ m/\/safe_mysqld$/ && !$info_sent) ++ if ($opt_verbose && $com =~ m/\/@mybin_safe_mysqld@$/ && !$info_sent) + { + print "WARNING: safe_mysqld is being used to start mysqld. In this case you "; + print "may need to pass\n\"ledir=...\" under groups [mysqldN] to "; +@@ -401,7 +401,7 @@ + my ($i, @groups)= @_; + my ($mysqladmin_found, $com, $tmp, $j); + +- $com = "my_print_defaults"; ++ $com = "@mybin_my_print_defaults@"; + $com.= defined($opt_config_file) ? " --config-file=$opt_config_file" : ""; + $com.= " $groups[$i]"; + @options = `$com`; +diff -Naur mysql-5.0.16/scripts/mysqld_safe.sh mysql-5.0.16.new/scripts/mysqld_safe.sh +--- mysql-5.0.16/scripts/mysqld_safe.sh 2005-11-15 00:12:47.000000000 +0000 ++++ mysql-5.0.16.new/scripts/mysqld_safe.sh 2005-11-22 20:51:30.000000000 +0000 +@@ -87,7 +87,7 @@ + then + MYSQLD="mysqld-$tmp" + else +- MYSQLD="mysqld" ++ MYSQLD="@mybin_mysqld@" + fi + ;; + --nice=*) niceness=`echo "$arg" | sed -e "s;--nice=;;"` ;; +@@ -113,13 +113,13 @@ + + MY_PWD=`pwd` + # Check for the directories we would expect from a binary release install +-if test -f ./share/mysql/english/errmsg.sys -a -x ./bin/mysqld ++if test -f ./share/mysql/english/errmsg.sys -a -x ./bin/@mybin_mysqld@ + then + MY_BASEDIR_VERSION=$MY_PWD # Where bin, share and data are + ledir=$MY_BASEDIR_VERSION/bin # Where mysqld is + # Check for the directories we would expect from a source install + elif test -f ./share/mysql/english/errmsg.sys -a \ +- -x ./libexec/mysqld ++ -x ./libexec/@mybin_mysqld@ + then + MY_BASEDIR_VERSION=$MY_PWD # Where libexec, share and var are + ledir=$MY_BASEDIR_VERSION/libexec # Where mysqld is +@@ -181,17 +181,17 @@ + + # Get first arguments from the my.cnf file, groups [mysqld] and [mysqld_safe] + # and then merge with the command line arguments +-if test -x ./bin/my_print_defaults ++if test -x "./bin/@mybin_my_print_defaults@" + then +- print_defaults="./bin/my_print_defaults" +-elif test -x @bindir@/my_print_defaults ++ print_defaults="./bin/@mybin_my_print_defaults@" ++elif test -x "@bindir@/@mybin_my_print_defaults@" + then +- print_defaults="@bindir@/my_print_defaults" +-elif test -x @bindir@/mysql_print_defaults ++ print_defaults="@bindir@/@mybin_my_print_defaults@" ++elif test -x "@bindir@/@mybin_my_print_defaults@" + then +- print_defaults="@bindir@/mysql_print_defaults" ++ print_defaults="@bindir@/@mybin_my_print_defaults@" + else +- print_defaults="my_print_defaults" ++ print_defaults="@mybin_my_print_defaults@" + fi + + args= +@@ -216,11 +216,11 @@ + # Use the mysqld-max binary by default if the user doesn't specify a binary + if test -z "$MYSQLD" + then +- if test -x $ledir/mysqld-max ++ if test -x $ledir/@mybin_mysqld-max@ + then +- MYSQLD=mysqld-max ++ MYSQLD=@mybin_mysqld-max@ + else +- MYSQLD=mysqld ++ MYSQLD=@mybin_mysqld@ + fi + fi + +@@ -229,7 +229,7 @@ + echo "The file $ledir/$MYSQLD doesn't exist or is not executable" + echo "Please do a cd to the mysql installation directory and restart" + echo "this script from there as follows:" +- echo "./bin/mysqld_safe". ++ echo "./bin/@mybin_mysqld_safe@". + echo "See http://dev.mysql.com/doc/mysql/en/mysqld_safe.html for more" + echo "information" + exit 1 +@@ -362,8 +362,8 @@ + # the manual for details. + # + # echo "Checking tables in $DATADIR" +-# $MY_BASEDIR_VERSION/bin/myisamchk --silent --force --fast --medium-check $DATADIR/*/*.MYI +-# $MY_BASEDIR_VERSION/bin/isamchk --silent --force $DATADIR/*/*.ISM ++# $MY_BASEDIR_VERSION/bin/@mybin_myisamchk@ --silent --force --fast --medium-check $DATADIR/*/*.MYI ++# $MY_BASEDIR_VERSION/bin/@mybin_isamchk@ --silent --force $DATADIR/*/*.ISM + + echo "Starting $MYSQLD daemon with databases from $DATADIR" + +diff -Naur mysql-5.0.16/scripts/mysqldumpslow.sh mysql-5.0.16.new/scripts/mysqldumpslow.sh +--- mysql-5.0.16/scripts/mysqldumpslow.sh 2005-11-15 00:12:47.000000000 +0000 ++++ mysql-5.0.16.new/scripts/mysqldumpslow.sh 2005-11-22 20:49:45.000000000 +0000 +@@ -34,16 +34,16 @@ + $opt{'help'} and usage(); + + unless (@ARGV) { +- my $defaults = `my_print_defaults mysqld`; ++ my $defaults = `@mybin_my_print_defaults@ mysqld`; + my $basedir = ($defaults =~ m/--basedir=(.*)/)[0] +- or die "Can't determine basedir from 'my_print_defaults mysqld' output: $defaults"; ++ or die "Can't determine basedir from '@mybin_my_print_defaults@ mysqld' output: $defaults"; + warn "basedir=$basedir\n" if $opt{v}; + + my $datadir = ($defaults =~ m/--datadir=(.*)/)[0]; + if (!$datadir or $opt{i}) { + # determine the datadir from the instances section of /etc/my.cnf, if any +- my $instances = `my_print_defaults instances`; +- die "Can't determine datadir from 'my_print_defaults mysqld' output: $defaults" ++ my $instances = `@mybin_my_print_defaults@ instances`; ++ die "Can't determine datadir from '@mybin_my_print_defaults@ mysqld' output: $defaults" + unless $instances; + my @instances = ($instances =~ m/^--(\w+)-/mg); + die "No -i 'instance_name' specified to select among known instances: @instances.\n" +@@ -51,7 +51,7 @@ + die "Instance '$opt{i}' is unknown (known instances: @instances)\n" + unless grep { $_ eq $opt{i} } @instances; + $datadir = ($instances =~ m/--$opt{i}-datadir=(.*)/)[0] +- or die "Can't determine --$opt{i}-datadir from 'my_print_defaults instances' output: $instances"; ++ or die "Can't determine --$opt{i}-datadir from '@mybin_my_print_defaults@ instances' output: $instances"; + warn "datadir=$datadir\n" if $opt{v}; + } + diff --git a/mysql-4.0.23-install-db-sh.diff b/090_all_install-db-sh.patch index fe3d8d3..85382c7 100644 --- a/mysql-4.0.23-install-db-sh.diff +++ b/090_all_install-db-sh.patch @@ -5,14 +5,14 @@ fi echo "PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !" - echo "To do so, start the server, then issue the following commands:" -- echo "$bindir/mysqladmin -u root password 'new-password'" -- echo "$bindir/mysqladmin -u root -h $hostname password 'new-password'" +- echo "$bindir/@mybin_mysqladmin@ -u root password 'new-password'" +- echo "$bindir/@mybin_mysqladmin@ -u root -h $hostname password 'new-password'" - echo "See the manual for more instructions." + echo "To do so, issue the following commands to start the server" + echo "and change the applicable passwords:" + echo " /etc/init.d/mysql start" -+ echo " $bindir/mysqladmin -u root -h $hostname password 'new-password'" -+ echo " $bindir/mysqladmin -u root password 'new-password'" ++ echo " $bindir/@mybin_mysqladmin@ -u root -h $hostname password 'new-password'" ++ echo " $bindir/@mybin_mysqladmin@ -u root password 'new-password'" + echo "Depending on your configuration, a -p option may be needed" + echo "in the last command. See the manual for more details." # diff --git a/mysql-4.0-nisam.h.diff b/110_all_nisam.h.patch index c8d9d67..3b202e3 100644 --- a/mysql-4.0-nisam.h.diff +++ b/110_all_nisam.h.patch @@ -1,11 +1,11 @@ --- include/nisam.h~ Sat Jun 22 18:03:36 2002 +++ include/nisam.h Sat Jun 22 18:03:53 2002 @@ -30,7 +30,7 @@ - + #define N_MAXKEY 16 /* Max allowed keys */ #define N_MAXKEY_SEG 16 /* Max segments for key */ -#define N_MAX_KEY_LENGTH 256 /* May be increased up to 500 */ +#define N_MAX_KEY_LENGTH 500 /* May be increased up to 500 */ #define N_MAX_KEY_BUFF (N_MAX_KEY_LENGTH+N_MAXKEY_SEG+sizeof(double)-1) #define N_MAX_POSSIBLE_KEY_BUFF 500+9 - + diff --git a/701_all_test-myisam-geometry.patch b/701_all_test-myisam-geometry.patch deleted file mode 100644 index 536c92a..0000000 --- a/701_all_test-myisam-geometry.patch +++ /dev/null @@ -1,26 +0,0 @@ -###MY_VER_RANGE [4.1.3_alpha,4.1.14_alpha20050808) - -# MySQL Bugs: #11083: myisam.test fail w/ --without-geometry - ---- mysql.orig/mysql-test/t/myisam.test 2005-05-26 16:55:48.000000000 +0200 -+++ mysql.fix/mysql-test/t/myisam.test 2005-06-03 21:26:28.000000000 +0200 -@@ -479,7 +479,7 @@ - # - # Test RTREE index - # ----error 1235 -+--error 1235,1289 - CREATE TABLE t1 (`a` int(11) NOT NULL default '0', `b` int(11) NOT NULL default '0', UNIQUE KEY `a` USING RTREE (`a`,`b`)) ENGINE=MyISAM; - # INSERT INTO t1 VALUES (1,1),(1,1); - # DELETE FROM rt WHERE a<1; ---- mysql.orig/mysql-test/r/myisam.result 2005-05-26 16:55:48.000000000 +0200 -+++ mysql.fix/mysql-test/r/myisam.result 2005-06-03 21:27:20.000000000 +0200 -@@ -506,7 +506,7 @@ - 1 SIMPLE t2 index NULL PRIMARY 4 NULL 2 Using index; Distinct - drop table t1,t2; - CREATE TABLE t1 (`a` int(11) NOT NULL default '0', `b` int(11) NOT NULL default '0', UNIQUE KEY `a` USING RTREE (`a`,`b`)) ENGINE=MyISAM; --ERROR 42000: This version of MySQL doesn't yet support 'RTREE INDEX' -+Got one of the listed errors - create table t1 (a int, b varchar(200), c text not null) checksum=1; - create table t2 (a int, b varchar(200), c text not null) checksum=0; - insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, ""); diff --git a/703_all_test-rpl_rotate_logs.patch b/703_all_test-rpl_rotate_logs.patch index 9fd3079..76fd8f2 100644 --- a/703_all_test-rpl_rotate_logs.patch +++ b/703_all_test-rpl_rotate_logs.patch @@ -1,10 +1,3 @@ -###MY_VER_RANGE [5.0.6_beta,5.1.0_alpha) [5.1.0_alpha,) - -# MySQL Bugs: #9763: Test rpl_rotate_logs fails in default mode and with --force -# Error: 1201 SQLSTATE: HY000 (ER_MASTER_INFO) -# Message: Could not initialize master info structure; more error messages can be found in the MySQL -# error log - --- mysql.orig/mysql-test/t/rpl_rotate_logs.test 2005-05-26 16:55:48.000000000 +0200 +++ mysql.fix/mysql-test/t/rpl_rotate_logs.test 2005-06-03 20:21:51.000000000 +0200 @@ -24,7 +24,7 @@ diff --git a/705_all_view_geometry.patch b/705_all_view_geometry.patch deleted file mode 100644 index 53c2367..0000000 --- a/705_all_view_geometry.patch +++ /dev/null @@ -1,71 +0,0 @@ -###MY_VER_RANGE [5.0.11_beta,5.0.12_beta] [5.1,) -diff -Naur mysql.orig/mysql-test/r/view.result mysql.new/mysql-test/r/view.result ---- mysql.orig/mysql-test/r/view.result 2005-08-13 04:20:59.000000000 +0200 -+++ mysql.new/mysql-test/r/view.result 2005-08-13 04:29:43.000000000 +0200 -@@ -2021,17 +2021,6 @@ - DROP PROCEDURE p1; - DROP VIEW v1; - DROP TABLE t1; --create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime); --create view v1 as select * from t1; --desc v1; --Field Type Null Key Default Extra --f1 tinyint(1) YES NULL --f2 char(1) YES NULL --f3 varchar(1) YES NULL --f4 geometry YES NULL --f5 datetime YES NULL --drop view v1; --drop table t1; - create table t1(f1 datetime); - insert into t1 values('2005.01.01 12:0:0'); - create view v1 as select f1, subtime(f1, '1:1:1') as sb from t1; -diff -Naur mysql.orig/mysql-test/t/gis-view.test mysql.new/mysql-test/t/gis-view.test ---- mysql.orig/mysql-test/t/gis-view.test 1970-01-01 01:00:00.000000000 +0100 -+++ mysql.new/mysql-test/t/gis-view.test 2005-08-13 04:27:30.000000000 +0200 -@@ -0,0 +1,11 @@ -+-- source include/have_geometry.inc -+ -+# -+# Bug #11335 View redefines column types -+# -+create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime); -+create view v1 as select * from t1; -+desc v1; -+drop view v1; -+drop table t1; -+ -diff -Naur mysql.orig/mysql-test/t/view.test mysql.new/mysql-test/t/view.test ---- mysql.orig/mysql-test/t/view.test 2005-08-13 04:20:44.000000000 +0200 -+++ mysql.new/mysql-test/t/view.test 2005-08-13 04:28:53.000000000 +0200 -@@ -1856,15 +1856,6 @@ - DROP TABLE t1; - - # --# Bug #11335 View redefines column types --# --create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime); --create view v1 as select * from t1; --desc v1; --drop view v1; --drop table t1; -- --# - # Bug #11760 Typo in Item_func_add_time::print() results in NULLs returned - # subtime() in view - create table t1(f1 datetime); -diff -Naur mysql.orig/mysql-test/r/gis-view.result mysql.new/mysql-test/r/gis-view.result ---- mysql.orig/mysql-test/r/gis-view.result 1970-01-01 01:00:00.000000000 +0100 -+++ mysql.new/mysql-test/r/gis-view.result 2005-08-15 19:11:19.000000000 +0200 -@@ -0,0 +1,11 @@ -+create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime); -+create view v1 as select * from t1; -+desc v1; -+Field Type Null Key Default Extra -+f1 tinyint(1) YES NULL -+f2 char(1) YES NULL -+f3 varchar(1) YES NULL -+f4 geometry YES NULL -+f5 datetime YES NULL -+drop view v1; -+drop table t1; diff --git a/fill_help_tables.sql-5.0.15 b/fill_help_tables.sql-5.0.15 new file mode 100644 index 0000000..34ebe19 --- /dev/null +++ b/fill_help_tables.sql-5.0.15 @@ -0,0 +1,113 @@ +-- Copyright (C) 2000-2005 MySQL AB +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +delete from help_topic; +delete from help_category; +delete from help_keyword; +delete from help_relation; + +insert into help_category (help_category_id,name,parent_category_id) values (0,"Polygon properties",24),(1,"Column Types",15),(2,"Geometry constructors",24),(3,"WKT",24),(4,"Numeric Functions",22),(5,"GeometryCollection properties",24),(6,"Data Manipulation",15),(7,"Administration",15),(8,"MBR",24),(9,"Control flow functions",22),(10,"Transactions",15),(11,"Geometry relations",24),(12,"Functions and Modifiers for Use with GROUP BY Clauses",22),(13,"WKB",24),(14,"Date and Time Functions",22); +insert into help_category (help_category_id,name,parent_category_id) values (15,"Contents",-1),(16,"Point properties",24),(17,"Encryption Functions",22),(18,"LineString properties",24),(19,"Geometry properties",24),(20,"Logical operators",22),(21,"Miscellaneous Functions",22),(22,"Functions",15),(23,"String Functions",22),(24,"Geographic features",15),(25,"Information Functions",22),(26,"Comparison operators",22),(27,"Bit Functions",22),(28,"Data Definition",15); + +insert into help_topic (help_topic_id,help_category_id,name,description,example) values (0,6,"JOIN","MySQL supports the following JOIN syntaxes for the\ntable_references part of SELECT statements and multiple-table\nDELETE and UPDATE statements:\n\ntable_reference, table_reference\ntable_reference [INNER | CROSS] JOIN table_reference [join_condition]\ntable_reference STRAIGHT_JOIN table_reference\ntable_reference LEFT [OUTER] JOIN table_reference join_condition\ntable_reference NATURAL [LEFT [OUTER]] JOIN table_reference\n{ OJ table_reference LEFT OUTER JOIN table_reference\n ON conditional_expr }\ntable_reference RIGHT [OUTER] JOIN table_reference join_condition\ntable_reference NATURAL [RIGHT [OUTER]] JOIN table_reference\n\ntable_reference is defined as:\n\ntbl_name [[AS] alias]\n [[USE INDEX (key_list)]\n | [IGNORE INDEX (key_list)]\n | [FORCE INDEX (key_list)]]\n\njoin_condition is defined as:\n\nON conditional_expr | USING (column_list)\n","mysql> SELECT table1.* FROM table1\n -> LEFT JOIN table2 ON table1.id=table2.id\n -> WHERE table2.id IS NULL;"),(1,23,"HEX"," HEX(N_or_S)\n\nIf N_OR_S is a number, returns a string representation of the hexadecimal\nvalue of N, where N is a longlong (BIGINT) number.\nThis is equivalent to CONV(N,10,16).\n\nFrom MySQL 4.0.1 and up,\nif N_OR_S is a string, returns a hexadecimal string of N_OR_S\nwhere each character in N_OR_S is converted to two hexadecimal digits.\n","mysql> SELECT HEX(255);\n -> 'FF'\nmysql> SELECT 0x616263;\n -> 'abc'\nmysql> SELECT HEX('abc');\n -> 616263"),(2,23,"REPLACE"," REPLACE(str,from_str,to_str)\nReturns the string str with all occurrences of the string\nfrom_str replaced by the string to_str.\n","mysql> SELECT REPLACE('www.mysql.com', 'w', 'Ww');\n -> 'WwWwWw.mysql.com'"),(3,23,"REPEAT"," REPEAT(str,count)\nReturns a string consisting of the string str repeated count\ntimes. If count <= 0, returns an empty string. Returns NULL if\nstr or count are NULL.\n","mysql> SELECT REPEAT('MySQL', 3);\n -> 'MySQLMySQLMySQL'"),(4,11,"CONTAINS"," Contains(g1,g2)\nReturns 1 or 0 to indicate whether or not g1 completely contains\ng2.\n",""),(5,19,"SRID"," SRID(g)\nReturns an integer indicating the Spatial Reference System ID for the geometry\nvalue g.\n\nIn MySQL, the SRID value is just an integer associated with the geometry\nvalue. All calculations are done assuming Euclidean (planar) geometry.\n","mysql> SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));\n+-----------------------------------------------+\n| SRID(GeomFromText('LineString(1 1,2 2)',101)) |\n+-----------------------------------------------+\n| 101 |\n+-----------------------------------------------+"),(6,14,"CURRENT_TIMESTAMP"," CURRENT_TIMESTAMP\n CURRENT_TIMESTAMP()\n\nCURRENT_TIMESTAMP and CURRENT_TIMESTAMP() are synonyms for\nNOW().\n",""),(7,12,"VARIANCE"," VARIANCE(expr)\nReturns the population standard variance of expr. This is an\nextension to standard SQL, available in MySQL 4.1 or later. As of MySQL\n5.0.3, the standard SQL function VAR_POP() can be used instead.\n",""),(8,12,"VAR_SAMP"," VAR_SAMP(expr)\nReturns the sample variance of expr. That is, the denominator is the\nnumber of rows minus one. This function was added in MySQL 5.0.3.\n",""),(9,23,"CONCAT"," CONCAT(str1,str2,...)\nReturns the string that results from concatenating the arguments. Returns\nNULL if any argument is NULL. May have one or more arguments.\nIf all arguments are non-binary strings, the result is a non-binary string.\nIf the arguments include any binary strings, the result is a binary string.\nA numeric argument is converted to its equivalent binary string form.\n","mysql> SELECT CONCAT('My', 'S', 'QL');\n -> 'MySQL'\nmysql> SELECT CONCAT('My', NULL, 'QL');\n -> NULL\nmysql> SELECT CONCAT(14.3);\n -> '14.3'"),(10,24,"GEOMETRY HIERARCHY","Geometry is the base class. It's an abstract class.\nThe instantiable subclasses of Geometry are restricted to zero-, one-,\nand two-dimensional geometric objects that exist in\ntwo-dimensional coordinate space. All instantiable geometry classes are\ndefined so that valid instances of a geometry class are topologically closed\n(that is, all defined geometries include their boundary).\n\nThe base Geometry class has subclasses for Point,\nCurve, Surface, and GeometryCollection:\n\n\n --- Point represents zero-dimensional objects.\n\n --- Curve represents one-dimensional objects, and has subclass\nLineString, with sub-subclasses Line and LinearRing.\n\n --- Surface is designed for two-dimensional objects and\nhas subclass Polygon.\n\n --- GeometryCollection\nhas specialized zero-, one-, and two-dimensional collection classes named\nMultiPoint, MultiLineString, and MultiPolygon\nfor modeling geometries corresponding to collections of\nPoints, LineStrings, and Polygons, respectively.\nMultiCurve and MultiSurface are introduced as abstract superclasses\nthat generalize the collection interfaces to handle Curves and Surfaces.\n\n\nGeometry, Curve, Surface, MultiCurve,\nand MultiSurface are defined as non-instantiable classes.\nThey define a common set of methods for their subclasses and\nare included for extensibility.\n\nPoint, LineString, Polygon, GeometryCollection,\nMultiPoint, MultiLineString, and\nMultiPolygon are instantiable classes.\n",""),(11,23,"CHAR FUNCTION"," CHAR(N,...)\nCHAR() interprets the arguments as integers and returns a string\nconsisting of the characters given by the code values of those\nintegers. NULL values are skipped.\n","mysql> SELECT CHAR(77,121,83,81,'76');\n -> 'MySQL'\nmysql> SELECT CHAR(77,77.3,'77.3');\n -> 'MMM'"),(12,1,"DATETIME","A date and time combination. The supported range is '1000-01-01\n00:00:00' to '9999-12-31 23:59:59'. MySQL displays\nDATETIME values in 'YYYY-MM-DD HH:MM:SS' format, but allows you\nto assign values to DATETIME columns using either strings or numbers.\n",""),(13,23,"LOWER"," LOWER(str)\nReturns the string str with all characters changed to lowercase\naccording to the current character set mapping (the default is ISO-8859-1\nLatin1).\n","mysql> SELECT LOWER('QUADRATICALLY');\n -> 'quadratically'"),(14,14,"MONTH"," MONTH(date)\nReturns the month for date, in the range 1 to 12.\n","mysql> SELECT MONTH('1998-02-03');\n -> 2"); +insert into help_topic (help_topic_id,help_category_id,name,description,example) values (15,1,"TINYINT"," TINYINT[(M)] [UNSIGNED] [ZEROFILL]\n\nA very small integer. The signed range is -128 to 127. The\nunsigned range is 0 to 255.\n",""),(16,18,"ISCLOSED"," IsClosed(ls)\nReturns 1 if the LineString value ls is closed\n(that is, its StartPoint() and EndPoint() values are the same).\nReturns 0 if ls is not closed, and -1 if it is NULL.\n","mysql> SET @ls = 'LineString(1 1,2 2,3 3)';\nmysql> SELECT IsClosed(GeomFromText(@ls));\n+-----------------------------+\n| IsClosed(GeomFromText(@ls)) |\n+-----------------------------+\n| 0 |\n+-----------------------------+"),(17,21,"MASTER_POS_WAIT"," MASTER_POS_WAIT(log_name,log_pos[,timeout])\n\nThis function is useful for control of master/slave synchronization.\nIt blocks until the slave has read and applied all updates up to the specified\nposition in the master log.\nThe return value is the number of log events it had to wait for to get to\nthe specified position. The function returns NULL if the slave SQL thread\nis not started, the slave's master information is not initialized, the\narguments are incorrect, or an error occurs. It returns -1 if the\ntimeout has been exceeded. If the slave SQL thread stops while\nMASTER_POS_WAIT() is waiting, the function returns NULL.\nIf the slave is past the specified position, the function returns\nimmediately.\n","SELECT MASTER_POS_WAIT('master_log_file', master_log_pos)"),(18,27,"^"," ^\nBitwise XOR:\n","mysql> SELECT 1 ^ 1;\n -> 0\nmysql> SELECT 1 ^ 0;\n -> 1\nmysql> SELECT 11 ^ 3;\n -> 8"),(19,24,"DROP VIEW","DROP VIEW removes one or more views. You must have the DROP\nprivilege for each view.\n\nYou can use the keywords IF EXISTS to prevent an error from occurring\nfor views that don't exist. When this clause is given, a NOTE is\ngenerated for each non-existent view.\nSee also : [SHOW WARNINGS, , SHOW WARNINGS].\n\nRESTRICT and CASCADE, if given, are parsed and ignored.\n","DROP VIEW [IF EXISTS]\n view_name [, view_name] ...\n [RESTRICT | CASCADE]"),(20,14,"DATE OPERATIONS"," DATE_ADD(date,INTERVAL expr type)\n DATE_SUB(date,INTERVAL expr type)\n\nThese functions perform date arithmetic.\ndate is a DATETIME or DATE value specifying the starting\ndate. expr is an expression specifying the interval value to be added\nor subtracted from the starting date. expr is a string; it may start\nwith a '-' for negative intervals. type is a keyword indicating\nhow the expression should be interpreted.\n","mysql> SELECT '1997-12-31 23:59:59' + INTERVAL 1 SECOND;\n -> '1998-01-01 00:00:00'\nmysql> SELECT INTERVAL 1 DAY + '1997-12-31';\n -> '1998-01-01'\nmysql> SELECT '1998-01-01' - INTERVAL 1 SECOND;\n -> '1997-12-31 23:59:59'\nmysql> SELECT DATE_ADD('1997-12-31 23:59:59',\n -> INTERVAL 1 SECOND);\n -> '1998-01-01 00:00:00'\nmysql> SELECT DATE_ADD('1997-12-31 23:59:59',\n -> INTERVAL 1 DAY);\n -> '1998-01-01 23:59:59'\nmysql> SELECT DATE_ADD('1997-12-31 23:59:59',\n -> INTERVAL '1:1' MINUTE_SECOND);\n -> '1998-01-01 00:01:00'\nmysql> SELECT DATE_SUB('1998-01-01 00:00:00',\n -> INTERVAL '1 1:1:1' DAY_SECOND);\n -> '1997-12-30 22:58:59'\nmysql> SELECT DATE_ADD('1998-01-01 00:00:00',\n -> INTERVAL '-1 10' DAY_HOUR);\n -> '1997-12-30 14:00:00'\nmysql> SELECT DATE_SUB('1998-01-02', INTERVAL 31 DAY);\n -> '1997-12-02'\nmysql> SELECT DATE_ADD('1992-12-31 23:59:59.000002',\n -> INTERVAL '1.999999' SECOND_MICROSECOND);\n -> '1993-01-01 00:00:01.000001'"),(21,11,"WITHIN"," Within(g1,g2)\nReturns 1 or 0 to indicate whether or not g1 is spatially within\ng2.\n",""),(22,14,"WEEK"," WEEK(date[,mode])\nThe function returns the week number for date. The two-argument form\nof WEEK() allows you to specify whether the week starts on Sunday or\nMonday and whether the return value should be in the range from 0 to\n53 or from 1 to 53. If the mode argument is\nomitted, the value of the default_week_format system variable is\nused (or 0 before MySQL 4.0.14).\nSee also : [Server system variables].\n\nThe following table describes how the mode argument works:\n\n First day \n Mode of week Range Week 1 is the first week...\n 0 Sunday 0-53 with a Sunday in this year\n 1 Monday 0-53 with more than 3 days this year\n 2 Sunday 1-53 with a Sunday in this year\n 3 Monday 1-53 with more than 3 days this year\n 4 Sunday 0-53 with more than 3 days this year\n 5 Monday 0-53 with a Monday in this year\n 6 Sunday 1-53 with more than 3 days this year\n 7 Monday 1-53 with a Monday in this year\n \n\nA mode value of 3 can be used as of MySQL 4.0.5.\nValues of 4 and above can be used as of MySQL 4.0.17.\n","mysql> SELECT WEEK('1998-02-20');\n -> 7\nmysql> SELECT WEEK('1998-02-20',0);\n -> 7\nmysql> SELECT WEEK('1998-02-20',1);\n -> 8\nmysql> SELECT WEEK('1998-12-31',1);\n -> 53"),(23,10,"LOCK","LOCK TABLES locks tables for the current thread. If any of the tables\nare locked by other threads, it blocks until all locks can be acquired.\nUNLOCK TABLES releases any locks held by the current thread.\nAll tables that are locked by the current thread are implicitly unlocked\nwhen the thread issues another LOCK TABLES, or when the connection\nto the server is closed.\n\nA table lock protects only against inappropriate reads or writes by other\nclients. The client holding the lock, even a read lock, can perform\ntable-level operations such as DROP TABLE.\n","LOCK TABLES\n tbl_name [AS alias] {READ [LOCAL] | [LOW_PRIORITY] WRITE}\n [, tbl_name [AS alias] {READ [LOCAL] | [LOW_PRIORITY] WRITE}] ...\nUNLOCK TABLES"),(24,7,"CHECK","Checks a table or tables for errors. CHECK TABLE works for\nMyISAM and InnoDB tables. For MyISAM tables, the key statistics are updated.\n\nAs of MySQL 5.0.2, CHECK TABLE also can check views for problems, such\nas tables that are referenced in the view definition that no longer exist.\n","CHECK TABLE tbl_name [, tbl_name] ... [option] ...\n\noption = {QUICK | FAST | MEDIUM | EXTENDED | CHANGED}"),(25,7,"RESET SLAVE","RESET SLAVE\n\nMakes the slave forget its replication position in the master's binary logs.\nThis statement is meant to be used for a clean start: It deletes the\n*master.info and *relay-log.info files, all the relay logs,\nand starts a new relay log.\n\nNote: All relay logs are deleted, even if they have not been\ntotally executed by the slave SQL thread. (This is a condition likely to\nexist on a replication slave if you have issued a STOP SLAVE\nstatement or if the slave is highly loaded.)\n\nConnection information stored in the *master.info file is immediately\nreset using any values specified in the corresponding startup options.\nThis information includes values such as master host, master port, master\nuser, and master password. If the slave SQL thread was in the middle of\nreplicating temporary tables when it was stopped, and RESET SLAVE\nis issued, these replicated temporary tables are deleted on the slave.\n\nThis statement was named FLUSH SLAVE before MySQL 3.23.26.\n",""),(26,2,"POLYGON"," Polygon(ls1,ls2,...)\nConstructs a WKB Polygon value from a number of WKB LineString\narguments. If any argument does not represent the WKB of a LinearRing\n(that is, not a closed and simple LineString) the return value\nis NULL.\n",""),(27,14,"MINUTE"," MINUTE(time)\nReturns the minute for time, in the range 0 to 59.\n","mysql> SELECT MINUTE('98-02-03 10:05:03');\n -> 5"),(28,14,"DAY"," DAY(date)\n\nDAY() is a synonym for DAYOFMONTH().\nIt is available as of MySQL 4.1.1.\n",""),(29,23,"MID"," MID(str,pos,len)\n\nMID(str,pos,len) is a synonym for\nSUBSTRING(str,pos,len).\n",""); +insert into help_topic (help_topic_id,help_category_id,name,description,example) values (30,6,"REPLACE INTO","REPLACE works exactly like INSERT, except that if an old\nrecord in the table has the same value as a new record for a PRIMARY\nKEY or a UNIQUE index, the old record is deleted before the new\nrecord is inserted.\nSee also : [INSERT, ,INSERT].\n\nNote that unless the table has a PRIMARY KEY or UNIQUE index,\nusing a REPLACE statement makes no sense. It becomes equivalent to\nINSERT, because there is no index to be used to determine whether a new\nrow duplicates another.\n\nValues for all columns are taken from the values specified in the\nREPLACE statement. Any missing columns are set to their default\nvalues, just as happens for INSERT. You can't refer to values from\nthe current row and use them in the new row. If you use an assignment such\nas SET col_name = col_name + 1, the reference to the\ncolumn name on the right hand side is treated as\nDEFAULT(col_name), so the assignment is equivalent to SET\ncol_name = DEFAULT(col_name) + 1.\n\nTo be able to use REPLACE, you must have INSERT and\nDELETE privileges for the table.\n","REPLACE [LOW_PRIORITY | DELAYED]\n [INTO] tbl_name [(col_name,...)]\n VALUES ({expr | DEFAULT},...),(...),..."),(31,21,"UUID"," UUID()\n\nReturns a Universal Unique Identifier (UUID) generated\naccording to ``DCE 1.1: Remote Procedure Call'' (Appendix A)\nCAE (Common Applications Environment) Specifications\npublished by The Open Group in October 1997 (Document Number C706).\n\nA UUID is designed as a number that is globally unique in space and\ntime. Two calls to UUID() are expected to generate two different\nvalues, even if these calls are performed on two separate computers that are\nnot connected to each other.\n\nA UUID is a 128-bit number represented by a string\nof five hexadecimal numbers in aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee\nformat:\n\n\n --- The first three numbers are generated from a timestamp.\n\n --- The fourth number preserves temporal uniqueness in case the timestamp value loses\nmonotonicity (for example, due to daylight saving time).\n\n --- The fifth number is an IEEE 802 node number that provides spatial uniqueness. A\nrandom number is substituted if the latter is not available (for example,\nbecause the host computer has no Ethernet card, or we do not know how to\nfind the hardware address of an interface on your operating system). In\nthis case, spatial uniqueness cannot be guaranteed. Nevertheless, a\ncollision should have /very/ low probability.\n\nCurrently, the MAC address of an interface is taken into account only on\nFreeBSD and Linux. On other operating systems, MySQL uses a randomly generated\n48-bit number.\n","mysql> SELECT UUID();\n -> '6ccd780c-baba-1026-9564-0040f4311e29'"),(32,2,"LINESTRING"," LineString(pt1,pt2,...)\nConstructs a WKB LineString value from a number of WKB Point\narguments. If any argument is not a WKB Point, the return value\nis NULL. If the number of Point arguments is less than two,\nthe return value is NULL.\n",""),(33,25,"CONNECTION_ID"," CONNECTION_ID()\nReturns the connection ID (thread ID) for the connection.\nEvery connection has its own unique ID.\n","mysql> SELECT CONNECTION_ID();\n -> 23786"),(34,6,"DELETE","DELETE deletes rows from tbl_name that satisfy the condition\ngiven by where_definition, and returns the number of records deleted.\n\nIf you issue a DELETE statement with no WHERE clause, all\nrows are deleted. A faster way to do this, when you don't want to know\nthe number of deleted rows, is to use TRUNCATE TABLE.\nSee also : [TRUNCATE, , TRUNCATE].\n","DELETE [LOW_PRIORITY] [QUICK] [IGNORE] FROM tbl_name\n [WHERE where_definition]\n [ORDER BY ...]\n [LIMIT row_count]"),(35,4,"ROUND"," ROUND(X)\n ROUND(X,D)\nReturns the argument X, rounded to the nearest integer.\nWith two arguments, returns X rounded to D decimals.\nD can be negative to round D digits left of the decimal\npoint of the value X.\n","mysql> SELECT ROUND(-1.23);\n -> -1\nmysql> SELECT ROUND(-1.58);\n -> -2\nmysql> SELECT ROUND(1.58);\n -> 2\nmysql> SELECT ROUND(1.298, 1);\n -> 1.3\nmysql> SELECT ROUND(1.298, 0);\n -> 1\nmysql> SELECT ROUND(23.298, -1);\n -> 20"),(36,9,"NULLIF"," NULLIF(expr1,expr2)\nReturns NULL if expr1 = expr2 is true, else returns expr1.\nThis is the same as CASE WHEN expr1 = expr2 THEN NULL ELSE expr1 END.\n","mysql> SELECT NULLIF(1,1);\n -> NULL\nmysql> SELECT NULLIF(1,2);\n -> 1"),(37,7,"STOP SLAVE","STOP SLAVE [thread_type [, thread_type] ... ]\n\nthread_type: IO_THREAD | SQL_THREAD\n\nStops the slave threads.\nSTOP SLAVE requires the SUPER privilege.\n\nLike START SLAVE, as of MySQL 4.0.2, this statement\nmay be used with the IO_THREAD and SQL_THREAD options to name\nthe thread or threads to stop.\n",""),(38,14,"TIMEDIFF"," TIMEDIFF(expr,expr2)\n\n\nTIMEDIFF() returns the time between the start time\nexpr and the end time expr2.\nexpr and expr2 are time or date-and-time expressions, but both\nmust be of the same type.\n","mysql> SELECT TIMEDIFF('2000:01:01 00:00:00',\n -> '2000:01:01 00:00:00.000001');\n -> '-00:00:00.000001'\nmysql> SELECT TIMEDIFF('1997-12-31 23:59:59.000001',\n -> '1997-12-30 01:01:01.000002');\n -> '46:58:57.999999'"),(39,3,"LINEFROMTEXT"," LineFromText(wkt[,srid])\n LineStringFromText(wkt[,srid])\nConstructs a LINESTRING value using its WKT representation and SRID.\n",""),(40,6,"SHOW MASTER STATUS","SHOW MASTER STATUS\n\nProvides status information on the binary log files of the master.\n",""),(41,14,"ADDTIME"," ADDTIME(expr,expr2)\n\n\nADDTIME() adds expr2 to expr and returns the result.\nexpr is a time or datetime expression, and expr2 is a time\nexpression.\n","mysql> SELECT ADDTIME('1997-12-31 23:59:59.999999',\n -> '1 1:1:1.000002');\n -> '1998-01-02 01:01:01.000001'\nmysql> SELECT ADDTIME('01:00:00.999999', '02:00:00.999998');\n -> '03:00:01.999997'"),(42,24,"SPATIAL","MySQL can create spatial indexes using syntax similar to that for creating\nregular indexes, but extended with the SPATIAL keyword.\nSpatial columns that are indexed currently must be declared NOT NULL.\nThe following examples demonstrate how to create spatial indexes.\n\n\n With CREATE TABLE:\n\nmysql> CREATE TABLE geom (g GEOMETRY NOT NULL, SPATIAL INDEX(g));\n\n With ALTER TABLE:\n\nmysql> ALTER TABLE geom ADD SPATIAL INDEX(g);\n\n With CREATE INDEX:\n\nmysql> CREATE SPATIAL INDEX sp_index ON geom (g);\n\n\nTo drop spatial indexes, use ALTER TABLE or DROP INDEX:\n\n\n With ALTER TABLE:\n\nmysql> ALTER TABLE geom DROP INDEX g;\n\n With DROP INDEX:\n\nmysql> DROP INDEX sp_index ON geom;\n\n\nExample: Suppose that a table geom contains more than 32,000 geometries,\nwhich are stored in the column g of type GEOMETRY.\nThe table also has an AUTO_INCREMENT column fid for storing\nobject ID values.\n",""),(43,14,"TIMESTAMPDIFF"," TIMESTAMPDIFF(interval,datetime_expr1,datetime_expr2)\n\nReturns the integer difference between the date or datetime expressions\ndatetime_expr1 and\ndatetime_expr2. The unit for the result is given by the\ninterval argument. The legal values for interval are the same as\nthose listed in the description of the TIMESTAMPADD() function.\n",""),(44,23,"UPPER"," UPPER(str)\nReturns the string str with all characters changed to uppercase\naccording to the current character set mapping (the default is ISO-8859-1\nLatin1).\n","mysql> SELECT UPPER('Hej');\n -> 'HEJ'"); +insert into help_topic (help_topic_id,help_category_id,name,description,example) values (45,14,"FROM_UNIXTIME"," FROM_UNIXTIME(unix_timestamp)\n FROM_UNIXTIME(unix_timestamp,format)\nReturns a representation of the unix_timestamp argument as a value in\n'YYYY-MM-DD HH:MM:SS' or YYYYMMDDHHMMSS format, depending on\nwhether the function is used in a string or numeric context.\n\nmysql> SELECT FROM_UNIXTIME(875996580);\n -> '1997-10-04 22:23:00'\nmysql> SELECT FROM_UNIXTIME(875996580) + 0;\n -> 19971004222300\n\nIf format is given, the result is formatted according to the\nformat string. format may contain the same specifiers as\nthose listed in the entry for the DATE_FORMAT() function.\n","mysql> SELECT FROM_UNIXTIME(UNIX_TIMESTAMP(),\n -> '%Y %D %M %h:%i:%s %x');\n -> '2003 6th August 06:22:58 2003'"),(46,1,"MEDIUMBLOB"," MEDIUMBLOB\n\nA BLOB column with a maximum length of 16,777,215\n(2^24 - 1) bytes.\n",""),(47,9,"IFNULL"," IFNULL(expr1,expr2)\nIf expr1 is not NULL, IFNULL() returns expr1,\nelse it returns expr2. IFNULL() returns a numeric or string\nvalue, depending on the context in which it is used.\n","mysql> SELECT IFNULL(1,0);\n -> 1\nmysql> SELECT IFNULL(NULL,10);\n -> 10\nmysql> SELECT IFNULL(1/0,10);\n -> 10\nmysql> SELECT IFNULL(1/0,'yes');\n -> 'yes'"),(48,26,"LEAST"," LEAST(value1,value2,...)\nWith two or more arguments, returns the smallest (minimum-valued) argument.\nThe arguments are compared using the following rules.\n\n --- If the return value is used in an INTEGER context or all arguments\nare integer-valued, they are compared as integers.\n\n --- If the return value is used in a REAL context or all arguments are\nreal-valued, they are compared as reals.\n\n --- If any argument is a case-sensitive string, the arguments are compared\nas case-sensitive strings.\n\n --- In other cases, the arguments are compared as case-insensitive strings.\n","mysql> SELECT LEAST(2,0);\n -> 0\nmysql> SELECT LEAST(34.0,3.0,5.0,767.0);\n -> 3.0\nmysql> SELECT LEAST('B','A','C');\n -> 'A'"),(49,26,"="," =\nEqual:\n","mysql> SELECT 1 = 0;\n -> 0\nmysql> SELECT '0' = 0;\n -> 1\nmysql> SELECT '0.0' = 0;\n -> 1\nmysql> SELECT '0.01' = 0;\n -> 0\nmysql> SELECT '.01' = 0.01;\n -> 1"),(50,23,"REVERSE"," REVERSE(str)\nReturns the string str with the order of the characters reversed.\n","mysql> SELECT REVERSE('abc');\n -> 'cba'"),(51,26,"ISNULL"," ISNULL(expr)\nIf expr is NULL, ISNULL() returns 1, otherwise\nit returns 0.\n","mysql> SELECT ISNULL(1+1);\n -> 0\nmysql> SELECT ISNULL(1/0);\n -> 1"),(52,1,"BINARY"," BINARY(M)\n\nThe BINARY type is similar to the CHAR type, but stores\nbinary byte strings rather than non-binary character strings.\n\nThis type was added in MySQL 4.1.2.\n",""),(53,19,"BOUNDARY"," Boundary(g)\nReturns a geometry that is the closure of the combinatorial boundary of the\ngeometry value g.\n",""),(54,7,"CREATE USER","The CREATE USER statement creates new MySQL accounts. To use it, you\nmust have the global CREATE USER privilege or the INSERT\nprivilege for the mysql database.\nFor each account, CREATE USER creates a new record in the\nmysql.user table that has no privileges. An error occurs if the\naccount already exists.\n\nThe account can be given a password with the optional IDENTIFIED\nBY clause. The user value and the password are given the same way\nas for the GRANT statement. In particular, to specify the password\nin plain text, omit the PASSWORD keyword. To specify the password\nas the hashed value as returned by the PASSWORD() function, include\nthe keyword PASSWORD.\nSee also : [GRANT, , GRANT].\n\nThe CREATE USER statement was added in MySQL 5.0.2.\n\n\n @subsubsection DROP USER Syntax\n\n\n\nDROP USER user [, user] ...\n\nThe DROP USER statement deletes one or more MySQL accounts.\nTo use it, you\nmust have the global CREATE USER privilege or the DELETE\nprivilege for the mysql database.\nEach account is named using the same format as for GRANT\nor REVOKE; for example, 'jeffrey'@@'localhost'. The user and\nhost parts of the account name correspond to the User and Host\ncolumn values of the user table record for the account.\n\nDROP USER was added in MySQL 4.1.1 and originally removed only\naccounts that have no privileges. In MySQL 5.0.2, it was modified to also\nremove account privileges. This means that the procedure for removing an\naccount depends on your version of MySQL.\n\nAs of MySQL 5.0.2, remove an account and its privileges as follows:\n\nDROP USER user;\n\nThe statement removes privilege records for the account from all grant tables.\n\nFrom MySQL 4.1.1 to 5.0.1, DROP USER deletes only MySQL accounts that\ndon't have any privileges. In these MySQL versions, it serves only to remove\neach account record from the user table. To remove a MySQL account, you\nshould use the following procedure, performing the steps in the order shown:\n\n@enumerate\n --- Use SHOW GRANTS to determine what privileges the account has.\nSee also : [SHOW GRANTS, , SHOW GRANTS].\n --- Use REVOKE to revoke the privileges displayed by SHOW GRANTS.\nThis removes records for the account from all the grant tables except the\nuser table, and revokes any global privileges listed in the user\ntable.\nSee also : [GRANT, , GRANT].\n --- Delete the account by using DROP USER to remove the user table\nrecord.\n@end enumerate\n\nDROP USER does not automatically close any open user sessions. Rather, in\nthe event that a user with an open session is dropped, the command does not take\neffect until that user's session is closed. Once the session is closed, the user\nis dropped, and that user's next attempt to log in will fail. This is by design.\n\nBefore MySQL 4.1.1, DROP USER is not available. You should first\nrevoke the account privileges as just described. Then delete the user\ntable record and flush the grant tables like this:\n\nmysql> DELETE FROM mysql.user\n -> WHERE User='user_name' and Host='host_name';\nmysql> FLUSH PRIVILEGES;\n\n\n @subsubsection GRANT and REVOKE Syntax\n\n\n\n\nGRANT priv_type [(column_list)] [, priv_type [(column_list)]] ...\n ON [object_type] {tbl_name | * | *.* | db_name.*}\n TO user [IDENTIFIED BY [PASSWORD] 'password']\n [, user [IDENTIFIED BY [PASSWORD] 'password']] ...\n [REQUIRE\n NONE |\n [{SSL| X509}]\n [CIPHER 'cipher' [AND]]\n [ISSUER 'issuer' [AND]]\n [SUBJECT 'subject']]\n [WITH with_option [with_option] ...]\n\nobject_type =\n TABLE\n | FUNCTION\n | PROCEDURE\n\nwith_option =\n GRANT OPTION\n | MAX_QUERIES_PER_HOUR count\n | MAX_UPDATES_PER_HOUR count\n | MAX_CONNECTIONS_PER_HOUR count\n | MAX_USER_CONNECTIONS count\n\nREVOKE priv_type [(column_list)] [, priv_type [(column_list)]] ...\n ON [object_type] {tbl_name | * | *.* | db_name.*}\n FROM user [, user] ...\n\nREVOKE ALL PRIVILEGES, GRANT OPTION FROM user [, user] ...\n\n\nThe GRANT and REVOKE statements allow system administrators to\ncreate MySQL user accounts and to grant rights to and revoke them from\naccounts. GRANT and REVOKE are implemented in MySQL 3.22.11\nor later. For earlier MySQL versions, these statements do nothing.\n\nMySQL account information is stored in the tables of the mysql\ndatabase. This database and the access control system are discussed\nextensively in [MySQL Database Administration], which you should consult\nfor additional details.\n\nIf the grant tables contain privilege records that contain mixed-case\ndatabase or table names and the lower_case_table_names system\nvariable is set, REVOKE cannot be used to revoke the privileges. It\nwill be necessary to manipulate the grant tables directly. (GRANT\nwill not create such records when lower_case_table_names is set,\nbut such records might have been created prior to setting the variable.)\n\nPrivileges can be granted at several levels:\n\n Global level\nGlobal privileges apply to all databases on a given server. These privileges\nare stored in the mysql.user table.\nGRANT ALL ON *.* and\nREVOKE ALL ON *.* grant and revoke only global privileges.\n\n Database level\nDatabase privileges apply to all objects in a given database. These privileges\nare stored in the mysql.db and mysql.host tables.\nGRANT ALL ON db_name.* and\nREVOKE ALL ON db_name.* grant and revoke only database privileges.\n\n Table level\nTable privileges apply to all columns in a given table. These privileges are\nstored in the mysql.tables_priv table.\nGRANT ALL ON db_name.tbl_name and\nREVOKE ALL ON db_name.tbl_name grant and revoke only table privileges.\n\n Column level\nColumn privileges apply to single columns in a given table. These privileges are\nstored in the mysql.columns_priv table.\nWhen using REVOKE, you must specify the same columns that were granted.\n\n Routine level\nThe CREATE ROUTINE, ALTER ROUTINE, EXECUTE, and\nGRANT privileges apply to stored routines. They can be granted at the\nglobal and database levels. Also, except for CREATE ROUTINE, these\nprivileges can be granted at the routine level for individual routines and\nare stored in the mysql.procs_priv table.\n\n \n\nThe object_type clause was added in MySQL 5.0.6. It should be\nspecified as TABLE, FUNCTION, or PROCEDURE when the\nfollowing object is a table, a stored function, or a stored procedure. To\nuse this clause when upgrading from a version of MySQL older than 5.0.6, you\nmust upgrade your grant tables.\nSee also : [Upgrading-grant-tables].\n","CREATE USER user [IDENTIFIED BY [PASSWORD] 'password']\n [, user [IDENTIFIED BY [PASSWORD] 'password']] ..."),(55,2,"POINT"," Point(x,y)\nConstructs a WKB Point using its coordinates.\n",""),(56,25,"CURRENT_USER"," CURRENT_USER()\nReturns the username and hostname combination that the current session was\nauthenticated as. This value corresponds to the MySQL account that\ndetermines your access privileges. It can be different from the value of\nUSER().\n","mysql> SELECT USER();\n -> 'davida@localhost'\nmysql> SELECT * FROM mysql.user;\nERROR 1044: Access denied for user ''@'localhost' to\ndatabase 'mysql'\nmysql> SELECT CURRENT_USER();\n -> '@localhost'"),(57,23,"LCASE"," LCASE(str)\n\nLCASE() is a synonym for LOWER().\n",""),(58,26,"<="," <=\nLess than or equal:\n","mysql> SELECT 0.1 <= 2;\n -> 1"),(59,6,"UPDATE","The UPDATE statement updates columns in existing table rows with\nnew values. The SET clause indicates which columns to modify\nand the values they should be given. The WHERE clause, if given,\nspecifies which rows should be updated. Otherwise, all rows are updated. If\nthe ORDER BY clause is specified, the rows are updated in the\norder that is specified. The LIMIT clause places a limit on the\nnumber of rows that can be updated.\n\nThe UPDATE statement supports the following modifiers:\n\n\n --- If you specify the LOW_PRIORITY keyword, execution of the\nUPDATE is delayed until no other clients are reading from the table.\n\n --- If you specify the IGNORE keyword, the update statement does not\nabort even if errors occur during the update. Rows for which duplicate-key\nconflicts occur are not updated. Rows for which columns are updated to\nvalues that would cause data conversion errors are updated to the closet\nvalid values instead.\n","UPDATE [LOW_PRIORITY] [IGNORE] tbl_name\n SET col_name1=expr1 [, col_name2=expr2 ...]\n [WHERE where_definition]\n [ORDER BY ...]\n [LIMIT row_count]"); +insert into help_topic (help_topic_id,help_category_id,name,description,example) values (60,28,"DROP INDEX","DROP INDEX drops the index named index_name from the table\ntbl_name. In MySQL 3.22 or later, DROP INDEX is mapped to an\nALTER TABLE statement to drop the index. See also : [ALTER TABLE, ,\nALTER TABLE]. DROP INDEX doesn't do anything prior to MySQL\n3.22.\n","DROP INDEX index_name ON tbl_name"),(61,23,"MATCH AGAINST","As of MySQL 3.23.23, MySQL has support for full-text indexing\nand searching. A full-text index in MySQL is an index of type\nFULLTEXT. FULLTEXT indexes are used with MyISAM tables\nonly and can be created from CHAR, VARCHAR,\nor TEXT columns at CREATE TABLE time or added later with\nALTER TABLE or CREATE INDEX. For large datasets, it is\nmuch faster to load your data into a table that has no FULLTEXT\nindex, then create the index with ALTER TABLE (or\nCREATE INDEX). Loading data into a table that has an existing\nFULLTEXT index could be significantly slower.\n","mysql> SELECT id, body, MATCH (title,body) AGAINST\n -> ('Security implications of running MySQL as root') AS score\n -> FROM articles WHERE MATCH (title,body) AGAINST\n -> ('Security implications of running MySQL as root');\n+----+-------------------------------------+-----------------+\n| id | body | score |\n+----+-------------------------------------+-----------------+\n| 4 | 1. Never run mysqld as root. 2. ... | 1.5219271183014 |\n| 6 | When configured properly, MySQL ... | 1.3114095926285 |\n+----+-------------------------------------+-----------------+\n2 rows in set (0.00 sec)"),(62,4,"ABS"," ABS(X)\nReturns the absolute value of X.\n","mysql> SELECT ABS(2);\n -> 2\nmysql> SELECT ABS(-32);\n -> 32"),(63,13,"POLYFROMWKB"," PolyFromWKB(wkb[,srid])\n PolygonFromWKB(wkb[,srid])\nConstructs a POLYGON value using its WKB representation and SRID.\n",""),(64,23,"NOT LIKE"," expr NOT LIKE pat [ESCAPE 'escape-char']\n\nThis is the same as NOT (expr LIKE pat [ESCAPE 'escape-char']).\n",""),(65,23,"SPACE"," SPACE(N)\nReturns a string consisting of N space characters.\n","mysql> SELECT SPACE(6);\n -> ' '"),(66,8,"MBR DEFINITION","Every geometry occupies some position in space. The exterior of\na geometry is all space not occupied by the geometry. The interior\nis the space occupied by the geometry. The boundary is the\ninterface between the geometry's interior and exterior.\n\n --- Its MBR (Minimum Bounding Rectangle), or Envelope.\nThis is the bounding geometry, formed by the minimum and maximum (X,Y)\ncoordinates:\n","((MINX MINY, MAXX MINY, MAXX MAXY, MINX MAXY, MINX MINY))"),(67,2,"GEOMETRYCOLLECTION"," GeometryCollection(g1,g2,...)\nConstructs a WKB GeometryCollection. If any argument is not a\nwell-formed WKB representation of a geometry, the return value is\nNULL.\n",""),(68,4,"*"," *\nMultiplication:\n","mysql> SELECT 3*5;\n -> 15\nmysql> SELECT 18014398509481984*18014398509481984.0;\n -> 324518553658426726783156020576256.0\nmysql> SELECT 18014398509481984*18014398509481984;\n -> 0"),(69,1,"TIMESTAMP"," TIMESTAMP[(M)]\n\nA timestamp. The range is '1970-01-01 00:00:00' to partway through the\nyear 2037.\n\nA TIMESTAMP column is useful for recording the date and time of an\nINSERT or UPDATE operation. The first TIMESTAMP column\nin a table is automatically set to the date and time of the most recent\noperation if you don't assign it a value yourself. You can also set any\nTIMESTAMP column to the current date and time by assigning it a\nNULL value.\n\nFrom MySQL 4.1 on, TIMESTAMP is returned as a string with the format\n'YYYY-MM-DD HH:MM:SS'. If you want to obtain the value as a number,\nyou should add +0 to the timestamp column. Different timestamp\ndisplay widths are not supported.\n\nIn MySQL 4.0 and earlier, TIMESTAMP values are displayed in\nYYYYMMDDHHMMSS, YYMMDDHHMMSS, YYYYMMDD, or YYMMDD\nformat, depending on whether M is 14 (or missing), 12,\n8, or 6, but allows you to assign values to TIMESTAMP\ncolumns using either strings or numbers.\nThe M argument affects only how a TIMESTAMP column is displayed,\nnot storage. Its values always are stored using four bytes each.\nFrom MySQL 4.0.12, the --new option can be used\nto make the server behave as in MySQL 4.1.\n\nNote that TIMESTAMP(M) columns where M is 8 or 14 are reported to\nbe numbers, whereas other TIMESTAMP(M) columns are reported to be\nstrings. This is just to ensure that you can reliably dump and restore\nthe table with these types.\n",""),(70,17,"DES_DECRYPT"," DES_DECRYPT(crypt_str[,key_str])\n\nDecrypts a string encrypted with DES_ENCRYPT().\nOn error, this function returns NULL.\n\nNote that this function works only if MySQL has been configured with\nSSL support. See also : [Secure connections].\n\nIf no key_str argument is given, DES_DECRYPT() examines\nthe first byte of the encrypted string to determine the DES key number\nthat was used to encrypt the original string, and then reads the key\nfrom the DES key file to decrypt the message. For this to work,\nthe user must have the SUPER privilege. The key file can be specified\nwith the --des-key-file server option.\n\nIf you pass this function a key_str argument, that string\nis used as the key for decrypting the message.\n\nIf the crypt_str argument doesn't look like an encrypted string,\nMySQL returns the given crypt_str.\n",""),(71,7,"CHECKSUM","\nReports a table checksum.\n\nIf QUICK is specified, the live table checksum is reported if it is\navailable, or NULL otherwise. This is very fast. A live checksum\nis enabled by specifying the CHECKSUM=1 table option, currently\nsupported only for MyISAM tables.\nSee also : [CREATE TABLE, , CREATE TABLE].\n\nIn EXTENDED mode the whole table is read row by row and the checksum\nis calculated. This can be very slow for large tables.\n\nBy default, if neither QUICK nor EXTENDED is specified, MySQL\nreturns a live checksum if the table storage engine supports it and scans\nthe table otherwise.\n\nCHECKSUM TABLE returns NULL for non-existent tables.\nAs of MySQL 5.0.3, a warning is generated for this condition.\n\nThis statement is implemented in MySQL 4.1.1.\n\n\n @subsubsection OPTIMIZE TABLE Syntax\n\n\n\n\nOPTIMIZE [LOCAL | NO_WRITE_TO_BINLOG] TABLE tbl_name [, tbl_name] ...\n\nOPTIMIZE TABLE should be used if you have deleted a large part of a\ntable or if you have made many changes to a table with variable-length rows\n(tables that have VARCHAR, BLOB, or TEXT columns).\nDeleted records are maintained in a linked list and subsequent INSERT\noperations reuse old record positions. You can use OPTIMIZE TABLE to\nreclaim the unused space and to defragment the data file.\n","CHECKSUM TABLE tbl_name [, tbl_name] ... [ QUICK | EXTENDED ]"),(72,18,"ENDPOINT"," EndPoint(ls)\nReturns the Point that is the end point of the LineString value\nls.\n","mysql> SET @ls = 'LineString(1 1,2 2,3 3)';\nmysql> SELECT AsText(EndPoint(GeomFromText(@ls)));\n+-------------------------------------+\n| AsText(EndPoint(GeomFromText(@ls))) |\n+-------------------------------------+\n| POINT(3 3) |\n+-------------------------------------+"),(73,6,"CACHE INDEX","The CACHE INDEX statement assigns table indexes to a specific key\ncache. It is used only for MyISAM tables.\n\nThe following statement assigns indexes from the tables t1,\nt2, and t3 to the key cache named hot_cache:\n\nmysql> CACHE INDEX t1, t2, t3 IN hot_cache;\n+---------+--------------------+----------+----------+\n| Table | Op | Msg_type | Msg_text |\n+---------+--------------------+----------+----------+\n| test.t1 | assign_to_keycache | status | OK |\n| test.t2 | assign_to_keycache | status | OK |\n| test.t3 | assign_to_keycache | status | OK |\n+---------+--------------------+----------+----------+\n","CACHE INDEX\n tbl_index_list [, tbl_index_list] ...\n IN key_cache_name\n\ntbl_index_list:\n tbl_name [[INDEX|KEY] (index_name[, index_name] ...)]"),(74,23,"COMPRESS"," COMPRESS(string_to_compress)\nCompresses a string. This function requires MySQL to have been compiled\nwith a compression library such as zlib. Otherwise, the return\nvalue is always NULL. The compressed string can be uncompressed with\nUNCOMPRESS().\n","mysql> SELECT LENGTH(COMPRESS(REPEAT('a',1000)));\n -> 21\nmysql> SELECT LENGTH(COMPRESS(''));\n -> 0\nmysql> SELECT LENGTH(COMPRESS('a'));\n -> 13\nmysql> SELECT LENGTH(COMPRESS(REPEAT('a',16)));\n -> 15"); +insert into help_topic (help_topic_id,help_category_id,name,description,example) values (75,12,"COUNT"," COUNT(expr)\nReturns a count of the number of non-NULL values in the rows\nretrieved by a SELECT statement.\n","mysql> SELECT student.student_name,COUNT(*)\n -> FROM student,course\n -> WHERE student.student_id=course.student_id\n -> GROUP BY student_name;"),(76,23,"INSERT"," INSERT(str,pos,len,newstr)\nReturns the string str, with the substring beginning at position\npos and len characters long replaced by the string\nnewstr. Returns the original string if pos is not within\nthe length of the string. Replaces the rest of the string from position\npos is len is not within the length of the rest of the string.\nReturns NULL if any argument is null.\n","mysql> SELECT INSERT('Quadratic', 3, 4, 'What');\n -> 'QuWhattic'\nmysql> SELECT INSERT('Quadratic', -1, 4, 'What');\n -> 'Quadratic'\nmysql> SELECT INSERT('Quadratic', 3, 100, 'What');\n -> 'QuWhat'"),(77,6,"HANDLER","The HANDLER statement provides direct access to table storage engine\ninterfaces. It is available for MyISAM tables as MySQL 4.0.0 and\nInnoDB tables as of MySQL 4.0.3.\n","HANDLER tbl_name OPEN [ AS alias ]\nHANDLER tbl_name READ index_name { = | >= | <= | < } (value1,value2,...)\n [ WHERE where_condition ] [LIMIT ... ]\nHANDLER tbl_name READ index_name { FIRST | NEXT | PREV | LAST }\n [ WHERE where_condition ] [LIMIT ... ]\nHANDLER tbl_name READ { FIRST | NEXT }\n [ WHERE where_condition ] [LIMIT ... ]\nHANDLER tbl_name CLOSE"),(78,3,"MLINEFROMTEXT"," MLineFromText(wkt[,srid])\n MultiLineStringFromText(wkt[,srid])\nConstructs a MULTILINESTRING value using its WKT representation and SRID.\n",""),(79,13,"GEOMCOLLFROMWKB"," GeomCollFromWKB(wkb[,srid])\n GeometryCollectionFromWKB(wkb[,srid])\nConstructs a GEOMETRYCOLLECTION value using its WKB representation and SRID.\n",""),(80,28,"RENAME TABLE","RENAME TABLE tbl_name TO new_tbl_name\n [, tbl_name2 TO new_tbl_name2] ...\n\nThis statement renames one or more tables. It was added in MySQL 3.23.23.\n\nThe rename operation is done atomically, which means that no other thread\ncan access any of the tables while the rename is running. For example,\nif you have an existing table old_table, you can create another\ntable new_table that has the same structure but is empty, and then\nreplace the existing table with the empty one as follows:\n","CREATE TABLE new_table (...);\nRENAME TABLE old_table TO backup_table, new_table TO old_table;"),(81,1,"BOOLEAN"," BOOL\n BOOLEAN\nThese are synonyms for TINYINT(1).\nThe BOOLEAN synonym was added in MySQL 4.1.0.\nA value of zero is considered false. Non-zero values are considered true.\n\nIn the future,\nfull boolean type handling will be introduced in accordance with standard SQL.\n",""),(82,21,"DEFAULT"," DEFAULT(col_name)\nReturns the default value for a table column.\nStarting from MySQL 5.0.2, you get an error if the column doesn't have\na default value.\n","mysql> UPDATE t SET i = DEFAULT(i)+1 WHERE id < 100;"),(83,1,"TINYTEXT"," TINYTEXT\n\nA TEXT column with a maximum length of 255\n(2^8 - 1) characters.\n",""),(84,17,"DECODE"," DECODE(crypt_str,pass_str)\nDecrypts the encrypted string crypt_str using pass_str as the\npassword. crypt_str should be a string returned from\nENCODE().\n",""),(85,26,"<=>"," <=>\nNULL-safe equal.\nThis operator performs an equality comparison like the = operator, but\nreturns 1 rather than NULL if both operands are NULL,\nand 0 rather than NULL if one operand is NULL.\n","mysql> SELECT 1 <=> 1, NULL <=> NULL, 1 <=> NULL;\n -> 1, 1, 0\nmysql> SELECT 1 = 1, NULL = NULL, 1 = NULL;\n -> 1, NULL, NULL"),(86,6,"LOAD DATA FROM MASTER","LOAD DATA FROM MASTER\n\nTakes a snapshot of the master and copies it to the slave. It updates the\nvalues of MASTER_LOG_FILE and MASTER_LOG_POS so that the slave\nstarts replicating from the correct position. Any table and database\nexclusion rules specified with the --replicate-*-do-* and\n--replicate-*-ignore-* options are honored.\n--replicate-rewrite-db is /not/ taken into account (because one user\ncould, with this option, set up a non-unique mapping such as\n--replicate-rewrite-db=db1->db3 and\n--replicate-rewrite-db=db2->db3, which would confuse the slave when\nit loads the master's tables).\n\nUse of this statement is subject to the following conditions:\n\n\n --- It works only with MyISAM tables. Attempting to load a\nnon-MyISAM table results in the error:\n\nERROR 1189 (08S01): Net error reading from master\n\n --- It acquires a global read lock on the master while taking the snapshot,\nwhich prevents updates on the master during the load operation.\n\n\nIn the future, it is planned to make this statement work with\nInnoDB tables and to remove the need for a global read lock by using\nnon-blocking online backup.\n\nIf you are loading big tables, you might have to increase the values\nof net_read_timeout and net_write_timeout\non both your master and slave servers.\nSee also : [Server system variables].\n\nNote that LOAD DATA FROM MASTER does /not/ copy any\ntables from the mysql database. This makes it easy to have\ndifferent users and privileges on the master and the slave.\n\nThe LOAD DATA FROM MASTER statement\nrequires the replication account that is used to connect to the master\nto have the RELOAD and SUPER privileges on the master and the\nSELECT privilege for all master tables you want to load. All\nmaster tables for which the user does not have the SELECT privilege are\nignored by LOAD DATA FROM MASTER. This is because the\nmaster hides them from the user: LOAD DATA FROM MASTER calls\nSHOW DATABASES to know the master databases to load, but\nSHOW DATABASES returns only databases for which the user has\nsome privilege.\nSee [SHOW DATABASES, , SHOW DATABASES].\nOn the slave's side, the user that issues LOAD DATA FROM MASTER should\nhave grants to drop and create the databases and tables that are copied.\n",""),(87,6,"RESET","The RESET statement is used to clear the state of various server\noperations. It also acts as a stronger\nversion of the FLUSH statement. See also : [FLUSH, , FLUSH].\n","RESET reset_option [, reset_option] ..."),(88,21,"GET_LOCK"," GET_LOCK(str,timeout)\nTries to obtain a lock with a name given by the string str, with a\ntimeout of timeout seconds. Returns 1 if the lock was obtained\nsuccessfully, 0 if the attempt timed out (for example, because another\nclient has previously locked the name), or NULL if an error\noccurred (such as running out of memory or the thread was killed with\nmysqladmin kill). If you have a lock obtained with GET_LOCK(),\nit is released when you execute\nRELEASE_LOCK(), execute a new GET_LOCK(), or your connection\nterminates (either normally or abnormally).\n\nThis function can be used to implement application locks or to\nsimulate record locks. Names are locked on a server-wide basis.\nIf a name has been locked by one client, GET_LOCK() blocks\nany request by another client for a lock with the same name. This\nallows clients that agree on a given lock name to use the name to\nperform cooperative advisory locking.\n","mysql> SELECT GET_LOCK('lock1',10);\n -> 1\nmysql> SELECT IS_FREE_LOCK('lock2');\n -> 1\nmysql> SELECT GET_LOCK('lock2',10);\n -> 1\nmysql> SELECT RELEASE_LOCK('lock2');\n -> 1\nmysql> SELECT RELEASE_LOCK('lock1');\n -> NULL"),(89,23,"UCASE"," UCASE(str)\n\nUCASE() is a synonym for UPPER().\n",""); +insert into help_topic (help_topic_id,help_category_id,name,description,example) values (90,13,"MPOLYFROMWKB"," MPolyFromWKB(wkb[,srid])\n MultiPolygonFromWKB(wkb[,srid])\nConstructs a MULTIPOLYGON value using its WKB representation and SRID.\n",""),(91,6,"DO","DO executes the expressions but doesn't return any results. This is\nshorthand for SELECT expr, ..., but has the advantage that it's\nslightly faster when you don't care about the result.\n\nDO is useful mainly with functions that have side effects, such as\nRELEASE_LOCK().\n","DO expr [, expr] ..."),(92,14,"CURTIME"," CURTIME()\n\nReturns the current time as a value in 'HH:MM:SS' or HHMMSS\nformat, depending on whether the function is used in a string or numeric\ncontext.\n","mysql> SELECT CURTIME();\n -> '23:50:26'\nmysql> SELECT CURTIME() + 0;\n -> 235026"),(93,1,"BIGINT"," BIGINT[(M)] [UNSIGNED] [ZEROFILL]\nA large integer. The signed range is -9223372036854775808 to\n9223372036854775807. The unsigned range is 0 to\n18446744073709551615.\n",""),(94,23,"CHAR_LENGTH"," CHAR_LENGTH(str)\n\nReturns the length of the string str, measured in characters.\nA multi-byte character counts as a single character.\nThis means that for a string containing five two-byte characters,\nLENGTH() returns 10, whereas CHAR_LENGTH() returns\n5.\n",""),(95,6,"SET","SET sets different types of variables that affect the operation of the\nserver or your client. It can be used to assign values to user variables or\nsystem variables.\n","SET variable_assignment [, variable_assignment] ...\n\nvariable_assignment:\n user_var_name = expr\n | [GLOBAL | SESSION] system_var_name = expr\n | @@[global. | session.]system_var_name = expr"),(96,1,"DATE","A date. The supported range is '1000-01-01' to '9999-12-31'.\nMySQL displays DATE values in 'YYYY-MM-DD' format, but\nallows you to assign values to DATE columns using either strings or\nnumbers.\n",""),(97,23,"CONV"," CONV(N,from_base,to_base)\nConverts numbers between different number bases. Returns a string\nrepresentation of the number N, converted from base from_base\nto base to_base. Returns NULL if any argument is NULL.\nThe argument N is interpreted as an integer, but may be specified as\nan integer or a string. The minimum base is 2 and the maximum base is\n36. If to_base is a negative number, N is regarded as a\nsigned number. Otherwise, N is treated as unsigned. CONV() works\nwith 64-bit precision.\n","mysql> SELECT CONV('a',16,2);\n -> '1010'\nmysql> SELECT CONV('6E',18,8);\n -> '172'\nmysql> SELECT CONV(-17,10,-18);\n -> '-H'\nmysql> SELECT CONV(10+'10'+'10'+0xa,10,10);\n -> '40'"),(98,14,"EXTRACT"," EXTRACT(type FROM date)\n\nThe EXTRACT() function uses the same kinds of interval type\nspecifiers as DATE_ADD() or DATE_SUB(), but extracts parts\nfrom the date rather than performing date arithmetic.\n","mysql> SELECT EXTRACT(YEAR FROM '1999-07-02');\n -> 1999\nmysql> SELECT EXTRACT(YEAR_MONTH FROM '1999-07-02 01:02:03');\n -> 199907\nmysql> SELECT EXTRACT(DAY_MINUTE FROM '1999-07-02 01:02:03');\n -> 20102\nmysql> SELECT EXTRACT(MICROSECOND\n -> FROM '2003-01-02 10:30:00.00123');\n -> 123"),(99,17,"ENCRYPT"," ENCRYPT(str[,salt])\nEncrypt str using the Unix crypt() system call. The\nsalt argument should be a string with two characters.\n(As of MySQL 3.22.16, salt may be longer than two characters.)\nIf no salt argument is given, a random value is used.\n","mysql> SELECT ENCRYPT('hello');\n -> 'VxuFAJXVARROc'"),(100,17,"OLD_PASSWORD"," OLD_PASSWORD(str)\n\nOLD_PASSWORD() is available as of MySQL 4.1, when the implementation of\nPASSWORD() was changed to improve security. OLD_PASSWORD()\nreturns the value of the pre-4.1 implementation of PASSWORD().\n[Password hashing].\n\n PASSWORD(str)\nCalculates and returns a password string from the plaintext password\nstr, or NULL if the argument was NULL. This is\nthe function that is used for encrypting MySQL passwords for storage\nin the Password column of the user grant table.\n",""),(101,21,"FORMAT"," FORMAT(X,D)\nFormats the number X to a format like '#,###,###.##', rounded\nto D decimals, and returns the result as a string.\nIf D is 0, the result has no\ndecimal point or fractional part.\n","mysql> SELECT FORMAT(12332.123456, 4);\n -> '12,332.1235'\nmysql> SELECT FORMAT(12332.1,4);\n -> '12,332.1000'\nmysql> SELECT FORMAT(12332.2,0);\n -> '12,332'"),(102,20,"||"," OR\n ||\nLogical OR.\nWhen both operands are non-NULL, the result is 1 if any\noperand is non-zero, and 0 otherwise. With a NULL operand,\nthe result is 1 if the other operand is non-zero, and NULL\notherwise. If both operands are NULL, the result is NULL.\n","mysql> SELECT 1 || 1;\n -> 1\nmysql> SELECT 1 || 0;\n -> 1\nmysql> SELECT 0 || 0;\n -> 0\nmysql> SELECT 0 || NULL;\n -> NULL\nmysql> SELECT 1 || NULL;\n -> 1"),(103,9,"CASE"," CASE value WHEN [compare-value] THEN result [WHEN [compare-value] THEN result ...] [ELSE result] END\n CASE WHEN [condition] THEN result [WHEN [condition] THEN result ...] [ELSE result] END\n\nThe first version returns the result where\nvalue=compare-value. The second version returns the\nresult for the first condition that is true. If there was no matching result\nvalue, the result after ELSE is returned, or NULL if there is\nno ELSE part.\n","mysql> SELECT CASE 1 WHEN 1 THEN 'one'\n -> WHEN 2 THEN 'two' ELSE 'more' END;\n -> 'one'\nmysql> SELECT CASE WHEN 1>0 THEN 'true' ELSE 'false' END;\n -> 'true'\nmysql> SELECT CASE BINARY 'B'\n -> WHEN 'a' THEN 1 WHEN 'b' THEN 2 END;\n -> NULL"),(104,23,"BIT_LENGTH"," BIT_LENGTH(str)\nReturns the length of the string str in bits.\n","mysql> SELECT BIT_LENGTH('text');\n -> 32"); +insert into help_topic (help_topic_id,help_category_id,name,description,example) values (105,0,"EXTERIORRING"," ExteriorRing(poly)\nReturns the exterior ring of the Polygon value poly\nas a LineString.\n","mysql> SET @poly =\n -> 'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))';\nmysql> SELECT AsText(ExteriorRing(GeomFromText(@poly)));\n+-------------------------------------------+\n| AsText(ExteriorRing(GeomFromText(@poly))) |\n+-------------------------------------------+\n| LINESTRING(0 0,0 3,3 3,3 0,0 0) |\n+-------------------------------------------+"),(106,13,"GEOMFROMWKB"," GeomFromWKB(wkb[,srid])\n GeometryFromWKB(wkb[,srid])\nConstructs a geometry value of any type using its WKB representation and SRID.\n",""),(107,6,"SHOW SLAVE HOSTS","SHOW SLAVE HOSTS\n\nDisplays a list of slaves currently registered with the master.\nAny slave not started with the --report-host=slave_name\noption is not visible in that list.\n",""),(108,10,"START TRANSACTION","By default, MySQL runs with autocommit mode enabled. This means that\nas soon as you execute a statement that updates (modifies) a table,\nMySQL stores the update on disk.\n\nIf you are using transaction-safe tables (like InnoDB or BDB),\nyou can disable autocommit mode with the following statement:\n\nSET AUTOCOMMIT=0;\n\nAfter disabling autocommit mode by setting the AUTOCOMMIT variable to\nzero, you must use COMMIT to store your changes to disk or\nROLLBACK if you want to ignore the changes you have made since\nthe beginning of your transaction.\n\nIf you want to disable autocommit mode for a single series of\nstatements, you can use the START TRANSACTION statement:\n","START TRANSACTION;\nSELECT @A:=SUM(salary) FROM table1 WHERE type=1;\nUPDATE table2 SET summary=@A WHERE type=1;\nCOMMIT;"),(109,26,"BETWEEN AND"," expr BETWEEN min AND max\nIf expr is greater than or equal to min and expr is\nless than or equal to max, BETWEEN returns 1,\notherwise it returns 0. This is equivalent to the expression\n(min <= expr AND expr <= max) if all the arguments are of the\nsame type. Otherwise type conversion takes place according to the rules\ndescribed at the beginning of this section, but applied to all the three\narguments. Note: Before MySQL\n4.0.5, arguments were converted to the type of expr instead.\n","mysql> SELECT 1 BETWEEN 2 AND 3;\n -> 0\nmysql> SELECT 'b' BETWEEN 'a' AND 'c';\n -> 1\nmysql> SELECT 2 BETWEEN 2 AND '3';\n -> 1\nmysql> SELECT 2 BETWEEN 2 AND 'x-3';\n -> 0"),(110,2,"MULTIPOLYGON"," MultiPolygon(poly1,poly2,...)\nConstructs a WKB MultiPolygon value from a set of WKB Polygon\narguments.\nIf any argument is not a WKB Polygon, the return value is NULL.\n",""),(111,14,"TIME_FORMAT"," TIME_FORMAT(time,format)\nThis is used like the DATE_FORMAT() function, but the\nformat string may contain only those format specifiers that handle\nhours, minutes, and seconds. Other specifiers produce a NULL value or\n0.\n",""),(112,23,"LEFT"," LEFT(str,len)\nReturns the leftmost len characters from the string str.\n","mysql> SELECT LEFT('foobarbar', 5);\n -> 'fooba'"),(113,7,"FLUSH QUERY CACHE","You can defragment the query cache to better utilize its memory\nwith the FLUSH QUERY CACHE statement.\nThe statement does not remove any queries from the cache.\n\nThe RESET QUERY CACHE statement removes all query results from the\nquery cache. The FLUSH TABLES statement also does this.\n",""),(114,4,"RAND"," RAND()\n RAND(N)\nReturns a random floating-point value in the range from 0 to 1.0.\nIf an integer argument N is specified, it is used as the seed value\n(producing a repeatable sequence).\n","mysql> SELECT RAND();\n -> 0.9233482386203\nmysql> SELECT RAND(20);\n -> 0.15888261251047\nmysql> SELECT RAND(20);\n -> 0.15888261251047\nmysql> SELECT RAND();\n -> 0.63553050033332\nmysql> SELECT RAND();\n -> 0.70100469486881"),(115,23,"RPAD"," RPAD(str,len,padstr)\nReturns the string str, right-padded with the string padstr\nto a length of len characters. If str is longer\nthan len, the return value is shortened to len characters.\n","mysql> SELECT RPAD('hi',5,'?');\n -> 'hi???'\nmysql> SELECT RPAD('hi',1,'?');\n -> 'h'"),(116,6,"INSERT INTO","INSERT inserts new rows into an existing table. The INSERT ...\nVALUES and INSERT ... SET forms of the statement insert rows based\non explicitly specified values. The INSERT ... SELECT form inserts\nrows selected from another table or tables. The INSERT ... VALUES\nform with multiple value lists is supported in MySQL 3.22.5 or\nlater. The INSERT ... SET syntax is supported in MySQL\n3.22.10 or later.\nINSERT ... SELECT is discussed further in\nSee also : [INSERT SELECT, , INSERT SELECT].\n","INSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [(col_name,...)]\n VALUES ({expr | DEFAULT},...),(...),...\n [ ON DUPLICATE KEY UPDATE col_name=expr, ... ]"),(117,7,"RESTORE","\nRESTORE TABLE tbl_name [, tbl_name] ... FROM '/path/to/backup/directory'\n\nRestores the table or tables from a backup that was made with BACKUP\nTABLE. Existing tables are not overwritten; if you try to restore over\nan existing table, you get an error. Just as BACKUP TABLE,\nRESTORE TABLE currently works only for MyISAM tables.\nThe directory should be specified as a full pathname.\n\nThe backup for each table consists of its *.frm format file and\n*.MYD data file. The restore operation restores those files, then\nuses them to rebuild the *.MYI index file. Restoring takes longer\nthan backing up due to the need to rebuild the indexes. The more indexes the\ntable has, the longer it takes.\n",""),(118,28,"CREATE DATABASE","CREATE DATABASE creates a database with the given name. To use\nCREATE DATABASE, you need the CREATE privilege on the database.\n","CREATE {DATABASE | SCHEMA} [IF NOT EXISTS] db_name\n [create_specification [, create_specification] ...]\n\ncreate_specification:\n [DEFAULT] CHARACTER SET charset_name\n | [DEFAULT] COLLATE collation_name"),(119,12,"VAR_POP"," VAR_POP(expr)\nReturns the population standard variance of expr. It considers rows\nas the whole population, not as a sample, so it has the number of rows as\nthe denominator. This function was added in MySQL 5.0.3. Before 5.0.3, you\ncan use VARIANCE(), which is equivalent but not standard SQL.\n",""); +insert into help_topic (help_topic_id,help_category_id,name,description,example) values (120,23,"ELT"," ELT(N,str1,str2,str3,...)\nReturns str1 if N = 1, str2 if N =\n2, and so on. Returns NULL if N is less than 1\nor greater than the number of arguments. ELT() is the complement of\nFIELD().\n","mysql> SELECT ELT(1, 'ej', 'Heja', 'hej', 'foo');\n -> 'ej'\nmysql> SELECT ELT(4, 'ej', 'Heja', 'hej', 'foo');\n -> 'foo'"),(121,24,"ALTER VIEW","This statement changes the definition of an existing view.\nThe syntax is similar to that for CREATE VIEW.\nSee also : [CREATE VIEW, , CREATE VIEW].\nThis statement requires the CREATE VIEW and DELETE privileges\nfor the view, and some privilege for each column referred to in the\nSELECT statement.\n","ALTER [ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}]\n VIEW view_name [(column_list)]\n AS select_statement\n [WITH [CASCADED | LOCAL] CHECK OPTION]"),(122,27,"~"," ~\nInvert all bits.\n","mysql> SELECT 5 & ~1;\n -> 4"),(123,23,"CONCAT_WS"," CONCAT_WS(separator,str1,str2,...)\n\nCONCAT_WS() stands for CONCAT With Separator and is a special form of\nCONCAT(). The first argument is the separator for the rest of the\narguments.\nThe separator is added between the strings to be concatenated.\nThe separator can be a string as can the rest of the\narguments. If the separator is NULL, the result is NULL.\nThe function skips any NULL values after the\nseparator argument.\n","mysql> SELECT CONCAT_WS(',','First name','Second name','Last Name');\n -> 'First name,Second name,Last Name'\nmysql> SELECT CONCAT_WS(',','First name',NULL,'Last Name');\n -> 'First name,Last Name'"),(124,25,"ROW_COUNT"," ROW_COUNT()\n\nROW_COUNT() returns the number of rows updated, inserted, or deleted\nby the preceding statement. This is the same as the row count that the\nmysql client displays and the value from the\nmysql_affected_rows() C API function.\n","mysql> INSERT INTO t VALUES(1),(2),(3);\nQuery OK, 3 rows affected (0.00 sec)\nRecords: 3 Duplicates: 0 Warnings: 0\n\nmysql> SELECT ROW_COUNT();\n+-------------+\n| ROW_COUNT() |\n+-------------+\n| 3 |\n+-------------+\n1 row in set (0.00 sec)\n\nmysql> DELETE FROM t WHERE i IN(1,2);\nQuery OK, 2 rows affected (0.00 sec)\n\nmysql> SELECT ROW_COUNT();\n+-------------+\n| ROW_COUNT() |\n+-------------+\n| 2 |\n+-------------+\n1 row in set (0.00 sec)"),(125,4,"ASIN"," ASIN(X)\nReturns the arc sine of X, that is, the value whose sine is\nX. Returns NULL if X is not in the range -1 to\n1.\n","mysql> SELECT ASIN(0.2);\n -> 0.201358\nmysql> SELECT ASIN('foo');\n -> 0.000000"),(126,22,"FUNCTION","A user-defined function (UDF) is a way to extend MySQL with a new\nfunction that works like a native (built-in) MySQL function such as\nABS() or CONCAT().\n\nfunction_name is the name that should be used in SQL statements to\ninvoke the function. The RETURNS clause indicates the type of the\nfunction's return value. shared_library_name is the basename of the\nshared object file that contains the code that implements the function. The\nfile must be located in a directory that is searched by your system's\ndynamic linker.\n\nTo create a function, you must have the INSERT and privilege for the\nmysql database. To drop a function, you must have the DELETE\nprivilege for the mysql database. This is because CREATE\nFUNCTION adds a row to the mysql.func system table that records the\nfunction's name, type, and shared library name, and DROP FUNCTION\ndeletes the function's row from that table. If you do not have this table,\nyou should run the mysql_fix_privilege_tables script to create it.\nSee also : [Upgrading-grant-tables].\n","CREATE [AGGREGATE] FUNCTION function_name RETURNS {STRING|INTEGER|REAL}\n SONAME shared_library_name\n\nDROP FUNCTION function_name"),(127,4,"SIGN"," SIGN(X)\nReturns the sign of the argument as -1, 0, or 1, depending\non whether X is negative, zero, or positive.\n","mysql> SELECT SIGN(-32);\n -> -1\nmysql> SELECT SIGN(0);\n -> 0\nmysql> SELECT SIGN(234);\n -> 1"),(128,14,"SEC_TO_TIME"," SEC_TO_TIME(seconds)\nReturns the seconds argument, converted to hours, minutes, and seconds,\nas a value in 'HH:MM:SS' or HHMMSS format, depending on whether\nthe function is used in a string or numeric context.\n","mysql> SELECT SEC_TO_TIME(2378);\n -> '00:39:38'\nmysql> SELECT SEC_TO_TIME(2378) + 0;\n -> 3938"),(129,1,"YEAR TYPE"," YEAR[(2|4)]\n\nA year in two-digit or four-digit format. The default is four-digit format.\nIn four-digit format, the\nallowable values are 1901 to 2155, and 0000.\nIn two-digit format, the allowable values are\n70 to 69, representing years from\n1970 to 2069. MySQL displays YEAR values in\nYYYY format, but allows you to assign values to YEAR columns\nusing either strings or numbers. The YEAR type is unavailable prior\nto MySQL 3.22.\n",""),(130,1,"FLOAT"," FLOAT(p) [UNSIGNED] [ZEROFILL]\n\nA floating-point number. p represents the precision. It can be from\n0 to 24 for a single-precision floating-point number and from 25 to 53 for a\ndouble-precision floating-point number. These types are like the FLOAT\nand DOUBLE types described immediately following. FLOAT(p)\nhas the same range as the corresponding FLOAT and DOUBLE\ntypes, but the display width and number of decimals are undefined.\n\nAs of MySQL 3.23, this is a true floating-point value. In\nearlier MySQL versions, FLOAT(p) always has two decimals.\n\nThis syntax is provided for ODBC compatibility.\n\nUsing FLOAT might give you some unexpected problems because\nall calculations in MySQL are done with double precision.\nSee also : [No matching rows].\n\n FLOAT[(M,D)] [UNSIGNED] [ZEROFILL]\n\nA small (single-precision) floating-point number. Allowable values are\n-3.402823466E+38 to -1.175494351E-38, 0,\nand 1.175494351E-38 to 3.402823466E+38. If UNSIGNED is\nspecified, negative values are disallowed. M is the display width and\nD is the number of significant digits. FLOAT without arguments or\nFLOAT(p) (where p is in the range from 0 to 24) stands for a\nsingle-precision floating-point number.\n",""),(131,23,"LOCATE"," LOCATE(substr,str)\n LOCATE(substr,str,pos)\n\nThe first syntax\nreturns the position of the first occurrence of substring substr\nin string str.\nThe second syntax\nreturns the position of the first occurrence of substring substr in\nstring str, starting at position pos.\nReturns 0 if substr is not in str.\n",""),(132,25,"CHARSET"," CHARSET(str)\nReturns the character set of the string argument.\n","mysql> SELECT CHARSET('abc');\n -> 'latin1'\nmysql> SELECT CHARSET(CONVERT('abc' USING utf8));\n -> 'utf8'\nmysql> SELECT CHARSET(USER());\n -> 'utf8'"),(133,6,"PURGE MASTER LOGS BEFORE TO","PURGE {MASTER | BINARY} LOGS TO 'log_name'\nPURGE {MASTER | BINARY} LOGS BEFORE 'date'\n\nDeletes all the binary logs listed in the log\nindex that are strictly prior to the specified log or date.\nThe logs also are removed from the list recorded in the log index file,\nso that the given log becomes the first.\n",""),(134,14,"SUBDATE"," SUBDATE(date,INTERVAL expr type)\n SUBDATE(expr,days)\n\nWhen invoked with the INTERVAL form of the second argument,\nSUBDATE() is a synonym for DATE_SUB().\nFor information on the INTERVAL argument, see the\ndiscussion for DATE_ADD().\n\nmysql> SELECT DATE_SUB('1998-01-02', INTERVAL 31 DAY);\n -> '1997-12-02'\nmysql> SELECT SUBDATE('1998-01-02', INTERVAL 31 DAY);\n -> '1997-12-02'\n\nAs of MySQL 4.1.1, the second syntax is allowed, where expr is a date\nor datetime expression and days is the number of days to be\nsubtracted from expr.\n\nmysql> SELECT SUBDATE('1998-01-02 12:00:00', 31);\n -> '1997-12-02 12:00:00'\n\nNote that you can't use format \"%X%V\" to convert a year-week\nstring to date as a year-week doesn't uniquely identify a year-month if the\nweek crosses a month boundary. If you want to convert a year-week to a date\nyou can do it by also specifying the week day:\n\nmysql> select str_to_date('200442 Monday', '%X%V %W');\n-> 2004-10-18\n",""); +insert into help_topic (help_topic_id,help_category_id,name,description,example) values (135,14,"DAYOFYEAR"," DAYOFYEAR(date)\nReturns the day of the year for date, in the range 1 to\n366.\n","mysql> SELECT DAYOFYEAR('1998-02-03');\n -> 34"),(136,4,"%"," MOD(N,M)\n N % M\n N MOD M\nModulo operation.\nReturns the remainder of N divided by M.\n","mysql> SELECT MOD(234, 10);\n -> 4\nmysql> SELECT 253 % 7;\n -> 1\nmysql> SELECT MOD(29,9);\n -> 2\nmysql> SELECT 29 MOD 9;\n -> 2"),(137,1,"LONGTEXT"," LONGTEXT\n\nA TEXT column with a maximum length of 4,294,967,295 or\n4GB (2^32 - 1) characters. Up to MySQL\n3.23, the client/server protocol and MyISAM tables had a limit\nof 16MB per communication packet / table row. From MySQL 4.0, the maximum\nallowed length of LONGTEXT columns depends on the\nconfigured maximum packet size in the client/server protocol and available\nmemory.\n",""),(138,11,"DISJOINT"," Disjoint(g1,g2)\nReturns 1 or 0 to indicate whether or not g1 is spatially disjoint\nfrom (does not intersect) g2.\n",""),(139,6,"KILL","Each connection to mysqld runs in a separate thread. You can see\nwhich threads are running with the SHOW PROCESSLIST statement and kill\na thread with the KILL thread_id statement.\n\nAs of MySQL 5.0.0, KILL allows the optional CONNECTION or\nQUERY modifiers:\n\n\n --- KILL CONNECTION is the same as KILL with no modifier:\nIt terminates the connection associated with the given thread_id.\n\n --- KILL QUERY terminates the statement that the connection currently\nis executing, but leaves the connection intact.\n\n\nIf you have the PROCESS privilege, you can see all threads.\nIf you have the SUPER privilege, you can kill all threads and\nstatements. Otherwise, you can see and kill only your own threads and\nstatements.\n\nYou can also use the mysqladmin processlist and mysqladmin kill\ncommands to examine and kill threads.\n\nNote: You currently cannot use KILL with the Embedded MySQL\nServer library, because the embedded server merely runs inside the threads\nof the host application, it does not create connection threads of its own.\n","KILL [CONNECTION | QUERY] thread_id"),(140,3,"ASTEXT"," AsText(g)\nConverts a value in internal geometry format to its WKT representation\nand returns the string result.\n","mysql> SELECT AsText(g) FROM geom;\n+-------------------------+\n| AsText(p1) |\n+-------------------------+\n| POINT(1 1) |\n| LINESTRING(0 0,1 1,2 2) |\n+-------------------------+"),(141,23,"LPAD"," LPAD(str,len,padstr)\nReturns the string str, left-padded with the string padstr\nto a length of len characters. If str is longer\nthan len, the return value is shortened to len characters.\n","mysql> SELECT LPAD('hi',4,'??');\n -> '??hi'\nmysql> SELECT LPAD('hi',1,'??');\n -> 'h'"),(142,11,"OVERLAPS"," Overlaps(g1,g2)\nReturns 1 or 0 to indicate whether or not g1 spatially overlaps\ng2.\nThe term /spatially overlaps/ is used if two\ngeometries intersect and their intersection results in a geometry of the\nsame dimension but not equal to either of the given geometries.\n",""),(143,5,"NUMGEOMETRIES"," NumGeometries(gc)\nReturns the number of geometries in the GeometryCollection value\ngc.\n","mysql> SET @gc = 'GeometryCollection(Point(1 1),LineString(2 2, 3 3))';\nmysql> SELECT NumGeometries(GeomFromText(@gc));\n+----------------------------------+\n| NumGeometries(GeomFromText(@gc)) |\n+----------------------------------+\n| 2 |\n+----------------------------------+"),(144,7,"SET GLOBAL SQL_SLAVE_SKIP_COUNTER","SET GLOBAL SQL_SLAVE_SKIP_COUNTER = n\n\nSkip the next n events from the master. This is\nuseful for recovering from replication stops caused by a statement.\n\nThis statement is valid only when the slave thread is not running.\nOtherwise, it produces an error.\n\nBefore MySQL 4.0, omit the GLOBAL keyword from the statement.\n",""),(145,14,"MONTHNAME"," MONTHNAME(date)\nReturns the full name of the month for date.\n","mysql> SELECT MONTHNAME('1998-02-05');\n -> 'February'"),(146,8,"MBREQUAL"," MBREqual(g1,g2)\nReturns 1 or 0 to indicate whether or not the Minimum Bounding Rectangles of\nthe two geometries g1 and g2 are the same.\n",""),(147,6,"CHANGE MASTER TO","\nCHANGE MASTER TO master_def [, master_def] ...\n\nmaster_def:\n MASTER_HOST = 'host_name'\n | MASTER_USER = 'user_name'\n | MASTER_PASSWORD = 'password'\n | MASTER_PORT = port_num\n | MASTER_CONNECT_RETRY = count\n | MASTER_LOG_FILE = 'master_log_name'\n | MASTER_LOG_POS = master_log_pos\n | RELAY_LOG_FILE = 'relay_log_name'\n | RELAY_LOG_POS = relay_log_pos\n | MASTER_SSL = {0|1}\n | MASTER_SSL_CA = 'ca_file_name'\n | MASTER_SSL_CAPATH = 'ca_directory_name'\n | MASTER_SSL_CERT = 'cert_file_name'\n | MASTER_SSL_KEY = 'key_file_name'\n | MASTER_SSL_CIPHER = 'cipher_list'\n\nChanges the parameters that the slave server uses for connecting to and\ncommunicating with the master server.\n\nMASTER_USER, MASTER_PASSWORD, MASTER_SSL,\nMASTER_SSL_CA, MASTER_SSL_CAPATH, MASTER_SSL_CERT,\nMASTER_SSL_KEY, and MASTER_SSL_CIPHER provide information for\nthe slave about how to connect to its master.\n\nThe relay log options (RELAY_LOG_FILE and RELAY_LOG_POS) are\navailable beginning with MySQL 4.0.\n\nThe SSL options\n(MASTER_SSL,\nMASTER_SSL_CA,\nMASTER_SSL_CAPATH,\nMASTER_SSL_CERT,\nMASTER_SSL_KEY,\nand\nMASTER_SSL_CIPHER)\nare available beginning with MySQL 4.1.1.\nYou can change these options even on slaves that are compiled without SSL\nsupport. They are saved to the *master.info file, but are ignored\nuntil you use a server that has SSL support enabled.\n\nIf you don't specify a given parameter, it keeps its old\nvalue, except as indicated in the following discussion. For example, if the password to connect to your MySQL master has\nchanged, you just need to issue these statements\nto tell the slave about the new password:\n\nmysql> STOP SLAVE; -- if replication was running\nmysql> CHANGE MASTER TO MASTER_PASSWORD='new3cret';\nmysql> START SLAVE; -- if you want to restart replication\n\nThere is no need to specify the parameters that do\nnot change (host, port, user, and so forth).\n\nMASTER_HOST and MASTER_PORT are the hostname (or IP address) of\nthe master host and its TCP/IP port. Note that if MASTER_HOST is\nequal to localhost, then, like in other parts of MySQL, the port\nmay be ignored (if Unix socket files can be used, for example).\n\nIf you specify MASTER_HOST or MASTER_PORT,\nthe slave assumes that the master server is different than\nbefore (even if you specify a host or port value that is\nthe same as the current value.) In this case, the old values for the master\nbinary log name and position are considered no longer applicable, so if you\ndo not specify MASTER_LOG_FILE and MASTER_LOG_POS in the\nstatement, MASTER_LOG_FILE='' and MASTER_LOG_POS=4 are\nsilently appended to it.\n\nMASTER_LOG_FILE and MASTER_LOG_POS are the coordinates\nat which the slave I/O thread should begin reading from the master the\nnext time the thread starts.\nIf you specify either of them, you can't specify RELAY_LOG_FILE or\nRELAY_LOG_POS.\nIf neither of MASTER_LOG_FILE or MASTER_LOG_POS are\nspecified, the slave uses the last coordinates of the /slave SQL thread/\nbefore CHANGE MASTER was issued. This ensures that\nreplication has no discontinuity, even if the slave SQL thread was late\ncompared to the slave I/O thread, when you just want to change, say, the\npassword to use. This safe behavior was introduced starting from MySQL\n4.0.17 and 4.1.1. (Before these versions, the coordinates used were\nthe last coordinates of the slave I/O thread before CHANGE MASTER\nwas issued. This caused the SQL thread to possibly lose some events\nfrom the master, thus breaking replication.)\n\nCHANGE MASTER /deletes all relay log files/ and starts\na new one, unless you specify RELAY_LOG_FILE or\nRELAY_LOG_POS. In that case, relay logs are kept;\nas of MySQL 4.1.1 the relay_log_purge global variable\nis set silently to 0.\n\nCHANGE MASTER TO updates the contents of the *master.info and\n*relay-log.info files.\n\nCHANGE MASTER is useful for setting up a slave when you have\nthe snapshot of the master and have recorded the log and the offset\ncorresponding to it. After loading the snapshot into the slave, you\ncan run CHANGE MASTER TO MASTER_LOG_FILE='log_name_on_master',\nMASTER_LOG_POS=log_offset_on_master on the slave.\n\nExamples:\n\nmysql> CHANGE MASTER TO\n -> MASTER_HOST='master2.mycompany.com',\n -> MASTER_USER='replication',\n -> MASTER_PASSWORD='bigs3cret',\n -> MASTER_PORT=3306,\n -> MASTER_LOG_FILE='master2-bin.001',\n -> MASTER_LOG_POS=4,\n -> MASTER_CONNECT_RETRY=10;\n\nmysql> CHANGE MASTER TO\n -> RELAY_LOG_FILE='slave-relay-bin.006',\n -> RELAY_LOG_POS=4025;\n",""),(148,28,"DROP DATABASE","DROP DATABASE drops all tables in the database and deletes the\ndatabase. Be /very/ careful with this statement!\nTo use DROP DATABASE, you need the DROP privilege on the\ndatabase.\n\nIn MySQL 3.22 or later, you can use the keywords IF EXISTS\nto prevent an error from occurring if the database doesn't exist.\n\nDROP SCHEMA can be used as of MySQL 5.0.2.\n","DROP {DATABASE | SCHEMA} [IF EXISTS] db_name"),(149,14,"TIMESTAMP FUNCTION"," TIMESTAMP(expr)\n TIMESTAMP(expr,expr2)\n\nWith one argument, returns the date or datetime expression expr\nas a datetime value.\nWith two arguments, adds the time expression expr2 to the\ndate or datetime expression expr and returns a datetime value.\n","mysql> SELECT TIMESTAMP('2003-12-31');\n -> '2003-12-31 00:00:00'\nmysql> SELECT TIMESTAMP('2003-12-31 12:00:00','12:00:00');\n -> '2004-01-01 00:00:00'"); +insert into help_topic (help_topic_id,help_category_id,name,description,example) values (150,23,"CHARACTER_LENGTH"," CHARACTER_LENGTH(str)\n\nCHARACTER_LENGTH() is a synonym for CHAR_LENGTH().\n",""),(151,24,"CREATE VIEW ALGORITHM MERGE TEMPTABLE WITH CHECK OPTION","","CREATE [OR REPLACE] [ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}]\n VIEW view_name [(column_list)]\n AS select_statement\n [WITH [CASCADED | LOCAL] CHECK OPTION]"),(152,14,"TIMESTAMPDIFF FUNCTION","","mysql> SELECT TIMESTAMPDIFF(MONTH,'2003-02-01','2003-05-01');\n -> 3\nmysql> SELECT TIMESTAMPDIFF(YEAR,'2002-05-01','2001-01-01');\n -> -1"),(153,4,"CRC32"," CRC32(expr)\nComputes a cyclic redundancy check value and returns a 32-bit unsigned value.\nThe result is NULL if the argument is NULL.\nThe argument is expected be a string and is treated as one if it is not.\n","mysql> SELECT CRC32('MySQL');\n -> 3259397556"),(154,20,"XOR"," XOR\nLogical XOR.\nReturns NULL if either operand is NULL.\nFor non-NULL operands, evaluates to 1 if an odd number\nof operands is non-zero,\notherwise 0 is returned.\n","mysql> SELECT 1 XOR 1;\n -> 0\nmysql> SELECT 1 XOR 0;\n -> 1\nmysql> SELECT 1 XOR NULL;\n -> NULL\nmysql> SELECT 1 XOR 1 XOR 1;\n -> 1"),(155,18,"STARTPOINT"," StartPoint(ls)\nReturns the Point that is the start point of the LineString value\nls.\n","mysql> SET @ls = 'LineString(1 1,2 2,3 3)';\nmysql> SELECT AsText(StartPoint(GeomFromText(@ls)));\n+---------------------------------------+\n| AsText(StartPoint(GeomFromText(@ls))) |\n+---------------------------------------+\n| POINT(1 1) |\n+---------------------------------------+"),(156,3,"MPOLYFROMTEXT"," MPolyFromText(wkt[,srid])\n MultiPolygonFromText(wkt[,srid])\nConstructs a MULTIPOLYGON value using its WKT representation and SRID.\n",""),(157,8,"MBRINTERSECTS"," MBRIntersects(g1,g2)\nReturns 1 or 0 to indicate whether or not the Minimum Bounding Rectangles of\nthe two geometries g1 and g2 intersect.\n",""),(158,12,"BIT_OR"," BIT_OR(expr)\nReturns the bitwise OR of all bits in expr. The calculation is\nperformed with 64-bit (BIGINT) precision.\n",""),(159,14,"YEARWEEK"," YEARWEEK(date)\n YEARWEEK(date,start)\nReturns year and week for a date. The start argument works exactly\nlike the start argument to WEEK(). The year in the\nresult may be\ndifferent from the year in the date argument for the first and the last\nweek of the year.\n","mysql> SELECT YEARWEEK('1987-01-01');\n -> 198653"),(160,26,"NOT BETWEEN"," expr NOT BETWEEN min AND max\nThis is the same as NOT (expr BETWEEN min AND max).\n",""),(161,4,"LOG10"," LOG10(X)\nReturns the base-10 logarithm of X.\n","mysql> SELECT LOG10(2);\n -> 0.301030\nmysql> SELECT LOG10(100);\n -> 2.000000\nmysql> SELECT LOG10(-100);\n -> NULL"),(162,4,"SQRT"," SQRT(X)\nReturns the non-negative square root of X.\n","mysql> SELECT SQRT(4);\n -> 2.000000\nmysql> SELECT SQRT(20);\n -> 4.472136"),(163,1,"DECIMAL"," DECIMAL[(M[,D])] [UNSIGNED] [ZEROFILL]\n\n\nFor MySQL 5.0.3 and above:\n\nA packed ``exact'' fixed-point number. M is the total number of\ndigits and D is the number of decimals. The decimal point and\n(for negative numbers) the '-' sign are not counted in M.\nIf D is 0, values have no\ndecimal point or fractional part. The maximum number of digits\n(M) for DECIMAL is 64. The maximum number of supported\ndecimals (D) is 30. If UNSIGNED is specified, negative\nvalues are disallowed.\n\nIf D is omitted, the default is 0. If M is omitted, the\ndefault is 10.\n\nAll basic calculations (+, -, *, /) with DECIMAL columns are\ndone with a precision of 64 decimal digits.\n\nBefore MySQL 5.0.3:\n\nAn unpacked fixed-point number. Behaves like a CHAR column;\n``unpacked'' means the number is stored as a string, using one character for\neach digit of the value. M is the total number of digits and\nD is the number of decimals. The decimal point and (for negative\nnumbers) the '-' sign are not counted in M, although space for\nthem is reserved. If D is 0, values have no decimal point or\nfractional part. The maximum range of DECIMAL values is the same as\nfor DOUBLE, but the actual range for a given DECIMAL column\nmay be constrained by the choice of M and D. If\nUNSIGNED is specified, negative values are disallowed.\n\nIf D is omitted, the default is 0. If M is omitted, the\ndefault is 10.\n\nBefore MySQL 3.23:\n\nAs just described, with the exception that the M value must be large\nenough to include the space needed for the sign and the decimal point\ncharacters.\n\n DEC[(M[,D])] [UNSIGNED] [ZEROFILL]\n NUMERIC[(M[,D])] [UNSIGNED] [ZEROFILL]\n FIXED[(M[,D])] [UNSIGNED] [ZEROFILL]\n\nThese are synonyms for DECIMAL. The FIXED synonym was added\nin MySQL 4.1.0 for compatibility with other servers.\n",""),(164,5,"GEOMETRYN"," GeometryN(gc,n)\nReturns the n-th geometry in the GeometryCollection value\ngc. Geometry numbers begin at 1.\n","mysql> SET @gc = 'GeometryCollection(Point(1 1),LineString(2 2, 3 3))';\nmysql> SELECT AsText(GeometryN(GeomFromText(@gc),1));\n+----------------------------------------+\n| AsText(GeometryN(GeomFromText(@gc),1)) |\n+----------------------------------------+\n| POINT(1 1) |\n+----------------------------------------+"); +insert into help_topic (help_topic_id,help_category_id,name,description,example) values (165,28,"CREATE INDEX","In MySQL 3.22 or later, CREATE INDEX is mapped to an\nALTER TABLE statement to create indexes.\nSee also : [ALTER TABLE, , ALTER TABLE].\nThe CREATE INDEX statement doesn't do anything prior\nto MySQL 3.22.\n","CREATE [UNIQUE|FULLTEXT|SPATIAL] INDEX index_name\n [USING index_type]\n ON tbl_name (index_col_name,...)\n\nindex_col_name:\n col_name [(length)] [ASC | DESC]"),(166,28,"ALTER DATABASE","\nALTER DATABASE allows you to change the overall characteristics of a\ndatabase. These characteristics are stored in the *db.opt file in the\ndatabase directory.\nTo use ALTER DATABASE, you need the ALTER privilege on the\ndatabase.\n","ALTER {DATABASE | SCHEMA} [db_name]\n alter_specification [, alter_specification] ...\n\nalter_specification:\n [DEFAULT] CHARACTER SET charset_name\n | [DEFAULT] COLLATE collation_name"),(167,27,"<<","Shifts a longlong (BIGINT) number to the left.\n <<\n","mysql> SELECT 1 << 2;\n -> 4"),(168,17,"MD5"," MD5(str)\nCalculates an MD5 128-bit checksum for the string. The value is returned\nas a binary string of 32 hex digits,\nor NULL if the argument was NULL.\nThe return value can, for example, be used as a hash key.\n","mysql> SELECT MD5('testing');\n -> 'ae2b1fca515949e5d54fb22b8ed95575'"),(169,26,"<"," <\nLess than:\n","mysql> SELECT 2 < 2;\n -> 0"),(170,14,"UNIX_TIMESTAMP"," UNIX_TIMESTAMP()\n UNIX_TIMESTAMP(date)\nIf called with no argument, returns a Unix timestamp (seconds since\n'1970-01-01 00:00:00' GMT) as an unsigned integer. If\nUNIX_TIMESTAMP() is called with a date argument, it\nreturns the value of the argument as seconds since '1970-01-01\n00:00:00' GMT. date may be a DATE string, a\nDATETIME string, a TIMESTAMP, or a number in the format\nYYMMDD or YYYYMMDD in local time.\n","mysql> SELECT UNIX_TIMESTAMP();\n -> 882226357\nmysql> SELECT UNIX_TIMESTAMP('1997-10-04 22:23:00');\n -> 875996580"),(171,14,"DAYOFMONTH"," DAYOFMONTH(date)\nReturns the day of the month for date, in the range 1 to\n31.\n","mysql> SELECT DAYOFMONTH('1998-02-03');\n -> 3"),(172,23,"ASCII"," ASCII(str)\nReturns the numeric value of the leftmost character of the string\nstr. Returns 0 if str is the empty string. Returns\nNULL if str is NULL.\nASCII() works for characters with numeric values from 0 to\n255.\n","mysql> SELECT ASCII('2');\n -> 50\nmysql> SELECT ASCII(2);\n -> 50\nmysql> SELECT ASCII('dx');\n -> 100"),(173,4,"DIV","Integer division.\nSimilar to FLOOR() but safe with BIGINT values.\n","mysql> SELECT 5 DIV 2;\n -> 2"),(174,7,"RENAME USER","The RENAME USER statement renames existing MySQL accounts.\nTo use it, you must have the global CREATE USER privilege or\nthe UPDATE privilege for the mysql database.\nAn error occurs if any old account does not exist or any new\naccount exists. The old_user and new_user values are given the\nsame way as for the GRANT statement.\n","RENAME USER old_user TO new_user\n [, old_user TO new_user] ..."),(175,7,"SHOW SLAVE STATUS","SHOW SLAVE STATUS\n\nProvides status information on\nessential parameters of the slave threads. If you issue this statement using\nthe\nmysql client, you can use a \\G statement terminator rather than\nsemicolon to get a more readable vertical layout:\n\nmysql> SHOW SLAVE STATUS\\G\n*************************** 1. row ***************************\n Slave_IO_State: Waiting for master to send event\n Master_Host: localhost\n Master_User: root\n Master_Port: 3306\n Connect_Retry: 3\n Master_Log_File: gbichot-bin.005\n Read_Master_Log_Pos: 79\n Relay_Log_File: gbichot-relay-bin.005\n Relay_Log_Pos: 548\nRelay_Master_Log_File: gbichot-bin.005\n Slave_IO_Running: Yes\n Slave_SQL_Running: Yes\n Replicate_Do_DB:\n Replicate_Ignore_DB:\n Last_Errno: 0\n Last_Error:\n Skip_Counter: 0\n Exec_Master_Log_Pos: 79\n Relay_Log_Space: 552\n Until_Condition: None\n Until_Log_File:\n Until_Log_Pos: 0\n Master_SSL_Allowed: No\n Master_SSL_CA_File:\n Master_SSL_CA_Path:\n Master_SSL_Cert:\n Master_SSL_Cipher:\n Master_SSL_Key:\nSeconds_Behind_Master: 8\n",""),(176,24,"GEOMETRY","MySQL provides a standard way of creating spatial columns for\ngeometry types, for example, with CREATE TABLE or ALTER TABLE.\nCurrently, spatial columns are supported only for MyISAM tables.\n","mysql> CREATE TABLE geom (g GEOMETRY);\nQuery OK, 0 rows affected (0.02 sec)"),(177,18,"NUMPOINTS"," NumPoints(ls)\nReturns the number of points in the LineString value ls.\n","mysql> SET @ls = 'LineString(1 1,2 2,3 3)';\nmysql> SELECT NumPoints(GeomFromText(@ls));\n+------------------------------+\n| NumPoints(GeomFromText(@ls)) |\n+------------------------------+\n| 3 |\n+------------------------------+"),(178,27,"&"," &\nBitwise AND:\n","mysql> SELECT 29 & 15;\n -> 13"),(179,14,"LOCALTIMESTAMP"," LOCALTIMESTAMP\n LOCALTIMESTAMP()\n\nLOCALTIMESTAMP and LOCALTIMESTAMP() are synonyms for\nNOW().\n",""); +insert into help_topic (help_topic_id,help_category_id,name,description,example) values (180,14,"ADDDATE"," ADDDATE(date,INTERVAL expr type)\n ADDDATE(expr,days)\n\nWhen invoked with the INTERVAL form of the second argument,\nADDDATE() is a synonym for DATE_ADD(). The related\nfunction SUBDATE() is a synonym for DATE_SUB().\nFor information on the INTERVAL argument, see the\ndiscussion for DATE_ADD().\n\nmysql> SELECT DATE_ADD('1998-01-02', INTERVAL 31 DAY);\n -> '1998-02-02'\nmysql> SELECT ADDDATE('1998-01-02', INTERVAL 31 DAY);\n -> '1998-02-02'\n\nAs of MySQL 4.1.1, the second syntax is allowed, where expr is a date\nor datetime expression and days is the number of days to be added to\nexpr.\n\nmysql> SELECT ADDDATE('1998-01-02', 31);\n -> '1998-02-02'\n",""),(181,1,"SMALLINT"," SMALLINT[(M)] [UNSIGNED] [ZEROFILL]\n\nA small integer. The signed range is -32768 to 32767. The\nunsigned range is 0 to 65535.\n",""),(182,23,"ORD"," ORD(str)\nIf the leftmost character of the string str is a multi-byte character,\nreturns the code for that character, calculated from the numeric values\nof its constituent bytes using this formula:\n\n (1st byte code)\n+ (2nd byte code * 256)\n+ (3rd byte code * 256^2) ...\n\nIf the leftmost character is not a multi-byte character, ORD()\nreturns the same value as the ASCII() function.\n","mysql> SELECT ORD('2');\n -> 50"),(183,19,"ENVELOPE"," Envelope(g)\nReturns the Minimum Bounding Rectangle (MBR) for the geometry value g.\nThe result is returned as a Polygon value.\n\nmysql> SELECT AsText(Envelope(GeomFromText('LineString(1 1,2 2)')));\n+-------------------------------------------------------+\n| AsText(Envelope(GeomFromText('LineString(1 1,2 2)'))) |\n+-------------------------------------------------------+\n| POLYGON((1 1,2 1,2 2,1 2,1 1)) |\n+-------------------------------------------------------+\n\nThe polygon is defined by the corner points of the bounding box:\n\nPOLYGON((MINX MINY, MAXX MINY, MAXX MAXY, MINX MAXY, MINX MINY))\n",""),(184,21,"IS_FREE_LOCK"," IS_FREE_LOCK(str)\nChecks whether the lock named str is free to use (that is, not locked).\nReturns 1 if the lock is free (no one is using the lock),\n0 if the lock is in use, and\nNULL on errors (such as incorrect arguments).\n",""),(185,6,"SHOW BINLOG","SHOW BINLOG EVENTS\n [IN 'log_name'] [FROM pos] [LIMIT [offset,] row_count]\n\nShows the events in the binary log.\nIf you do not specify 'log_name', the first binary log is displayed.\n",""),(186,11,"TOUCHES"," Touches(g1,g2)\nReturns 1 or 0 to indicate whether or not g1 spatially touches\ng2. Two geometries /spatially touch/ if the interiors of\nthe geometries do not intersect, but the boundary of one of the geometries\nintersects either the boundary or the interior of the other.\n",""),(187,14,"TIMESTAMPADD FUNCTION","","mysql> SELECT TIMESTAMPADD(MINUTE,1,'2003-01-02');\n -> '2003-01-02 00:01:00'\nmysql> SELECT TIMESTAMPADD(WEEK,1,'2003-01-02');\n -> '2003-01-09'"),(188,21,"INET_ATON"," INET_ATON(expr)\nGiven the dotted-quad representation of a network address as a string,\nreturns an integer that represents the numeric value of the address.\nAddresses may be 4- or 8-byte addresses.\n","mysql> SELECT INET_ATON('209.207.224.40');\n -> 3520061480"),(189,1,"AUTO_INCREMENT","The AUTO_INCREMENT attribute can be used to generate a unique\nidentity for new rows:\n","CREATE TABLE animals (\n id MEDIUMINT NOT NULL AUTO_INCREMENT,\n name CHAR(30) NOT NULL,\n PRIMARY KEY (id)\n );\nINSERT INTO animals (name) VALUES ('dog'),('cat'),('penguin'),\n ('lax'),('whale'),('ostrich');\nSELECT * FROM animals;"),(190,23,"UNCOMPRESS"," UNCOMPRESS(string_to_uncompress)\nUncompresses a string compressed by the COMPRESS() function.\nIf the argument is not a compressed value, the result is NULL.\nThis function requires MySQL to have been compiled with a compression library\nsuch as zlib. Otherwise, the return value is always NULL.\n","mysql> SELECT UNCOMPRESS(COMPRESS('any string'));\n -> 'any string'\nmysql> SELECT UNCOMPRESS('any string');\n -> NULL"),(191,19,"ISSIMPLE"," IsSimple(g)\n\nCurrently, this function is a placeholder and should not be used.\nIf implemented, its behavior will be as described in the next paragraph.\n\nReturns 1 if the geometry value g has no anomalous geometric points,\nsuch as self-intersection or self-tangency. IsSimple() returns 0 if the\nargument is not simple, and -1 if it is NULL.\n\nThe description of each instantiable geometric class given earlier in\nthe chapter includes the specific conditions that cause an instance of\nthat class to be classified as not simple.\n",""),(192,4,"- BINARY"," -\nSubtraction:\n","mysql> SELECT 3-5;\n -> -2"),(193,3,"GEOMCOLLFROMTEXT"," GeomCollFromText(wkt[,srid])\n GeometryCollectionFromText(wkt[,srid])\nConstructs a GEOMETRYCOLLECTION value using its WKT representation and SRID.\n",""),(194,3,"WKT DEFINITION","The Well-Known Text (WKT) representation of Geometry is designed to\nexchange geometry data in ASCII form.\n",""); +insert into help_topic (help_topic_id,help_category_id,name,description,example) values (195,14,"CURRENT_TIME"," CURRENT_TIME\n CURRENT_TIME()\n\nCURRENT_TIME and CURRENT_TIME() are synonyms for\nCURTIME().\n",""),(196,25,"LAST_INSERT_ID"," LAST_INSERT_ID()\n LAST_INSERT_ID(expr)\nReturns the last automatically generated value that was inserted into\nan AUTO_INCREMENT column.\n","mysql> SELECT LAST_INSERT_ID();\n -> 195"),(197,14,"LAST_DAY"," LAST_DAY(date)\n\nTakes a date or datetime value and returns the corresponding value for the\nlast day of the month. Returns NULL if the argument is invalid.\n","mysql> SELECT LAST_DAY('2003-02-05');\n -> '2003-02-28'\nmysql> SELECT LAST_DAY('2004-02-05');\n -> '2004-02-29'\nmysql> SELECT LAST_DAY('2004-01-01 01:01:01');\n -> '2004-01-31'\nmysql> SELECT LAST_DAY('2003-03-32');\n -> NULL"),(198,1,"MEDIUMINT"," MEDIUMINT[(M)] [UNSIGNED] [ZEROFILL]\n\nA medium-size integer. The signed range is -8388608 to\n8388607. The unsigned range is 0 to 16777215.\n",""),(199,4,"FLOOR"," FLOOR(X)\nReturns the largest integer value not greater than X.\n","mysql> SELECT FLOOR(1.23);\n -> 1\nmysql> SELECT FLOOR(-1.23);\n -> -2"),(200,23,"RTRIM"," RTRIM(str)\nReturns the string str with trailing space characters removed.\n","mysql> SELECT RTRIM('barbar ');\n -> 'barbar'"),(201,4,"DEGREES"," DEGREES(X)\nReturns the argument X, converted from radians to degrees.\n","mysql> SELECT DEGREES(PI());\n -> 180.000000"),(202,6,"EXPLAIN","The EXPLAIN statement can be used either as a synonym for\nDESCRIBE or as a way to obtain information about how MySQL executes\na SELECT statement:\n\n --- The EXPLAIN tbl_name syntax is synonymous with DESCRIBE tbl_name\nor\nSHOW COLUMNS FROM tbl_name.\n --- When you precede a SELECT statement with the keyword EXPLAIN,\nMySQL explains how it would process the SELECT, providing\ninformation about how tables are joined and in which order.\n","EXPLAIN tbl_name"),(203,1,"VARCHAR"," [NATIONAL] VARCHAR(M) [BINARY]\n\nA variable-length string. M represents the maximum column length.\nThe range of M is 1 to 255 before MySQL 4.0.2, 0 to 255 as of MySQL\n4.0.2, and 0 to 65,535 as of MySQL 5.0.3. (The maximum actual length of a\nVARCHAR in MySQL 5.0 is determined by the maximum row size and the\ncharacter set you use. The maximum effective length is 65,532 bytes.)\n\nNote: Before 5.0.3, trailing spaces were removed when\nVARCHAR values were stored, which differs from the standard SQL\nspecification.\n\nFrom MySQL 4.1.0 to 5.0.2, a VARCHAR column with a length\nspecification greater than 255 is converted to the smallest TEXT\ntype that can hold values of the given length. For example,\nVARCHAR(500) is converted to TEXT, and\nVARCHAR(200000) is converted to MEDIUMTEXT. This is a\ncompatibility feature. However, this conversion affects trailing-space\nremoval.\n\nVARCHAR is shorthand for CHARACTER VARYING.\n\nAs of MySQL 4.1.2, the BINARY attribute is shorthand for specifying\nthe binary collation of the column character set. Sorting and comparison is\nbased on numeric character values. Before 4.1.2, BINARY attribute\ncauses the column to be treated as a binary string. Sorting and comparison\nis based on numeric byte values.\n\nStarting from MySQL 5.0.3, VARCHAR is stored with a one-byte or\ntwo-byte length prefix + data. The length prefix is two bytes if the\nVARCHAR column is declared with a length greater than 255.\n",""),(204,23,"UNHEX"," UNHEX(str)\n\nDoes the opposite of HEX(str). That is, it interprets each pair of\nhexadecimal digits in the argument as a number and converts it to the\ncharacter represented by the number. The resulting characters are returned as\na binary string.\n","mysql> SELECT UNHEX('4D7953514C');\n -> 'MySQL'\nmysql> SELECT 0x4D7953514C;\n -> 'MySQL'\nmysql> SELECT UNHEX(HEX('string'));\n -> 'string'\nmysql> SELECT HEX(UNHEX('1267'));\n -> '1267'"),(205,4,"- UNARY"," -\nUnary minus. Changes the sign of the argument.\n","mysql> SELECT - 2;\n -> -2"),(206,4,"COS"," COS(X)\nReturns the cosine of X, where X is given in radians.\n","mysql> SELECT COS(PI());\n -> -1.000000"),(207,14,"DATE FUNCTION"," DATE(expr)\n\nExtracts the date part of the date or datetime expression expr.\n","mysql> SELECT DATE('2003-12-31 01:02:03');\n -> '2003-12-31'"),(208,6,"RESET MASTER","RESET MASTER\n\nDeletes all binary logs listed in the index file,\nresets the binary log index file to be empty, and creates a new binary log\nfile.\n\nThis statement was named FLUSH MASTER before MySQL 3.23.26.\n",""),(209,4,"TAN"," TAN(X)\nReturns the tangent of X, where X is given in radians.\n","mysql> SELECT TAN(PI()+1);\n -> 1.557408"); +insert into help_topic (help_topic_id,help_category_id,name,description,example) values (210,4,"PI"," PI()\nReturns the value of PI. The default number of decimals displayed is five, but\nMySQL internally uses the full double-precision value for PI.\n","mysql> SELECT PI();\n -> 3.141593\nmysql> SELECT PI()+0.000000000000000000;\n -> 3.141592653589793116"),(211,14,"WEEKOFYEAR"," WEEKOFYEAR(date)\n\nReturns the calendar week of the date as a number in the\nrange from 1 to 53. It is a compatibility function\nthat is equivalent to WEEK(date,3).\n","mysql> SELECT WEEKOFYEAR('1998-02-20');\n -> 8"),(212,4,"/"," /\nDivision:\n","mysql> SELECT 3/5;\n -> 0.60"),(213,12,"STDDEV_SAMP"," STDDEV_SAMP(expr)\nReturns the sample standard deviation of expr (the square root of\nVAR_SAMP(). This function was added in MySQL 5.0.3.\n",""),(214,13,"MLINEFROMWKB"," MLineFromWKB(wkb[,srid])\n MultiLineStringFromWKB(wkb[,srid])\nConstructs a MULTILINESTRING value using its WKB representation and SRID.\n",""),(215,23,"UNCOMPRESSED_LENGTH"," UNCOMPRESSED_LENGTH(compressed_string)\nReturns the length of a compressed string before compression.\n","mysql> SELECT UNCOMPRESSED_LENGTH(COMPRESS(REPEAT('a',30)));\n -> 30"),(216,4,"LOG2"," LOG2(X)\nReturns the base-2 logarithm of X.\n","mysql> SELECT LOG2(65536);\n -> 16.000000\nmysql> SELECT LOG2(-100);\n -> NULL"),(217,14,"SUBTIME"," SUBTIME(expr,expr2)\n\n\nSUBTIME() subtracts expr2 from expr and returns the result.\nexpr is a time or datetime expression, and expr2 is a time\nexpression.\n","mysql> SELECT SUBTIME('1997-12-31 23:59:59.999999',\n -> '1 1:1:1.000002');\n -> '1997-12-30 22:58:58.999997'\nmysql> SELECT SUBTIME('01:00:00.999999', '02:00:00.999998');\n -> '-00:59:59.999999'"),(218,28,"DROP TABLE","DROP TABLE removes one or more tables. You must have the DROP\nprivilege for each table. All table data and the table\ndefinition are /removed/, so /be careful/ with this statement!\n\nIn MySQL 3.22 or later, you can use the keywords IF EXISTS\nto prevent an error from occurring for tables that don't exist. As of\nMySQL 4.1, a NOTE is generated for each non-existent table when\nusing IF EXISTS.\nSee also : [SHOW WARNINGS, , SHOW WARNINGS].\n\nRESTRICT and CASCADE are allowed to make porting easier.\nFor the moment, they do nothing.\n\nNote: DROP TABLE automatically commits the current\nactive transaction, unless you are using MySQL 4.1 or higher and the\nTEMPORARY keyword.\n","DROP [TEMPORARY] TABLE [IF EXISTS]\n tbl_name [, tbl_name] ...\n [RESTRICT | CASCADE]"),(219,22,"DUAL","SELECT ... FROM DUAL is an alias for SELECT ....\n(To be compatible with some other databases).\n",""),(220,23,"INSTR"," INSTR(str,substr)\nReturns the position of the first occurrence of substring substr in\nstring str. This is the same as the two-argument form of\nLOCATE(), except that the arguments are swapped.\n","mysql> SELECT INSTR('foobarbar', 'bar');\n -> 4\nmysql> SELECT INSTR('xbar', 'foobar');\n -> 0"),(221,14,"NOW"," NOW()\n\nReturns the current date and time as a value in 'YYYY-MM-DD HH:MM:SS'\nor YYYYMMDDHHMMSS format, depending on whether the function is used in\na string or numeric context.\n","mysql> SELECT NOW();\n -> '1997-12-15 23:50:26'\nmysql> SELECT NOW() + 0;\n -> 19971215235026"),(222,26,">="," >=\nGreater than or equal:\n","mysql> SELECT 2 >= 2;\n -> 1"),(223,4,"EXP"," EXP(X)\nReturns the value of e (the base of natural logarithms) raised to\nthe power of X.\n","mysql> SELECT EXP(2);\n -> 7.389056\nmysql> SELECT EXP(-2);\n -> 0.135335"),(224,17,"SHA"," SHA1(str)\n SHA(str)\nCalculates an SHA1 160-bit checksum for the string, as described in\nRFC 3174 (Secure Hash Algorithm). The value is returned as a string of 40 hex\ndigits, or NULL if the argument was NULL.\nOne of the possible uses for this function is as a hash key. You can\nalso use it as a cryptographically safe function for storing passwords.\n","mysql> SELECT SHA1('abc');\n -> 'a9993e364706816aba3e25717850c26c9cd0d89d'"); +insert into help_topic (help_topic_id,help_category_id,name,description,example) values (225,1,"LONGBLOB"," LONGBLOB\n\nA BLOB column with a maximum length of 4,294,967,295 or\n4GB (2^32 - 1) bytes. Up to MySQL\n3.23, the client/server protocol and MyISAM tables had a limit\nof 16MB per communication packet / table row. From MySQL 4.0, the maximum\nallowed length of LONGBLOB columns depends on the\nconfigured maximum packet size in the client/server protocol and available\nmemory.\n",""),(226,18,"POINTN"," PointN(ls,n)\nReturns the n-th point in the Linestring value ls.\nPoint numbers begin at 1.\n","mysql> SET @ls = 'LineString(1 1,2 2,3 3)';\nmysql> SELECT AsText(PointN(GeomFromText(@ls),2));\n+-------------------------------------+\n| AsText(PointN(GeomFromText(@ls),2)) |\n+-------------------------------------+\n| POINT(2 2) |\n+-------------------------------------+"),(227,12,"SUM"," SUM([DISTINCT] expr)\nReturns the sum of expr. If the return set has no rows,\nSUM() returns NULL.\nThe DISTINCT keyword can be used as of MySQL 5.0.0 to sum only the\ndistinct values of expr.\n",""),(228,23,"OCT"," OCT(N)\nReturns a string representation of the octal value of N, where\nN is a longlong (BIGINT)number. This is equivalent to\nCONV(N,10,8).\nReturns NULL if N is NULL.\n","mysql> SELECT OCT(12);\n -> '14'"),(229,14,"SYSDATE"," SYSDATE()\n\nSYSDATE() is a synonym for NOW().\n",""),(230,13,"ASBINARY"," AsBinary(g)\nConverts a value in internal geometry format to its WKB representation\nand returns the binary result.\n","SELECT AsBinary(g) FROM geom;"),(231,14,"MAKEDATE"," MAKEDATE(year,dayofyear)\n\nReturns a date, given year and day-of-year values.\ndayofyear must be greater than 0 or the result is NULL.\n","mysql> SELECT MAKEDATE(2001,31), MAKEDATE(2001,32);\n -> '2001-01-31', '2001-02-01'\nmysql> SELECT MAKEDATE(2001,365), MAKEDATE(2004,365);\n -> '2001-12-31', '2004-12-30'\nmysql> SELECT MAKEDATE(2001,0);\n -> NULL"),(232,23,"BINARY OPERATOR"," BINARY\nThe BINARY operator casts the string following it to a binary string.\nThis is an easy way to force a column comparison to be done byte by byte\nrather than character by character. This causes the comparison to be\ncase sensitive even\nif the column isn't defined as BINARY or BLOB.\nBINARY also causes trailing spaces to be significant.\n","mysql> SELECT 'a' = 'A';\n -> 1\nmysql> SELECT BINARY 'a' = 'A';\n -> 0\nmysql> SELECT 'a' = 'a ';\n -> 1\nmysql> SELECT BINARY 'a' = 'a ';\n -> 0"),(233,8,"MBROVERLAPS"," MBROverlaps(g1,g2)\nReturns 1 or 0 to indicate whether or not the Minimum Bounding Rectangles of\nthe two geometries g1 and g2 overlap.\n",""),(234,23,"SOUNDEX"," SOUNDEX(str)\nReturns a soundex string from str. Two strings that sound almost the\nsame should have identical soundex strings. A standard soundex string\nis four characters long, but the SOUNDEX() function returns an\narbitrarily long string. You can use SUBSTRING() on the result to get\na standard soundex string. All non-alphabetic characters are ignored in the\ngiven string. All international alphabetic characters outside the A-Z range\nare treated as vowels.\n","mysql> SELECT SOUNDEX('Hello');\n -> 'H400'\nmysql> SELECT SOUNDEX('Quadratically');\n -> 'Q36324'"),(235,6,"SHOW MASTER LOGS","SHOW MASTER LOGS\nSHOW BINARY LOGS\n\nLists the binary log files on the server. This statement is used as part of\nthe procedure described in [PURGE MASTER LOGS, , PURGE MASTER LOGS]\nfor determining which logs can be purged.\n\nmysql> SHOW BINARY LOGS;\n+---------------+-----------+\n| Log_name | File_size |\n+---------------+-----------+\n| binlog.000015 | 724935 |\n| binlog.000016 | 733481 |\n+---------------+-----------+\n",""),(236,8,"MBRTOUCHES"," MBRTouches(g1,g2)\nReturns 1 or 0 to indicate whether or not the Minimum Bounding Rectangles of\nthe two geometries g1 and g2 touch.\n",""),(237,6,"INSERT SELECT","INSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE]\n [INTO] tbl_name [(col_name,...)]\n SELECT ...\n [ ON DUPLICATE KEY UPDATE col_name=expr, ... ]\n\nWith INSERT ... SELECT, you can quickly insert many rows\ninto a table from one or many tables.\n","INSERT INTO tbl_temp2 (fld_id)\n SELECT tbl_temp1.fld_order_id\n FROM tbl_temp1 WHERE tbl_temp1.fld_order_id > 100;"),(238,1,"VARBINARY"," VARBINARY(M)\n\nThe VARBINARY type is similar to the VARCHAR type, but stores\nbinary byte strings rather than non-binary character strings.\n\nThis type was added in MySQL 4.1.2.\n",""),(239,6,"LOAD INDEX","The LOAD INDEX INTO CACHE statement preloads a table index into the\nkey cache to which it has been assigned by an explicit CACHE INDEX\nstatement, or into the default key cache otherwise. LOAD INDEX INTO\nCACHE is used only for MyISAM tables.\n\nThe IGNORE LEAVES modifier causes only blocks for the non-leaf\nnodes of the index to be preloaded.\n","LOAD INDEX INTO CACHE\n tbl_index_list [, tbl_index_list] ...\n\ntbl_index_list:\n tbl_name\n [[INDEX|KEY] (index_name[, index_name] ...)]\n [IGNORE LEAVES]"); +insert into help_topic (help_topic_id,help_category_id,name,description,example) values (240,6,"UNION","UNION is used to combine the result from many SELECT\nstatements into one result set. UNION is available from MySQL 4.0.0\non.\n\nSelected columns listed in corresponding positions of each SELECT\nstatement should have the same type. (For example, the first column selected\nby the first statement should have the same type as the first column selected\nby the other statements.) The column names used in\nthe first SELECT statement are used as the column names for the\nresults returned.\n","SELECT ...\nUNION [ALL | DISTINCT]\nSELECT ...\n [UNION [ALL | DISTINCT]\n SELECT ...]"),(241,14,"TO_DAYS"," TO_DAYS(date)\nGiven a date date, returns a daynumber (the number of days since year\n0).\n","mysql> SELECT TO_DAYS(950501);\n -> 728779\nmysql> SELECT TO_DAYS('1997-10-07');\n -> 729669"),(242,23,"NOT REGEXP"," expr NOT REGEXP pat\n expr NOT RLIKE pat\n\nThis is the same as NOT (expr REGEXP pat).\n",""),(243,26,"NOT IN"," expr NOT IN (value,...)\nThis is the same as NOT (expr IN (value,...)).\n",""),(244,20,"!"," NOT\n !\nLogical NOT.\nEvaluates to 1 if the operand is 0,\nto 0 if the operand is non-zero,\nand NOT NULL returns NULL.\n","mysql> SELECT NOT 10;\n -> 0\nmysql> SELECT NOT 0;\n -> 1\nmysql> SELECT NOT NULL;\n -> NULL\nmysql> SELECT ! (1+1);\n -> 0\nmysql> SELECT ! 1+1;\n -> 1"),(245,1,"TEXT TYPE"," TEXT[(M)]\n\nA TEXT column with a maximum length of 65,535\n(2^16 - 1) characters.\n\nBeginning with MySQL 4.1, an optional length M can be given.\nMySQL will create the column as the smallest TEXT type largest\nenough to hold values M characters long.\n",""),(246,1,"DOUBLE"," DOUBLE[(M,B)] [UNSIGNED] [ZEROFILL]\n\nA normal-size (double-precision) floating-point number. Allowable values are\n-1.7976931348623157E+308 to -2.2250738585072014E-308,\n0, and 2.2250738585072014E-308 to 1.7976931348623157E+308.\nIf UNSIGNED is specified, negative values are disallowed. M is the\ndisplay width and B is the number of bits of precision. DOUBLE\nwithout arguments or FLOAT(p) (where p is in the range from\n25 to 53) stands for a double-precision floating-point number. A\nsingle-precision floating-point number is accurate to approximately 7 decimal\nplaces; a double-precision floating-point number is accurate to approximately 15\ndecimal places.\n\n DOUBLE PRECISION[(M,D)] [UNSIGNED] [ZEROFILL]\n REAL[(M,D)] [UNSIGNED] [ZEROFILL]\n\nThese are synonyms for DOUBLE.\nException: If the server SQL mode includes the REAL_AS_FLOAT option,\nREAL is a synonym for FLOAT rather than DOUBLE.\n",""),(247,1,"TIME"," TIME\n\nA time. The range is '-838:59:59' to '838:59:59'.\nMySQL displays TIME values in 'HH:MM:SS' format, but\nallows you to assign values to TIME columns using either strings or\nnumbers.\n",""),(248,20,"&&"," AND\n &&\nLogical AND.\nEvaluates to 1 if all operands are non-zero and not NULL,\nto 0 if one or more operands are 0,\notherwise NULL is returned.\n","mysql> SELECT 1 && 1;\n -> 1\nmysql> SELECT 1 && 0;\n -> 0\nmysql> SELECT 1 && NULL;\n -> NULL\nmysql> SELECT 0 && NULL;\n -> 0\nmysql> SELECT NULL && 0;\n -> 0"),(249,16,"X"," X(p)\nReturns the X-coordinate value for the point p as a double-precision\nnumber.\n","mysql> SELECT X(GeomFromText('Point(56.7 53.34)'));\n+--------------------------------------+\n| X(GeomFromText('Point(56.7 53.34)')) |\n+--------------------------------------+\n| 56.7 |\n+--------------------------------------+"),(250,25,"FOUND_ROWS","\nA SELECT statement may include a LIMIT clause to restrict the\nnumber of rows the server returns to the client.\nIn some cases, it is desirable to know how many rows the statement would have\nreturned without the LIMIT, but without running the statement again.\nTo get this row count, include a SQL_CALC_FOUND_ROWS option in the\nSELECT statement, then invoke FOUND_ROWS() afterward:\n","mysql> SELECT SQL_CALC_FOUND_ROWS * FROM tbl_name\n -> WHERE id > 100 LIMIT 10;\nmysql> SELECT FOUND_ROWS();"),(251,25,"SYSTEM_USER"," SYSTEM_USER()\n\nSYSTEM_USER() is a synonym for USER().\n",""),(252,11,"CROSSES"," Crosses(g1,g2)\nReturns 1 if g1 spatially crosses g2.\nReturns NULL if g1 is a Polygon or a MultiPolygon,\nor if g2 is a Point or a MultiPoint.\nOtherwise, returns 0.\n\nThe term /spatially crosses/ denotes a spatial relation between two given\ngeometries that has the following properties:\n\n\n --- The two geometries intersect\n\n --- Their intersection results in a geometry that has\na dimension that is one less than the maximum dimension of the two given\ngeometries\n\n --- Their intersection is not equal to either of the two given geometries\n",""),(253,6,"TRUNCATE TABLE","TRUNCATE TABLE empties a table completely.\nLogically, this is equivalent to a DELETE statement that deletes all\nrows, but there are practical differences under some circumstances.\n\nFor InnoDB before version 5.0.3, TRUNCATE TABLE is\nmapped to DELETE, so there is no difference. Starting with\nMySQL/InnoDB-5.0.3, fast TRUNCATE TABLE is available. The\noperation is still mapped to DELETE if there are foreign\nkey constraints that reference the table.\n\nFor other storage engines, TRUNCATE TABLE differs from\nDELETE FROM in the following ways from MySQL 4.0 and up:\n\n --- Truncate operations drop and re-create the table, which is much faster\nthan deleting rows one by one.\n --- Truncate operations are not transaction-safe; you get an error if\nyou have an active transaction or an active table lock.\n --- The number of deleted rows is not returned.\n --- As long as the table definition file *tbl_name.frm is\nvalid, the table can be re-created as an empty table with TRUNCATE\nTABLE, even if the data or index files have become corrupted.\n --- The table handler does not remember the last used AUTO_INCREMENT\nvalue, but starts counting from the beginning. This is true even for\nMyISAM and InnoDB, which normally does not reuse sequence values.\n\nIn MySQL 3.23, TRUNCATE TABLE is mapped to\nCOMMIT; DELETE FROM tbl_name, so it behaves like DELETE.\nSee also : [DELETE, , DELETE].\n\nTRUNCATE TABLE is an Oracle SQL extension.\nThis statement was added in MySQL 3.23.28, although from 3.23.28\nto 3.23.32, the keyword TABLE must be omitted.\n","TRUNCATE TABLE tbl_name"),(254,14,"CURRENT_DATE"," CURRENT_DATE\n CURRENT_DATE()\n\nCURRENT_DATE and CURRENT_DATE() are synonyms for\nCURDATE().\n",""); +insert into help_topic (help_topic_id,help_category_id,name,description,example) values (255,12,"BIT_XOR"," BIT_XOR(expr)\nReturns the bitwise XOR of all bits in expr. The calculation is\nperformed with 64-bit (BIGINT) precision.\n",""),(256,0,"AREA"," Area(poly)\nReturns as a double-precision number the area of the Polygon value\npoly, as measured in its spatial reference system.\n","mysql> SET @poly = 'Polygon((0 0,0 3,3 0,0 0),(1 1,1 2,2 1,1 1))';\nmysql> SELECT Area(GeomFromText(@poly));\n+---------------------------+\n| Area(GeomFromText(@poly)) |\n+---------------------------+\n| 4 |\n+---------------------------+"),(257,7,"START SLAVE","START SLAVE [thread_type [, thread_type] ... ]\nSTART SLAVE [SQL_THREAD] UNTIL\n MASTER_LOG_FILE = 'log_name', MASTER_LOG_POS = log_pos\nSTART SLAVE [SQL_THREAD] UNTIL\n RELAY_LOG_FILE = 'log_name', RELAY_LOG_POS = log_pos\n\nthread_type: IO_THREAD | SQL_THREAD\n\nSTART SLAVE with no options starts both of the slave threads.\nThe I/O thread reads queries from the master server and stores them in the\nrelay log. The SQL thread reads the relay log and executes the\nqueries.\nSTART SLAVE requires the SUPER privilege.\n\nIf START SLAVE succeeds in starting the slave threads, it\nreturns without any error. However, even in that case, it might be that the slave\nthreads start and then later stop (for example, because they don't manage to\nconnect to the master or read its binary logs, or some other\nproblem). START SLAVE does not warn you about this. You must\ncheck your slave's error log for error messages generated by\nthe slave threads, or check that they are running fine with SHOW\nSLAVE STATUS.\n",""),(258,6,"FLUSH","You should use the FLUSH statement if you want to clear some of the\ninternal caches MySQL uses. To execute FLUSH, you must have\nthe RELOAD privilege.\n","FLUSH [LOCAL | NO_WRITE_TO_BINLOG] flush_option [, flush_option] ..."),(259,7,"DESCRIBE","{DESCRIBE | DESC} tbl_name [col_name | wild]\n\nDESCRIBE provides information about the columns in a table. It is a\nshortcut for SHOW COLUMNS FROM. As of MySQL 5.0.1, these statements\nalso display information for views.\n",""),(260,12,"STDDEV_POP"," STDDEV_POP(expr)\nReturns the population standard deviation of expr (the square root of\nVAR_POP()). This function was added in MySQL 5.0.3. Before 5.0.3,\nyou can use STD() or STDDEV(), which are equivalent but not\nstandard SQL.\n",""),(261,23,"SUBSTRING"," SUBSTRING(str,pos)\n SUBSTRING(str FROM pos)\n SUBSTRING(str,pos,len)\n SUBSTRING(str FROM pos FOR len)\n\nThe forms without a len argument\nreturn a substring from string str starting at position pos.\nThe forms with a len argument\nreturn a substring len characters long from string str,\nstarting at position pos.\nThe forms that use FROM are standard SQL syntax.\n","mysql> SELECT SUBSTRING('Quadratically',5);\n -> 'ratically'\nmysql> SELECT SUBSTRING('foobarbar' FROM 4);\n -> 'barbar'\nmysql> SELECT SUBSTRING('Quadratically',5,6);\n -> 'ratica'"),(262,19,"ISEMPTY"," IsEmpty(g)\nReturns 1 if the geometry value g is the empty geometry, 0 if it is not\nempty, and -1 if the argument is NULL.\nIf the geometry is empty, it represents the empty point set.\n",""),(263,23,"LTRIM"," LTRIM(str)\nReturns the string str with leading space characters removed.\n","mysql> SELECT LTRIM(' barbar');\n -> 'barbar'"),(264,7,"REPAIR","REPAIR TABLE repairs a possibly corrupted table.\nBy default,\nit has the same effect as myisamchk --recover tbl_name.\nREPAIR TABLE works only on MyISAM tables.\n","REPAIR [LOCAL | NO_WRITE_TO_BINLOG] TABLE\n tbl_name [, tbl_name] ... [QUICK] [EXTENDED] [USE_FRM]"),(265,11,"INTERSECTS"," Intersects(g1,g2)\nReturns 1 or 0 to indicate whether or not g1 spatially intersects\ng2.\n",""),(266,8,"MBRDISJOINT"," MBRDisjoint(g1,g2)\nReturns 1 or 0 to indicate whether or not the Minimum Bounding Rectangles of\nthe two geometries g1 and g2 are disjoint (do not intersect).\n",""),(267,23,"SUBSTRING_INDEX"," SUBSTRING_INDEX(str,delim,count)\nReturns the substring from string str before count\noccurrences of the delimiter delim.\nIf count is positive, everything to the left of the final delimiter\n(counting from the left) is returned.\nIf count is negative, everything to the right of the final delimiter\n(counting from the right) is returned.\n","mysql> SELECT SUBSTRING_INDEX('www.mysql.com', '.', 2);\n -> 'www.mysql'\nmysql> SELECT SUBSTRING_INDEX('www.mysql.com', '.', -2);\n -> 'mysql.com'"),(268,17,"ENCODE"," ENCODE(str,pass_str)\nEncrypt str using pass_str as the password.\nTo decrypt the result, use DECODE().\n\nThe result is a binary string of the same length as str.\nIf you want to save it in a column, use a BLOB column type.\n",""),(269,4,"TRUNCATE"," TRUNCATE(X,D)\nReturns the number X, truncated to D decimals. If D\nis 0, the result has no decimal point or fractional part.\nD can be negative to truncate (make zero) D digits left of the\ndecimal point of the value X.\n","mysql> SELECT TRUNCATE(1.223,1);\n -> 1.2\nmysql> SELECT TRUNCATE(1.999,1);\n -> 1.9\nmysql> SELECT TRUNCATE(1.999,0);\n -> 1\nmysql> SELECT TRUNCATE(-1.999,1);\n -> -1.9\nmysql> SELECT TRUNCATE(122,-2);\n -> 100"); +insert into help_topic (help_topic_id,help_category_id,name,description,example) values (270,14,"TIMESTAMPADD"," TIMESTAMPADD(interval,int_expr,datetime_expr)\n\nAdds the integer expression int_expr to the date or datetime expression\ndatetime_expr. The unit for int_expr is given by the\ninterval argument, which should be one of the following values:\nFRAC_SECOND,\nSECOND,\nMINUTE,\nHOUR,\nDAY,\nWEEK,\nMONTH,\nQUARTER,\nor\nYEAR.\n\nThe interval value may be specified using one of keywords as shown,\nor with a prefix of SQL_TSI_. For example, DAY or\nSQL_TSI_DAY both are legal.\n",""),(271,6,"SHOW","\nSHOW has many forms that provide information about databases,\ntables, columns, or status information about the server.\nThis section describes those following:\n\nSHOW [FULL] COLUMNS FROM tbl_name [FROM db_name] [LIKE 'pattern']\nSHOW CREATE DATABASE db_name\nSHOW CREATE TABLE tbl_name\nSHOW DATABASES [LIKE 'pattern']\nSHOW ENGINE engine_name {LOGS | STATUS }\nSHOW [STORAGE] ENGINES\nSHOW ERRORS [LIMIT [offset,] row_count]\nSHOW GRANTS FOR user\nSHOW INDEX FROM tbl_name [FROM db_name]\nSHOW INNODB STATUS\nSHOW [BDB] LOGS\nSHOW PRIVILEGES\nSHOW [FULL] PROCESSLIST\nSHOW [GLOBAL | SESSION] STATUS [LIKE 'pattern']\nSHOW TABLE STATUS [FROM db_name] [LIKE 'pattern']\nSHOW [OPEN] TABLES [FROM db_name] [LIKE 'pattern']\nSHOW [GLOBAL | SESSION] VARIABLES [LIKE 'pattern']\nSHOW WARNINGS [LIMIT [offset,] row_count]\n\n\nThe SHOW statement also has forms that provide information about\nreplication master and slave servers and are described in [Replication\nSQL]:\n\nSHOW BINLOG EVENTS\nSHOW MASTER LOGS\nSHOW MASTER STATUS\nSHOW SLAVE HOSTS\nSHOW SLAVE STATUS\n\nIf the syntax for a given SHOW statement includes a LIKE\n'pattern' part, 'pattern' is a string that can contain the SQL '%'\nand '_' wildcard characters.\nThe pattern is useful for restricting statement output to matching values.\n",""),(272,26,"GREATEST"," GREATEST(value1,value2,...)\nWith two or more arguments, returns the largest (maximum-valued) argument.\nThe arguments are compared using the same rules as for LEAST().\n","mysql> SELECT GREATEST(2,0);\n -> 2\nmysql> SELECT GREATEST(34.0,3.0,5.0,767.0);\n -> 767.0\nmysql> SELECT GREATEST('B','A','C');\n -> 'C'"),(273,23,"OCTETLENGTH"," OCTET_LENGTH(str)\n\nOCTET_LENGTH() is a synonym for LENGTH().\n",""),(274,14,"SECOND"," SECOND(time)\nReturns the second for time, in the range 0 to 59.\n","mysql> SELECT SECOND('10:05:03');\n -> 3"),(275,12,"BIT_AND"," BIT_AND(expr)\nReturns the bitwise AND of all bits in expr. The calculation is\nperformed with 64-bit (BIGINT) precision.\n","mysql> SELECT order.custid, customer.name, MAX(payments)\n -> FROM order,customer\n -> WHERE order.custid = customer.custid\n -> GROUP BY order.custid;"),(276,4,"ATAN2"," ATAN(Y,X)\n ATAN2(Y,X)\nReturns the arc tangent of the two variables X and Y. It is\nsimilar to calculating the arc tangent of Y / X, except that the\nsigns of both arguments are used to determine the quadrant of the\nresult.\n","mysql> SELECT ATAN(-2,2);\n -> -0.785398\nmysql> SELECT ATAN2(PI(),0);\n -> 1.570796"),(277,8,"MBRCONTAINS"," MBRContains(g1,g2)\nReturns 1 or 0 to indicate whether or not the Minimum Bounding Rectangle of\ng1 contains the Minimum Bounding Rectangle of g2.\n","mysql> SET @g1 = GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');\nmysql> SET @g2 = GeomFromText('Point(1 1)');\nmysql> SELECT MBRContains(@g1,@g2), MBRContains(@g2,@g1);\n----------------------+----------------------+\n| MBRContains(@g1,@g2) | MBRContains(@g2,@g1) |\n+----------------------+----------------------+\n| 1 | 0 |\n+----------------------+----------------------+"),(278,14,"HOUR"," HOUR(time)\nReturns the hour for time. The range of the return value is\n0 to 23 for time-of-day values.\n","mysql> SELECT HOUR('10:05:03');\n -> 10"),(279,1,"TYPE SET"," SET('value1','value2',...)\n\nA set. A string object that can have zero or more values, each of which must\nbe chosen from the list of values 'value1', 'value2',\n... A SET column can have a maximum of 64 members.\nSET values are represented internally as integers.\n \n",""),(280,6,"SELECT","SELECT is used to retrieve rows selected from one or more tables.\nSupport for UNION statements and subqueries is available as of MySQL\n4.0 and 4.1, respectively.\nSee [UNION, , UNION] and [Subqueries].\n\n --- Each select_expr indicates a column you want to retrieve.\n\n --- table_references indicates the table or tables from which to retrieve rows.\nIts syntax is described in [JOIN, , JOIN].\n\n --- where_definition consists of the keyword WHERE followed by\nan expression that indicates the condition or conditions that rows\nmust satisfy to be selected.\n\n\nSELECT can also be used to retrieve rows computed without reference to\nany table.\n","SELECT\n [ALL | DISTINCT | DISTINCTROW ]\n [HIGH_PRIORITY]\n [STRAIGHT_JOIN]\n [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [SQL_BUFFER_RESULT]\n [SQL_CACHE | SQL_NO_CACHE] [SQL_CALC_FOUND_ROWS]\n select_expr, ...\n [INTO OUTFILE 'file_name' export_options\n | INTO DUMPFILE 'file_name']\n [FROM table_references\n [WHERE where_definition]\n [GROUP BY {col_name | expr | position}\n [ASC | DESC], ... [WITH ROLLUP]]\n [HAVING where_definition]\n [ORDER BY {col_name | expr | position}\n [ASC | DESC] , ...]\n [LIMIT {[offset,] row_count | row_count OFFSET offset}]\n [PROCEDURE procedure_name(argument_list)]\n [FOR UPDATE | LOCK IN SHARE MODE]]"),(281,4,"COT"," COT(X)\nReturns the cotangent of X.\n","mysql> SELECT COT(12);\n -> -1.57267341\nmysql> SELECT COT(0);\n -> NULL"),(282,7,"BACKUP TABLE","Note: This statement is deprecated. We are working on a better\nreplacement for it that will provide online backup capabilities.\nIn the meantime, the mysqlhotcopy script can be used instead.\n\nBACKUP TABLE copies to the backup directory the minimum number of\ntable files needed to restore the table, after flushing any buffered changes\nto disk. The statement works only for MyISAM tables. It copies the\n*.frm definition and *.MYD data files. The *.MYI\nindex file can be rebuilt from those two files.\nThe directory should be specified as a full pathname.\n","BACKUP TABLE tbl_name [, tbl_name] ... TO '/path/to/backup/directory'"),(283,23,"LOAD_FILE"," LOAD_FILE(file_name)\nReads the file and returns the file contents as a string. The file\nmust be located on the server, you must specify the full pathname to the\nfile, and you must have the FILE privilege. The file must\nbe readable by all and be smaller than max_allowed_packet bytes.\n\nIf the file doesn't exist or cannot be read because one of the preceding\nconditions is not satisfied, the function returns NULL.\n","mysql> UPDATE tbl_name\n SET blob_column=LOAD_FILE('/tmp/picture')\n WHERE id=1;"),(284,3,"POINTFROMTEXT"," PointFromText(wkt[,srid])\nConstructs a POINT value using its WKT representation and SRID.\n",""); +insert into help_topic (help_topic_id,help_category_id,name,description,example) values (285,6,"LOAD TABLE FROM MASTER","LOAD TABLE tbl_name FROM MASTER\n\nTransfers a copy of the table from master to the slave. This statement is\nimplemented mainly for debugging of LOAD DATA FROM MASTER.\nIt requires that the account used for connecting to the master server has the\nRELOAD and SUPER privileges on the master and the\nSELECT privilege on the master table to load.\nOn the slave side, the user that issues LOAD TABLE FROM MASTER should\nhave privileges to drop and create the table.\n\nThe conditions for LOAD DATA FROM MASTER apply here, too. For\nexample, LOAD TABLE FROM MASTER works only for MyISAM tables.\nThe timeout notes for LOAD DATA FROM MASTER apply as well.\n",""),(286,12,"GROUP_CONCAT"," GROUP_CONCAT(expr)\nThis function returns a string result with the concatenated non-NULL\nvalues from a group. It returns NULL if there are no non-NULL\nvalues. The full syntax is as follows:\n\nGROUP_CONCAT([DISTINCT] expr [,expr ...]\n [ORDER BY {unsigned_integer | col_name | expr}\n [ASC | DESC] [,col_name ...]]\n [SEPARATOR str_val])\n","mysql> SELECT student_name,\n -> GROUP_CONCAT(test_score)\n -> FROM student\n -> GROUP BY student_name;"),(287,14,"DATE_FORMAT"," DATE_FORMAT(date,format)\nFormats the date value according to the format string. The\nfollowing specifiers may be used in the format string:\n\n Specifier Description\n %a Abbreviated weekday name (Sun..Sat)\n %b Abbreviated month name (Jan..Dec)\n %c Month, numeric (0..12)\n %D Day of the month with English suffix (0th, 1st, 2nd, 3rd, ...)\n %d Day of the month, numeric (00..31)\n %e Day of the month, numeric (0..31)\n %f Microseconds (000000..999999)\n %H Hour (00..23)\n %h Hour (01..12)\n %I Hour (01..12)\n %i Minutes, numeric (00..59)\n %j Day of year (001..366)\n %k Hour (0..23)\n %l Hour (1..12)\n %M Month name (January..December)\n %m Month, numeric (00..12)\n %p AM or PM\n %r Time, 12-hour (hh:mm:ss followed by AM or PM)\n %S Seconds (00..59)\n %s Seconds (00..59)\n %T Time, 24-hour (hh:mm:ss)\n %U Week (00..53), where Sunday is the first day of the week\n %u Week (00..53), where Monday is the first day of the week\n %V Week (01..53), where Sunday is the first day of the week; used with %X\n %v Week (01..53), where Monday is the first day of the week; used with %x\n %W Weekday name (Sunday..Saturday)\n %w Day of the week (0=Sunday..6=Saturday)\n %X Year for the week where Sunday is the first day of the week, numeric, four digits; used with %V\n %x Year for the week, where Monday is the first day of the week, numeric, four digits; used with %v\n %Y Year, numeric, four digits\n %y Year, numeric, two digits\n %% A literal '%'.\n \n\nAll other characters are copied to the result without interpretation.\n\nThe %v, %V, %x, and %X format specifiers are\navailable as of MySQL 3.23.8. %f is available as of MySQL 4.1.1.\n\nAs of MySQL 3.23, the '%' character is required before\nformat specifier characters. In earlier versions of MySQL,\n'%' was optional.\n\nThe reason the ranges for the month and day specifiers begin with zero\nis that MySQL allows incomplete dates such as '2004-00-00' to be\nstored as of MySQL 3.23.\n","mysql> SELECT DATE_FORMAT('1997-10-04 22:23:00', '%W %M %Y');\n -> 'Saturday October 1997'\nmysql> SELECT DATE_FORMAT('1997-10-04 22:23:00', '%H:%i:%s');\n -> '22:23:00'\nmysql> SELECT DATE_FORMAT('1997-10-04 22:23:00',\n '%D %y %a %d %m %b %j');\n -> '4th 97 Sat 04 10 Oct 277'\nmysql> SELECT DATE_FORMAT('1997-10-04 22:23:00',\n '%H %k %I %r %T %S %w');\n -> '22 22 10 10:23:00 PM 22:23:00 00 6'\nmysql> SELECT DATE_FORMAT('1999-01-01', '%X %V');\n -> '1998 52'"),(288,25,"BENCHMARK"," BENCHMARK(count,expr)\nThe BENCHMARK() function executes the expression expr\nrepeatedly count times. It may be used to time how fast MySQL\nprocesses the expression. The result value is always 0. The intended\nuse is from within the mysql client, which reports query execution times:\n","mysql> SELECT BENCHMARK(1000000,ENCODE('hello','goodbye'));\n+----------------------------------------------+\n| BENCHMARK(1000000,ENCODE('hello','goodbye')) |\n+----------------------------------------------+\n| 0 |\n+----------------------------------------------+\n1 row in set (4.74 sec)"),(289,14,"YEAR"," YEAR(date)\nReturns the year for date, in the range 1000 to 9999.\n","mysql> SELECT YEAR('98-02-03');\n -> 1998"),(290,6,"SHOW ENGINE","SHOW ENGINE displays log or status information about storage engines.\nThe following statements currently are supported:\n\nSHOW ENGINE BDB LOGS\nSHOW ENGINE INNODB STATUS\n\nSHOW ENGINE BDB LOGS displays status information about existing\nBDB log files. It returns the following fields:\n\n\n File\nThe full path to the log file.\n\n Type\nThe log file type (BDB for Berkeley DB log files).\n\n Status\nThe status of the log file (FREE if the file can be removed, or\nIN USE if the file is needed by the transaction subsystem)\n\n \n\nSHOW ENGINE INNODB STATUS displays extensive information about the\nstate of the InnoDB storage engine.\n\nOlder (and now deprecated) synonyms for these statements are SHOW [BDB]\nLOGS and SHOW INNODB STATUS.\n\nSHOW ENGINE can be used as of MySQL 4.1.2.\n","SHOW ENGINE engine_name {LOGS | STATUS }"),(291,21,"RELEASE_LOCK"," RELEASE_LOCK(str)\nReleases the lock named by the string str that was obtained with\nGET_LOCK(). Returns 1 if the lock was released, 0 if the\nlock wasn't locked by this thread (in which case the lock is not released),\nand NULL if the named lock didn't exist. The lock does not exist if\nit was never obtained by a call to GET_LOCK() or if it has previously\nbeen released.\n\nThe DO statement is convenient to use with RELEASE_LOCK().\nSee also : [DO, , DO].\n",""),(292,26,"IS NULL"," IS NULL\n IS NOT NULL\nTests whether a value is or is not NULL.\n","mysql> SELECT 1 IS NULL, 0 IS NULL, NULL IS NULL;\n -> 0, 0, 1\nmysql> SELECT 1 IS NOT NULL, 0 IS NOT NULL, NULL IS NOT NULL;\n -> 1, 1, 0"),(293,14,"CONVERT_TZ"," CONVERT_TZ(dt,from_tz,to_tz)\n\nCONVERT_TZ()\nconverts a datetime value dt from time zone given by from_tz\nto the time zone given by to_tz and returns the resulting value.\nTime zones may be specified as described in [Time zone support].\nThis function returns NULL if the arguments are invalid.\n","mysql> SELECT CONVERT_TZ('2004-01-01 12:00:00','GMT','MET');\n -> '2004-01-01 13:00:00'\nmysql> SELECT CONVERT_TZ('2004-01-01 12:00:00','+00:00','-07:00');\n -> '2004-01-01 05:00:00'"),(294,14,"TIME_TO_SEC"," TIME_TO_SEC(time)\nReturns the time argument, converted to seconds.\n","mysql> SELECT TIME_TO_SEC('22:23:00');\n -> 80580\nmysql> SELECT TIME_TO_SEC('00:39:38');\n -> 2378"),(295,14,"WEEKDAY"," WEEKDAY(date)\nReturns the weekday index for\ndate (0 = Monday, 1 = Tuesday, ... 6 = Sunday).\n","mysql> SELECT WEEKDAY('1998-02-03 22:23:00');\n -> 1\nmysql> SELECT WEEKDAY('1997-11-05');\n -> 2"),(296,23,"EXPORT_SET"," EXPORT_SET(bits,on,off[,separator[,number_of_bits]])\nReturns a string in which for every bit set in the value bits, you\nget an on string and for every reset bit you get an off\nstring. Bits in bits are examined from right to left (from low-order\nto high-order bits). Strings are added to the result from left to right,\nseparated by the separator string (default ','). The number of\nbits examined is given by number_of_bits (default 64).\n","mysql> SELECT EXPORT_SET(5,'Y','N',',',4);\n -> 'Y,N,Y,N'\nmysql> SELECT EXPORT_SET(6,'1','0',',',10);\n -> '0,1,1,0,0,0,0,0,0,0'"),(297,14,"TIME FUNCTION"," TIME(expr)\n\nExtracts the time part of the time or datetime expression expr.\n","mysql> SELECT TIME('2003-12-31 01:02:03');\n -> '01:02:03'\nmysql> SELECT TIME('2003-12-31 01:02:03.000123');\n -> '01:02:03.000123'"),(298,23,"CAST","The CAST() and CONVERT() functions can be used to take a\nvalue of one type and produce a value of another type.\n\nThe type can be one of the following values:\n\n --- BINARY\n --- CHAR\n --- DATE\n --- DATETIME\n --- SIGNED [INTEGER]\n --- TIME\n --- UNSIGNED [INTEGER]\n\nBINARY produces a binary string. See the entry for the BINARY\noperator in this section for a description of how this affects comparisons.\n\nCAST() and CONVERT() are available as of MySQL 4.0.2.\nThe CHAR conversion type is available as of 4.0.6.\nThe USING form of CONVERT() is available as of 4.1.0.\n\nCAST() and CONVERT(... USING ...) are standard SQL syntax.\nThe non-USING form of CONVERT() is ODBC syntax.\n\nCONVERT() with USING is used to convert data between different\ncharacter sets. In MySQL, transcoding names are the same as the\ncorresponding character set names. For example, this statement converts\nthe string 'abc' in the server's default character set to the\ncorresponding string in the utf8 character set:\n\nSELECT CONVERT('abc' USING utf8);\n\n \n\nThe cast functions are useful when you want to create a column with\na specific type in a CREATE ... SELECT statement:\n","SELECT enum_col FROM tbl_name ORDER BY CAST(enum_col AS CHAR);"),(299,23,"SOUNDS LIKE"," expr1 SOUNDS LIKE expr2\n\nThis is the same as SOUNDEX(expr1) = SOUNDEX(expr2). It is\navailable only in MySQL 4.1 or later.\n",""); +insert into help_topic (help_topic_id,help_category_id,name,description,example) values (300,14,"PERIOD_DIFF"," PERIOD_DIFF(P1,P2)\nReturns the number of months between periods P1 and P2.\nP1 and P2 should be in the format YYMM or YYYYMM.\nNote that the period arguments P1 and P2 are /not/\ndate values.\n","mysql> SELECT PERIOD_DIFF(9802,199703);\n -> 11"),(301,23,"LIKE"," expr LIKE pat [ESCAPE 'escape-char']\nPattern matching using\nSQL simple regular expression comparison. Returns 1 (TRUE) or 0\n(FALSE). If either expr or pat is NULL, the result is\nNULL.\n\nThe pattern need not be a literal string. For example, it can be specified\nas a string expression or table column.\n\nWith LIKE you can use the following two wildcard characters\nin the pattern:\n\n Character Description\n % Matches any number of characters, even zero characters\n _ Matches exactly one character\n \n","mysql> SELECT 'David!' LIKE 'David_';\n -> 1\nmysql> SELECT 'David!' LIKE '%D%v%';\n -> 1"),(302,2,"MULTIPOINT"," MultiPoint(pt1,pt2,...)\nConstructs a WKB MultiPoint value using WKB Point arguments.\nIf any argument is not a WKB Point, the return value is NULL.\n",""),(303,27,">>"," >>\nShifts a longlong (BIGINT) number to the right.\n","mysql> SELECT 4 >> 2;\n -> 1"),(304,22,"TRUE FALSE","TRUE and FALSE added as alias for 1 and 0, respectively.\n",""),(305,12,"AVG"," AVG([DISTINCT] expr)\nReturns the average value of expr.\nThe DISTINCT option can be used as of MySQL 5.0.3 to return the averge\nof the distinct values of expr.\n","mysql> SELECT student_name, AVG(test_score)\n -> FROM student\n -> GROUP BY student_name;"),(306,8,"MBRWITHIN"," MBRWithin(g1,g2)\nReturns 1 or 0 to indicate whether or not the Minimum Bounding Rectangle\nof g1 is within the Minimum Bounding Rectangle of g2.\n","mysql> SET @g1 = GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');\nmysql> SET @g2 = GeomFromText('Polygon((0 0,0 5,5 5,5 0,0 0))');\nmysql> SELECT MBRWithin(@g1,@g2), MBRWithin(@g2,@g1);\n+--------------------+--------------------+\n| MBRWithin(@g1,@g2) | MBRWithin(@g2,@g1) |\n+--------------------+--------------------+\n| 1 | 0 |\n+--------------------+--------------------+"),(307,26,"IN"," expr IN (value,...)\nReturns 1 if expr is any of the values in the IN list,\nelse returns 0. If all values are constants, they are\nevaluated according to the type of expr and sorted. The search for the\nitem then is done using a binary search. This means IN is very quick\nif the IN value list consists entirely of constants. If expr\nis a case-sensitive string expression, the string comparison is performed in\ncase-sensitive fashion.\n","mysql> SELECT 2 IN (0,3,5,'wefwf');\n -> 0\nmysql> SELECT 'wefwf' IN (0,3,5,'wefwf');\n -> 1"),(308,23,"QUOTE"," QUOTE(str)\nQuotes a string to produce a result that can be used as a properly escaped\ndata value in an SQL statement. The string is returned surrounded by single\nquotes and with each instance of single quote ('''), backslash ('\\'),\nASCII NUL, and Control-Z preceded by a backslash. If the argument is\nNULL, the return value is the word ``NULL'' without surrounding\nsingle quotes.\nThe QUOTE() function was added in MySQL 4.0.3.\n","mysql> SELECT QUOTE('Don\\'t!');\n -> 'Don\\'t!'\nmysql> SELECT QUOTE(NULL);\n -> NULL"),(309,25,"SESSION_USER"," SESSION_USER()\n\nSESSION_USER() is a synonym for USER().\n",""),(310,14,"QUARTER"," QUARTER(date)\nReturns the quarter of the year for date, in the range 1\nto 4.\n","mysql> SELECT QUARTER('98-04-01');\n -> 2"),(311,23,"POSITION"," POSITION(substr IN str)\n\nPOSITION(substr IN str) is a synonym for LOCATE(substr,str).\n","mysql> SELECT LOCATE('bar', 'foobarbar');\n -> 4\nmysql> SELECT LOCATE('xbar', 'foobar');\n -> 0\nmysql> SELECT LOCATE('bar', 'foobarbar',5);\n -> 7"),(312,21,"IS_USED_LOCK"," IS_USED_LOCK(str)\nChecks whether the lock named str is in use (that is, locked).\nIf so, it returns the connection identifier of the client that holds\nthe lock.\nOtherwise, it returns NULL.\n",""),(313,3,"POLYFROMTEXT"," PolyFromText(wkt[,srid])\n PolygonFromText(wkt[,srid])\nConstructs a POLYGON value using its WKT representation and SRID.\n",""),(314,17,"DES_ENCRYPT"," DES_ENCRYPT(str[,(key_num|key_str)])\n\nEncrypts the string with the given key using the Triple-DES algorithm.\nOn error, this function returns NULL.\n\nNote that this function works only if MySQL has been configured with\nSSL support. See also : [Secure connections].\n\nThe encryption key to use is chosen based on the second argument to\nDES_ENCRYPT(), if one was given:\n\n Argument Description\n No argument \nThe first key from the DES key file is used.\n key_num \nThe given key number (0-9) from the DES key file is used.\n key_str \nThe given key string is used to encrypt str.\n \n\nThe key file can be specified with the --des-key-file server option.\n\nThe return string is a binary string where the first character\nis CHAR(128 | key_num).\n\nThe 128 is added to make it easier to recognize an encrypted key.\nIf you use a string key, key_num is 127.\n\nThe string length for the result is\nnew_len = orig_len + (8-(orig_len % 8))+1.\n","key_num des_key_str"); +insert into help_topic (help_topic_id,help_category_id,name,description,example) values (315,23,"LENGTH"," LENGTH(str)\nReturns the length of the string str, measured in bytes.\nA multi-byte character counts as multiple bytes.\nThis means that for a string containing five two-byte characters,\nLENGTH() returns 10, whereas CHAR_LENGTH() returns\n5.\n","mysql> SELECT LENGTH('text');\n -> 4"),(316,14,"STR_TO_DATE"," STR_TO_DATE(str,format)\nThis is the reverse function of the DATE_FORMAT() function. It takes a\nstring str and a format string format.\nSTR_TO_DATE() returns a DATETIME value if the format\nstring contains both date and time parts, or a DATE or TIME\nvalue if the string contains only date or time parts.\n\nThe date, time, or datetime values contained in str should be given\nin the format indicated by format. For the specifiers that can be\nused in format, see the table in the DATE_FORMAT() function\ndescription. All other characters are just taken verbatim, thus not being\ninterpreted.\nIf str contains an illegal date, time, or datetime value,\nSTR_TO_DATE() returns NULL. Starting from MySQL 5.0.3, an\nillegal value also produces a warning.\n","@c next example commented out until format string becomes optional\n@c mysql> SELECT STR_TO_DATE('2003-10-03');\n@c -> 2003-10-03 00:00:00\nmysql> SELECT STR_TO_DATE('03.10.2003 09.20',\n -> '%d.%m.%Y %H.%i');\n -> '2003-10-03 09:20:00'\nmysql> SELECT STR_TO_DATE('10arp', '%carp');\n -> '0000-10-00 00:00:00'\nmysql> SELECT STR_TO_DATE('2003-15-10 00:00:00',\n -> '%Y-%m-%d %H:%i:%s');\n -> NULL"),(317,16,"Y"," Y(p)\nReturns the Y-coordinate value for the point p as a double-precision\nnumber.\n","mysql> SELECT Y(GeomFromText('Point(56.7 53.34)'));\n+--------------------------------------+\n| Y(GeomFromText('Point(56.7 53.34)')) |\n+--------------------------------------+\n| 53.34 |\n+--------------------------------------+"),(318,0,"NUMINTERIORRINGS"," NumInteriorRings(poly)\nReturns the number of interior rings in the Polygon value poly.\n","mysql> SET @poly =\n -> 'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))';\nmysql> SELECT NumInteriorRings(GeomFromText(@poly));\n+---------------------------------------+\n| NumInteriorRings(GeomFromText(@poly)) |\n+---------------------------------------+\n| 1 |\n+---------------------------------------+"),(319,0,"INTERIORRINGN"," InteriorRingN(poly,n)\nReturns the n-th interior ring for the Polygon value\npoly as a LineString.\nRing numbers begin at 1.\n","mysql> SET @poly =\n -> 'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))';\nmysql> SELECT AsText(InteriorRingN(GeomFromText(@poly),1));\n+----------------------------------------------+\n| AsText(InteriorRingN(GeomFromText(@poly),1)) |\n+----------------------------------------------+\n| LINESTRING(1 1,1 2,2 2,2 1,1 1) |\n+----------------------------------------------+"),(320,14,"UTC_TIME"," UTC_TIME\n UTC_TIME()\nReturns the current UTC time as a value in 'HH:MM:SS' or HHMMSS\nformat, depending on whether the function is used in a string or numeric\ncontext.\n","mysql> SELECT UTC_TIME(), UTC_TIME() + 0;\n -> '18:07:53', 180753"),(321,12,"STDDEV"," STD(expr)\n STDDEV(expr)\nReturns the population standard deviation of expr. This is an\nextension to standard SQL. The STDDEV() form of this function is\nprovided for Oracle compatibility. As of MySQL 5.0.3, the standard SQL\nfunction STDDEV_POP() can be used instead.\n",""),(322,14,"PERIOD_ADD"," PERIOD_ADD(P,N)\nAdds N months to period P (in the format YYMM or\nYYYYMM). Returns a value in the format YYYYMM.\nNote that the period argument P is /not/ a date value.\n","mysql> SELECT PERIOD_ADD(9801,2);\n -> 199803"),(323,27,"|"," |\nBitwise OR:\n","mysql> SELECT 29 | 15;\n -> 31"),(324,3,"GEOMFROMTEXT"," GeomFromText(wkt[,srid])\n GeometryFromText(wkt[,srid])\nConstructs a geometry value of any type using its WKT representation and SRID.\n",""),(325,23,"RIGHT"," RIGHT(str,len)\nReturns the rightmost len characters from the string str.\n","mysql> SELECT RIGHT('foobarbar', 4);\n -> 'rbar'"),(326,14,"DATEDIFF"," DATEDIFF(expr,expr2)\n\n\nDATEDIFF() returns the number of days between the start date\nexpr and the end date expr2.\nexpr and expr2 are date or date-and-time expressions.\nOnly the date parts of the values are used in the calculation.\n","mysql> SELECT DATEDIFF('1997-12-31 23:59:59','1997-12-30');\n -> 1\nmysql> SELECT DATEDIFF('1997-11-30 23:59:59','1997-12-31');\n -> -31"),(327,23,"BIN"," BIN(N)\nReturns a string representation of the binary value of N, where\nN is a longlong (BIGINT) number. This is equivalent to\nCONV(N,10,2). Returns NULL if N is NULL.\n","mysql> SELECT BIN(12);\n -> '1100'"),(328,2,"MULTILINESTRING"," MultiLineString(ls1,ls2,...)\nConstructs a WKB MultiLineString value using WKB LineString\narguments. If any argument is not a WKB LineString, the return\nvalue is NULL.\n",""),(329,6,"LOAD DATA","The LOAD DATA INFILE statement reads rows from a text file into a\ntable at a very high speed.\nFor more information about the efficiency of INSERT versus\nLOAD DATA INFILE and speeding up LOAD DATA INFILE,\n[Insert speed].\n\nAs of MySQL 4.1, the character set indicated by the\ncharacter_set_database system variable is used to interpret the\ninformation in the file. SET NAMES and the setting of\ncharacter_set_client do not affect input interpretation.\n\nYou can also load data files by using the mysqlimport utility; it\noperates by sending a LOAD DATA INFILE statement to the server. The\n--local option causes mysqlimport to read data files from the\nclient host. You can specify the --compress option to get better\nperformance over slow networks if the client and server support the\ncompressed protocol.\nSee also : [mysqlimport, , mysqlimport].\n\nIf you specify the LOW_PRIORITY keyword, execution of the\nLOAD DATA statement is delayed until no other clients are reading\nfrom the table.\n\nIf you specify the CONCURRENT keyword with a MyISAM table that\nsatisfies the condition for concurrent inserts (that is, it contains no free\nblocks in the middle),\nthen other threads can retrieve data from the table while LOAD DATA\nis executing. Using this option affects the performance of LOAD DATA\na bit, even if no other thread is using the table at the same time.\n\nIf the LOCAL keyword is specified, it is\ninterpreted with respect to the client end of the connection:\n\n\n --- If LOCAL is specified, the file is read by the client program on the\nclient host and sent to the server. The file can be given as a full pathname\nto specify its exact location. If given as a relative pathname, the name is\ninterpreted relative to the directory in which the client program was started.\n\n --- If LOCAL is not specified, the\nfile must be located on the server host and is read directly by the server.\n\n\nLOCAL is available in MySQL 3.22.6 or later.\n\nWhen locating files on the server host, the server uses the following rules:\n\n --- If an absolute pathname is given, the server uses the pathname as is.\n\n --- If a relative pathname with one or more leading components is given,\nthe server searches for the file relative to the server's data directory.\n\n --- If a filename with no leading components is given, the server looks for\nthe file in the database directory of the default database.\n\nNote that these rules mean that a file named as *./myfile.txt is read from\nthe server's data directory, whereas the same file named as *myfile.txt is\nread from the database directory of the default database. For example,\nthe following LOAD DATA statement reads the file *data.txt\nfrom the database directory for db1 because db1 is the current\ndatabase, even though the statement explicitly loads the file into a\ntable in the db2 database:\n\nmysql> USE db1;\nmysql> LOAD DATA INFILE 'data.txt' INTO TABLE db2.my_table;\n\nNote that Windows pathnames are specified using forward slashes rather than\nbackslashes. If you do use backslashes, you must double them.\n\nFor security reasons, when reading text files located on the server, the\nfiles must either reside in the database directory or be readable by all.\nAlso, to use LOAD DATA INFILE on server files, you must have the\nFILE privilege.\n","LOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE 'file_name.txt'\n [REPLACE | IGNORE]\n INTO TABLE tbl_name\n [FIELDS\n [TERMINATED BY '\\t']\n [[OPTIONALLY] ENCLOSED BY '']\n [ESCAPED BY '\\\\' ]\n ]\n [LINES\n [STARTING BY '']\n [TERMINATED BY '\\n']\n ]\n [IGNORE number LINES]\n [(col_name,...)]"); +insert into help_topic (help_topic_id,help_category_id,name,description,example) values (330,1,"BLOB TYPE"," BLOB[(M)]\n\nA BLOB column with a maximum length of 65,535\n(2^16 - 1) bytes.\n\nBeginning with MySQL 4.1, an optional length M can be given.\nMySQL will create the column as the smallest BLOB type largest\nenough to hold values M bytes long.\n",""),(331,14,"LOCALTIME"," LOCALTIME\n LOCALTIME()\n\nLOCALTIME and LOCALTIME() are synonyms for\nNOW().\n",""),(332,3,"MPOINTFROMTEXT"," MPointFromText(wkt[,srid])\n MultiPointFromText(wkt[,srid])\nConstructs a MULTIPOINT value using its WKT representation and SRID.\n",""),(333,1,"BLOB","A BLOB is a binary large object that can hold a variable amount of\ndata. The four BLOB types, TINYBLOB, BLOB,\nMEDIUMBLOB, and LONGBLOB, differ only in the maximum length of\nthe values they can hold.\n",""),(334,17,"PASSWORD","","mysql> SELECT PASSWORD('badpwd');\n -> '7f84554057dd964b'"),(335,1,"CHAR"," [NATIONAL] CHAR(M) [BINARY | ASCII | UNICODE]\n\nA fixed-length string that is always right-padded with spaces to the\nspecified length when stored. M represents the column length. The\nrange of M is 0 to 255 characters (1 to 255 prior to MySQL 3.23).\n\nNote: Trailing spaces are removed when CHAR values are\nretrieved.\n\nFrom MySQL 4.1.0 to 5.0.2, a CHAR column with a length specification\ngreater than 255 is converted to the smallest TEXT type that can hold\nvalues of the given length. For example, CHAR(500) is converted to\nTEXT, and CHAR(200000) is converted to MEDIUMTEXT.\nThis is a compatibility feature. However, this conversion causes the column\nto become a variable-length column, and also affects trailing-space removal.\n\nCHAR is shorthand for CHARACTER.\nNATIONAL CHAR (or its equivalent short form, NCHAR) is the\nstandard SQL way to define that a CHAR column should use the default\ncharacter set. This is the default in MySQL.\n\nAs of MySQL 4.1.2, the BINARY attribute is shorthand for specifying\nthe binary collation of the column character set. Sorting and comparison is\nbased on numeric character values. Before 4.1.2, BINARY attribute\ncauses the column to be treated as a binary string. Sorting and comparison\nis based on numeric byte values.\n\nFrom MySQL 4.1.0 on, column type CHAR BYTE is an alias for\nCHAR BINARY. This is a compatibility feature.\n\nFrom MySQL 4.1.0 on, the ASCII attribute can be specified for\nCHAR. It assigns the latin1 character set.\n\nFrom MySQL 4.1.1 on, the UNICODE attribute can be specified for\nCHAR. It assigns the ucs2 character set.\n\nMySQL allows you to create a column of type CHAR(0). This is mainly\nuseful when you have to be compliant with some old applications that depend\non the existence of a column but that do not actually use the value. This\nis also quite nice when you need a column that can take only two values: A\nCHAR(0) column that is not defined as NOT NULL occupies only\none bit and can take only the values NULL and '' (the empty\nstring).\n\n CHAR\nThis is a synonym for CHAR(1).\n",""),(336,14,"UTC_DATE"," UTC_DATE\n UTC_DATE()\nReturns the current UTC date as a value in 'YYYY-MM-DD' or\nYYYYMMDD format, depending on whether the function is used in a\nstring or numeric context.\n","mysql> SELECT UTC_DATE(), UTC_DATE() + 0;\n -> '2003-08-14', 20030814"),(337,19,"DIMENSION"," Dimension(g)\nReturns the inherent dimension of the geometry value g. The result\ncan be -1, 0, 1, or 2. (The meaning of these values is given in\n[GIS class geometry].)\n","mysql> SELECT Dimension(GeomFromText('LineString(1 1,2 2)'));\n+------------------------------------------------+\n| Dimension(GeomFromText('LineString(1 1,2 2)')) |\n+------------------------------------------------+\n| 1 |\n+------------------------------------------------+"),(338,12,"COUNT DISTINCT"," COUNT(DISTINCT expr,[expr...])\nReturns a count of the number of different non-NULL values.\n","mysql> SELECT COUNT(DISTINCT results) FROM student;"),(339,1,"BIT"," BIT[(M)]\n\nA bit-field type. M indicates the number of bits per value, from 1 to\n64. The default is 1 if M is omitted.\n\nThis data type was added in MySQL 5.0.3 for MyISAM, and extended\nin 5.0.5 to MEMORY, InnoDB, and BDB. Before 5.0.3,\nBIT is a synonym for TINYINT(1).\n",""),(340,11,"EQUALS"," Equals(g1,g2)\nReturns 1 or 0 to indicate whether or not g1 is spatially equal to\ng2.\n",""),(341,24,"SHOW CREATE VIEW","This statement shows a CREATE VIEW statement that creates\nthe given view.\n","SHOW CREATE VIEW view_name"),(342,26,"INTERVAL"," INTERVAL(N,N1,N2,N3,...)\nReturns 0 if N < N1, 1 if N < N2\nand so on or -1 if N is NULL. All arguments are treated\nas integers. It is required that N1 < N2 < N3 <\n... < Nn for this function to work correctly. This is because\na binary search is used (very fast).\n","mysql> SELECT INTERVAL(23, 1, 15, 17, 30, 44, 200);\n -> 3\nmysql> SELECT INTERVAL(10, 1, 10, 100, 1000);\n -> 2\nmysql> SELECT INTERVAL(22, 23, 30, 44, 200);\n -> 0"),(343,14,"FROM_DAYS"," FROM_DAYS(N)\nGiven a daynumber N, returns a DATE value.\n","mysql> SELECT FROM_DAYS(729669);\n -> '1997-10-07'"),(344,27,"BIT_COUNT"," BIT_COUNT(N)\nReturns the number of bits that are set in the argument N.\n","mysql> SELECT BIT_COUNT(29);\n -> 4"); +insert into help_topic (help_topic_id,help_category_id,name,description,example) values (345,14,"UTC_TIMESTAMP"," UTC_TIMESTAMP\n UTC_TIMESTAMP()\nReturns the current UTC date and time as a value in 'YYYY-MM-DD HH:MM:SS'\nor YYYYMMDDHHMMSS format, depending on whether the function is used in\na string or numeric context.\n","mysql> SELECT UTC_TIMESTAMP(), UTC_TIMESTAMP() + 0;\n -> '2003-08-14 18:08:04', 20030814180804"),(346,4,"+"," +\nAddition:\n","mysql> SELECT 3+5;\n -> 8"),(347,21,"INET_NTOA"," INET_NTOA(expr)\nGiven a numeric network address (4 or 8 byte), returns the dotted-quad\nrepresentation of the address as a string.\n","mysql> SELECT INET_NTOA(3520061480);\n -> '209.207.224.40'"),(348,4,"ACOS"," ACOS(X)\nReturns the arc cosine of X, that is, the value whose cosine is\nX. Returns NULL if X is not in the range -1 to\n1.\n","mysql> SELECT ACOS(1);\n -> 0.000000\nmysql> SELECT ACOS(1.0001);\n -> NULL\nmysql> SELECT ACOS(0);\n -> 1.570796"),(349,10,"ISOLATION","SET [GLOBAL | SESSION] TRANSACTION ISOLATION LEVEL\n{ READ UNCOMMITTED | READ COMMITTED | REPEATABLE READ | SERIALIZABLE }\n\nThis statement\nsets the transaction isolation level for the next transaction, globally, or\nfor the current session.\n\nThe default behavior of SET TRANSACTION is to set the isolation level\nfor the next (not yet\nstarted) transaction. If you use the GLOBAL keyword, the statement\nsets the default transaction level globally for all new connections\ncreated from that point on. Existing connections are unaffected.\nYou need the SUPER\nprivilege to do this. Using the SESSION keyword sets the\ndefault transaction level for all future transactions performed on the\ncurrent connection.\n\nFor descriptions of each InnoDB transaction isolation level, see\n[InnoDB transaction isolation, InnoDB transaction isolation].\nInnoDB supports each of these levels\nfrom MySQL 4.0.5 on. The default level is REPEATABLE READ.\n\nYou can set the initial default global isolation level for mysqld with\nthe --transaction-isolation option.\nSee also : [Server options].\n",""),(350,4,"CEILING"," CEILING(X)\n CEIL(X)\nReturns the smallest integer value not less than X.\n","mysql> SELECT CEILING(1.23);\n -> 2\nmysql> SELECT CEIL(-1.23);\n -> -1"),(351,4,"SIN"," SIN(X)\nReturns the sine of X, where X is given in radians.\n","mysql> SELECT SIN(PI());\n -> 0.000000"),(352,14,"DAYOFWEEK"," DAYOFWEEK(date)\nReturns the weekday index\nfor date (1 = Sunday, 2 = Monday, ..., 7 =\nSaturday). These index values correspond to the ODBC standard.\n","mysql> SELECT DAYOFWEEK('1998-02-03');\n -> 3"),(353,13,"LINEFROMWKB"," LineFromWKB(wkb[,srid])\n LineStringFromWKB(wkb[,srid])\nConstructs a LINESTRING value using its WKB representation and SRID.\n",""),(354,19,"GEOMETRYTYPE"," GeometryType(g)\nReturns as a string the name of the geometry type of which\nthe geometry instance g is a member.\nThe name corresponds to one of the instantiable Geometry subclasses.\n","mysql> SELECT GeometryType(GeomFromText('POINT(1 1)'));\n+------------------------------------------+\n| GeometryType(GeomFromText('POINT(1 1)')) |\n+------------------------------------------+\n| POINT |\n+------------------------------------------+"),(355,7,"GRANT TYPES","For the GRANT and REVOKE statements, priv_type can be\nspecified as any of the following:\n\n Privilege Meaning\n ALL [PRIVILEGES] Sets all simple privileges except GRANT OPTION\n ALTER Allows use of ALTER TABLE\n ALTER ROUTINE Alter or drop stored routines\n CREATE Allows use of CREATE TABLE\n CREATE ROUTINE Create stored routines\n CREATE TEMPORARY TABLES Allows use of CREATE TEMPORARY TABLE\n CREATE USER Allows use of CREATE USER, DROP USER, RENAME USER, and REVOKE ALL PRIVILEGES.\n CREATE VIEW Allows use of CREATE VIEW\n DELETE Allows use of DELETE\n DROP Allows use of DROP TABLE\n EXECUTE Allows the user to run stored routines\n FILE Allows use of SELECT ... INTO OUTFILE and LOAD DATA INFILE\n INDEX Allows use of CREATE INDEX and DROP INDEX\n INSERT Allows use of INSERT\n LOCK TABLES Allows use of LOCK TABLES on tables for which you have the SELECT privilege\n PROCESS Allows use of SHOW FULL PROCESSLIST\n REFERENCES Not implemented\n RELOAD Allows use of FLUSH\n REPLICATION CLIENT Allows the user to ask where slave or master servers are\n REPLICATION SLAVE Needed for replication slaves (to read binary log events from the master)\n SELECT Allows use of SELECT\n SHOW DATABASES SHOW DATABASES shows all databases\n SHOW VIEW Allows use of SHOW CREATE VIEW\n SHUTDOWN Allows use of mysqladmin shutdown\n SUPER Allows use of CHANGE MASTER, KILL,\nPURGE MASTER LOGS, and SET GLOBAL statements, the mysqladmin debug command; allows you to connect (once) even if max_connections is reached\n UPDATE Allows use of UPDATE\n USAGE Synonym for ``no privileges''\n GRANT OPTION Allows privileges to be granted\n \n",""),(356,24,"CREATE VIEW","This statement creates a new view, or replaces an existing one if the\nOR REPLACE clause is given. The select_statement is a\nSELECT statement that provides the definition of the view.\nThe statement can select from base tables or other views.\n\nThis statement requires the CREATE VIEW privilege for the view, and\nsome privilege for each column selected by the SELECT statement.\nFor columns used elsewhere in the SELECT statement you must have\nthe SELECT privilege. If the OR REPLACE clause is present,\nyou must also have the DELETE privilege for the view.\n\nA view belongs to a database. By default, a new view is created in the\ncurrent database. To create the view explicitly in a given database,\nspecify the name as db_name.view_name when you create it.\n\nmysql> CREATE VIEW test.v AS SELECT * FROM t;\n\nTables and views share the same namespace within a database, so a database\ncannot contain a table and a view that have the same name.\n\nViews must have unique column names with no duplicates, just like base\ntables. By default, the names of the columns retrieved by the SELECT\nstatement are used for the view column names. To define explicit names for\nthe view columns, the optional column_list clause can be given as a\nlist of comma-separated identifiers. The number of names in\ncolumn_list must be the same as the number of columns retrieved by the\nSELECT statement.\n\nColumns retrieved by the SELECT statement can be simple references to\ntable columns. They can also be expressions that use functions, constant\nvalues, operators, and so forth.\n\nUnqualified table or view names in the SELECT statement are\ninterpreted with respect to the default database. A view can refer to\ntables or views in other databases by qualifying the table or view name with\nthe proper database name.\n\nA view can be created from many kinds of SELECT statements. It can\nrefer to base tables or other views. It can use joins, UNION, and\nsubqueries. The SELECT need not even refer to any tables. The\nfollowing example defines a view that selects two columns from another\ntable, as well as an expression calculated from those columns:\n\nmysql> CREATE TABLE t (qty INT, price INT);\nmysql> INSERT INTO t VALUES(3, 50);\nmysql> CREATE VIEW v AS SELECT qty, price, qty*price AS value FROM t;\nmysql> SELECT * FROM v;\n+------+-------+-------+\n| qty | price | value |\n+------+-------+-------+\n| 3 | 50 | 150 |\n+------+-------+-------+\n\nA view definition is subject to the following restrictions:\n\n\n --- The SELECT statement cannot contain a subquery in the FROM\nclause.\n\n --- The SELECT statement cannot refer to system or user variables.\n\n --- The SELECT statement cannot refer to prepared statement parameters.\n\n --- Within a stored routine, the definition cannot refer to routine\nparameters or local variables.\n\n --- Any table or view referred to in the definition must exist. However, after\na view has been created, it is possible to drop a table or view that the\ndefinition refers to. To check a view definition for problems of this kind,\nuse the CHECK TABLE statement.\n\n --- The definition cannot refer to a TEMPORARY table, and you cannot\ncreate a TEMPORARY view.\n\n --- The tables named in the view definition must already exist.\n\n --- You cannot associate a trigger with a view.\n\n\nORDER BY is allowed in a view definition, but it is ignored if you\nselect from a view using a statement that has its own ORDER BY.\n\nFor other options or clauses in the definition, they are added to the\noptions or clauses of the statement that references the view, but the effect\nis undefined. For example, if a view definition includes a LIMIT\nclause, and you select from the view using a statement that has its own\nLIMIT clause, it is undefined which limit applies. This same\nprinciple applies to options such as ALL, DISTINCT, or\nSQL_SMALL_RESULT that follow the SELECT keyword, and to\nclauses such as INTO, FOR UPDATE, LOCK IN SHARE MODE,\nand PROCEDURE.\n\nIf you create a view and then change the query processing environment by\nchanging system variables, that may affect the results you get from the\nview:\n\nmysql> CREATE VIEW v AS SELECT CHARSET(CHAR(65)), COLLATION(CHAR(65));\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> SET NAMES 'latin1';\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> SELECT * FROM v;\n+-------------------+---------------------+\n| CHARSET(CHAR(65)) | COLLATION(CHAR(65)) |\n+-------------------+---------------------+\n| latin1 | latin1_swedish_ci |\n+-------------------+---------------------+\n1 row in set (0.00 sec)\n\nmysql> SET NAMES 'utf8';\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> SELECT * FROM v;\n+-------------------+---------------------+\n| CHARSET(CHAR(65)) | COLLATION(CHAR(65)) |\n+-------------------+---------------------+\n| utf8 | utf8_general_ci |\n+-------------------+---------------------+\n1 row in set (0.00 sec)\n\nThe optional ALGORITHM clause is a MySQL extension to standard SQL.\nALGORITHM takes three values: MERGE, TEMPTABLE, or\nUNDEFINED. The default algorithm is UNDEFINED if no\nALGORITHM clause is present. The algorithm affects how MySQL\nprocesses the view.\n\nFor MERGE, the text of a statement that refers to the view and the view\ndefinition are merged such that parts of the view definition replace\ncorresponding parts of the statement.\n\nFor TEMPTABLE, the results from the view are retrieved into a\ntemporary table, which then is used to execute the statement.\n\nFor UNDEFINED, MySQL chooses which algorithm to use. It prefers\nMERGE over TEMPTABLE if possible, because MERGE is\nusually more efficient and because a view cannot be updatable if a temporary\ntable is used.\n\nA reason to choose TEMPTABLE explicitly is that locks can be released\non underlying tables after the temporary table has been created and before\nit is used to finish processing the statement. This might result in quicker\nlock release than the MERGE algorithm so that other clients that use\nthe view are not blocked as long.\n\nA view algorithm can be UNDEFINED three ways:\n\n\n --- No ALGORITHM clause is present in the CREATE VIEW statement.\n\n --- The CREATE VIEW statement has an explicit ALGORITHM = UNDEFINED\nclause.\n\n --- ALGORITHM = MERGE is specified for a view that can be processed only\nwith a temporary table. In this case, MySQL generates a warning and sets\nthe algorithm to UNDEFINED.\n\n\n\nAs mentioned earlier, MERGE is handled by merging corresponding parts\nof a view definition into the statement that refers to the view. The\nfollowing examples briefly illustrate how the MERGE algorithm works.\nThe examples assume that there is a view v_merge that has this\ndefinition:\n\nCREATE ALGORITHM = MERGE VIEW v_merge (vc1, vc2) AS\nSELECT c1, c2 FROM t WHERE c3 > 100;\n\nExample 1: Suppose that we issue this statement:\n\nSELECT * FROM v_merge;\n\nMySQL handles the statement as follows:\n\n\n --- v_merge becomes t\n\n --- * becomes vc1, vc2, which corresponds to c1, c2\n\n --- The view WHERE clause is added\n\n\nThe resulting statement to be executed becomes:\n\nSELECT c1, c2 FROM t WHERE c3 > 100;\n\nExample 2: Suppose that we issue this statement:\n\nSELECT * FROM v_merge WHERE vc1 < 100;\n\nThis statement is handled similarly to the previous one, except that\nvc1 < 100 becomes c1 < 100 and the view WHERE clause is\nadded to the statement WHERE clause using an AND connective\n(and parentheses are added to make sure the parts of the clause are executed\nwith correct precedence). The resulting statement to be executed becomes:\n\nSELECT c1, c2 FROM t WHERE (c3 > 100) AND (c1 < 100);\n\nEffectively, the statement to be executed has a WHERE clause of this\nform:\n\nWHERE (select WHERE) AND (view WHERE)\n\nThe MERGE algorithm requires a one-to relationship between the rows\nin the view and the rows in the underlying table. If this relationship does\nnot hold, a temporary table must be used instead. Lack of a one-to-one\nrelationship occurs if the view contains any of a number of constructs:\n\n\n --- Aggregate functions (SUM(), MIN(), MAX(),\nCOUNT(), and so forth)\n\n --- DISTINCT\n\n --- GROUP BY\n\n --- HAVING\n\n --- UNION or UNION ALL\n\n --- Refers only to literal values (in this case, there is no underlying table)\n\n\nSome views are updatable. That is, you can use them in statements such as\nUPDATE, DELETE, or INSERT to update the contents of the\nunderlying table. For a view to be updatable, there must be a one-to\nrelationship between the rows in the view and the rows in the underlying\ntable. There are also certain other constructs that make a view\nnon-updatable. To be more specific, a view is not updatable if it contains\nany of the following:\n\n\n --- Aggregate functions (SUM(), MIN(), MAX(),\nCOUNT(), and so forth)\n\n --- DISTINCT\n\n --- GROUP BY\n\n --- HAVING\n\n --- UNION or UNION ALL\n\n --- Subquery in the select list\n\n --- Join\n\n --- Non-updatable view in the FROM clause\n\n --- A subquery in the WHERE clause that refers to a table in the\nFROM clause\n\n --- Refers only to literal values (in this case, there is no underlying table to\nupdate)\n\n --- ALGORITHM = TEMPTABLE (use of a temporary table always makes a view\nnon-updatable)\n\n\nWith respect to insertability (being updatable with INSERT\nstatements), an updatable view is insertable if it also satisfies these\nadditional requirements for the view columns:\n\n\n --- There must be no duplicate view column names.\n\n --- The view must contain all columns in the base table that do not have a\ndefault value.\n\n --- The view columns must be simple column references and not derived columns.\nA derived column is one that is not a simple column reference but is derived\nfrom an expression. These are examples of derived columns:\n\n3.14159\ncol1 + 3\nUPPER(col2)\ncol3 / col4\n(subquery)\n\n\nA view that has a mix of simple column references and derived columns is not\ninsertable, but it can be updatable if you update only those columns that\nare not derived. Consider this view:\n\nCREATE VIEW v AS SELECT col1, 1 AS col2 FROM t;\n\nThis view is not insertable because col2 is derived from an\nexpression. But it is updatable if the update does not try to update\ncol2. This update is allowable:\n\nUPDATE v SET col1 = 0;\n\nThis update is not allowable because it attempts to update a derived column:\n\nUPDATE v SET col2 = 0;\n\nIt is sometimes possible for a multiple-table view to be updatable, assuming\nthat it can be processed with the MERGE algorithm. For this to work,\nthe view must use an inner join (not an outer join or a UNION). Also,\nonly a single table in the view definition can be updated, so the SET\nclause must name only columns from one of the tables in the view. Views\nthat use UNION ALL are disallowed even though they might be\ntheoretically updatable, because the implementation uses temporary tables to\nprocess them.\n\n\nFor a multiple-table updatable view, INSERT can work if it inserts into a\nsingle table. DELETE is not supported.\n\nThe WITH CHECK OPTION clause can be given for an updatable view to\nprevent inserts or updates to rows except those for which the WHERE\nclause in the select_statement is true.\n",""),(357,23,"TRIM"," TRIM([{BOTH | LEADING | TRAILING} [remstr] FROM] str)\n TRIM(remstr FROM] str)\nReturns the string str with all remstr prefixes and/or suffixes\nremoved. If none of the specifiers BOTH, LEADING, or\nTRAILING is given, BOTH is assumed. If remstr is optional\nand not specified, spaces are removed.\n","mysql> SELECT TRIM(' bar ');\n -> 'bar'\nmysql> SELECT TRIM(LEADING 'x' FROM 'xxxbarxxx');\n -> 'barxxx'\nmysql> SELECT TRIM(BOTH 'x' FROM 'xxxbarxxx');\n -> 'bar'\nmysql> SELECT TRIM(TRAILING 'xyz' FROM 'barxxyz');\n -> 'barx'"),(358,26,"IS"," IS boolean_value\n IS NOT boolean_value\nTests whether a value against a boolean value, where boolean_value can\nbe TRUE, FALSE, or UNKNOWN.\n","mysql> SELECT 1 IS TRUE, 0 IS FALSE, NULL IS UNKNOWN;\n -> 1, 1, 1\nmysql> SELECT 1 IS NOT UNKNOWN, 0 IS NOT UNKNOWN, NULL IS NOT UNKNOWN;\n -> 1, 1, 0"),(359,14,"GET_FORMAT"," GET_FORMAT(DATE|TIME|DATETIME, 'EUR'|'USA'|'JIS'|'ISO'|'INTERNAL')\nReturns a format string. This function is useful in combination with the\nDATE_FORMAT() and the STR_TO_DATE() functions.\nThe three possible values for the first argument\nand the five possible values for the second argument result in 15 possible\nformat strings (for the specifiers used, see the table in the\nDATE_FORMAT() function description).\n Function Call Result\n GET_FORMAT(DATE,'USA') '%m.%d.%Y'\n GET_FORMAT(DATE,'JIS') '%Y-%m-%d'\n GET_FORMAT(DATE,'ISO') '%Y-%m-%d'\n GET_FORMAT(DATE,'EUR') '%d.%m.%Y'\n GET_FORMAT(DATE,'INTERNAL') '%Y%m%d'\n GET_FORMAT(DATETIME,'USA') '%Y-%m-%d-%H.%i.%s'\n GET_FORMAT(DATETIME,'JIS') '%Y-%m-%d %H:%i:%s'\n GET_FORMAT(DATETIME,'ISO') '%Y-%m-%d %H:%i:%s'\n GET_FORMAT(DATETIME,'EUR') '%Y-%m-%d-%H.%i.%s'\n GET_FORMAT(DATETIME,'INTERNAL') '%Y%m%d%H%i%s'\n GET_FORMAT(TIME,'USA') '%h:%i:%s %p'\n GET_FORMAT(TIME,'JIS') '%H:%i:%s'\n GET_FORMAT(TIME,'ISO') '%H:%i:%s'\n GET_FORMAT(TIME,'EUR') '%H.%i.%S'\n GET_FORMAT(TIME,'INTERNAL') '%H%i%s'\n \nISO format is ISO 9075, not ISO 8601.\n\nAs of MySQL 4.1.4, TIMESTAMP can also be used;\nGET_FORMAT() returns the same values as for DATETIME.\n","mysql> SELECT DATE_FORMAT('2003-10-03',GET_FORMAT(DATE,'EUR'));\n -> '03.10.2003'\nmysql> SELECT STR_TO_DATE('10.31.2003',GET_FORMAT(DATE,'USA'));\n -> 2003-10-31\n@c Following is commented out because not yet implemented\n@c mysql> SET DATE_FORMAT=GET_FORMAT(DATE, 'USA'); SELECT '2003-10-31';\n@c -> 10-31-2003"); +insert into help_topic (help_topic_id,help_category_id,name,description,example) values (360,1,"TINYBLOB"," TINYBLOB\n\nA BLOB column with a maximum length of 255\n(2^8 - 1) bytes.\n",""),(361,10,"SAVEPOINT","SAVEPOINT identifier\nROLLBACK TO SAVEPOINT identifier\n\nStarting from MySQL 4.0.14 and 4.1.1, InnoDB supports the SQL statements\nSAVEPOINT and ROLLBACK TO SAVEPOINT.\n",""),(362,9,"IF"," IF(expr1,expr2,expr3)\nIf expr1 is TRUE (expr1 <> 0 and expr1 <> NULL) then\nIF() returns expr2, else it returns expr3.\nIF() returns a numeric or string value, depending on the context\nin which it is used.\n","mysql> SELECT IF(1>2,2,3);\n -> 3\nmysql> SELECT IF(1<2,'yes','no');\n -> 'yes'\nmysql> SELECT IF(STRCMP('test','test1'),'no','yes');\n -> 'no'"),(363,6,"PURGE","","PURGE MASTER LOGS TO 'mysql-bin.010';\nPURGE MASTER LOGS BEFORE '2003-04-02 22:46:26';"),(364,25,"USER"," USER()\n\nReturns the current MySQL username and hostname.\n","mysql> SELECT USER();\n -> 'davida@localhost'"),(365,13,"MPOINTFROMWKB"," MPointFromWKB(wkb[,srid])\n MultiPointFromWKB(wkb[,srid])\nConstructs a MULTIPOINT value using its WKB representation and SRID.\n",""),(366,28,"ALTER TABLE","ALTER TABLE allows you to change the structure of an existing table.\nFor example, you can add or delete columns, create or destroy indexes, change\nthe type of existing columns, or rename columns or the table itself. You can\nalso change the comment for the table and type of the table.\n","ALTER [IGNORE] TABLE tbl_name\n alter_specification [, alter_specification] ...\n\nalter_specification:\n ADD [COLUMN] column_definition [FIRST | AFTER col_name ]\n | ADD [COLUMN] (column_definition,...)\n | ADD INDEX [index_name] [index_type] (index_col_name,...)\n | ADD [CONSTRAINT [symbol]]\n PRIMARY KEY [index_type] (index_col_name,...)\n | ADD [CONSTRAINT [symbol]]\n UNIQUE [index_name] [index_type] (index_col_name,...)\n | ADD [FULLTEXT|SPATIAL] [index_name] (index_col_name,...)\n | ADD [CONSTRAINT [symbol]]\n FOREIGN KEY [index_name] (index_col_name,...)\n [reference_definition]\n | ALTER [COLUMN] col_name {SET DEFAULT literal | DROP DEFAULT}\n | CHANGE [COLUMN] old_col_name column_definition\n [FIRST|AFTER col_name]\n | MODIFY [COLUMN] column_definition [FIRST | AFTER col_name]\n | DROP [COLUMN] col_name\n | DROP PRIMARY KEY\n | DROP INDEX index_name\n | DROP FOREIGN KEY fk_symbol\n | DISABLE KEYS\n | ENABLE KEYS\n | RENAME [TO] new_tbl_name\n | ORDER BY col_name\n | CONVERT TO CHARACTER SET charset_name [COLLATE collation_name]\n | [DEFAULT] CHARACTER SET charset_name [COLLATE collation_name]\n | DISCARD TABLESPACE\n | IMPORT TABLESPACE\n | table_options"),(367,22,"CHAR BYTE","CHAR BYTE is an alias for CHAR BINARY.\n",""),(368,7,"MERGE","\n@menu\n* MERGE table problems:: MERGE Table Problems\n@end menu\n\nThe MERGE storage engine was introduced in MySQL 3.23.25. It\nis also known as the MRG_MyISAM engine.\n\nA MERGE table is a collection of identical MyISAM tables that\ncan be used as one. ``Identical'' means that all tables have\nidentical column and index information. You can't merge tables in which the\ncolumns are listed in a different order, don't have exactly the same columns, or\nhave the indexes in different order. However, any or all of the tables can be\ncompressed with myisampack.\nSee also : [myisampack, , myisampack].\nDifferences in table options such as AVG_ROW_LENGTH, MAX_ROWS,\nor PACK_KEYS do not matter.\n","mysql> CREATE TABLE t1 (\n -> a INT NOT NULL AUTO_INCREMENT PRIMARY KEY,\n -> message CHAR(20));\nmysql> CREATE TABLE t2 (\n -> a INT NOT NULL AUTO_INCREMENT PRIMARY KEY,\n -> message CHAR(20));\nmysql> INSERT INTO t1 (message) VALUES ('Testing'),('table'),('t1');\nmysql> INSERT INTO t2 (message) VALUES ('Testing'),('table'),('t2');\nmysql> CREATE TABLE total (\n -> a INT NOT NULL AUTO_INCREMENT,\n -> message CHAR(20), INDEX(a))\n -> TYPE=MERGE UNION=(t1,t2) INSERT_METHOD=LAST;"),(369,28,"CREATE TABLE","CREATE TABLE creates a table with the given name.\nYou must have the CREATE privilege for the table.\n\nRules for allowable table names are given in [Legal names].\nBy default, the table is created in the current database.\nAn error occurs if the table exists, if there is no current database,\nor if the database does not exist.\n","CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name\n [(create_definition,...)]\n [table_options] [select_statement]"),(370,26,">"," >\nGreater than:\n","mysql> SELECT 2 > 2;\n -> 0"),(371,14,"MICROSECOND"," MICROSECOND(expr)\n\nReturns the microseconds from the time or datetime expression expr as a\nnumber in the range from 0 to 999999.\n","mysql> SELECT MICROSECOND('12:00:00.123456');\n -> 123456\nmysql> SELECT MICROSECOND('1997-12-31 23:59:59.000010');\n -> 10"),(372,7,"ANALYZE","This statement analyzes and stores the key distribution for a table.\nDuring the analysis, the table is locked with a read lock. This works on\nMyISAM and BDB tables and (as of MySQL 4.0.13) InnoDB\ntables. For MyISAM tables, this\nstatement is equivalent to using myisamchk -a.\n\nMySQL uses the stored key distribution to decide the order in which\ntables should be joined when you perform a join on something other than a\nconstant.\n","ANALYZE [LOCAL | NO_WRITE_TO_BINLOG] TABLE tbl_name [, tbl_name] ..."),(373,7,"CONSTRAINT","The syntax of a foreign key constraint definition in InnoDB looks like\nthis:\n\n[CONSTRAINT symbol] FOREIGN KEY [id] (index_col_name, ...)\n REFERENCES tbl_name (index_col_name, ...)\n [ON DELETE {RESTRICT | CASCADE | SET NULL | NO ACTION}]\n [ON UPDATE {RESTRICT | CASCADE | SET NULL | NO ACTION}]\n","CREATE TABLE product (category INT NOT NULL, id INT NOT NULL,\n price DECIMAL,\n PRIMARY KEY(category, id)) TYPE=INNODB;\nCREATE TABLE customer (id INT NOT NULL,\n PRIMARY KEY (id)) TYPE=INNODB;\nCREATE TABLE product_order (no INT NOT NULL AUTO_INCREMENT,\n product_category INT NOT NULL,\n product_id INT NOT NULL,\n customer_id INT NOT NULL,\n PRIMARY KEY(no),\n INDEX (product_category, product_id),\n FOREIGN KEY (product_category, product_id)\n REFERENCES product(category, id)\n ON UPDATE CASCADE ON DELETE RESTRICT,\n INDEX (customer_id),\n FOREIGN KEY (customer_id)\n REFERENCES customer(id)) TYPE=INNODB;"),(374,23,"FIELD"," FIELD(str,str1,str2,str3,...)\nReturns the index of str in the str1, str2,\nstr3, ... list.\nReturns 0 if str is not found.\n\nIf all arguments to FIELD() are strings, all arguments are compared\nas strings. If all arguments are numbers, they are compared as\nnumbers. Otherwise, the arguments are compared as double.\n\nIf str is NULL, the return value is 0 because\nNULL fails equality comparison with any value.\nFIELD() is the complement of ELT().\n","mysql> SELECT FIELD('ej', 'Hej', 'ej', 'Heja', 'hej', 'foo');\n -> 2\nmysql> SELECT FIELD('fo', 'Hej', 'ej', 'Heja', 'hej', 'foo');\n -> 0"); +insert into help_topic (help_topic_id,help_category_id,name,description,example) values (375,14,"MAKETIME"," MAKETIME(hour,minute,second)\n\nReturns a time value calculated from the hour, minute, and\nsecond arguments.\n","mysql> SELECT MAKETIME(12,15,30);\n -> '12:15:30'"),(376,14,"CURDATE"," CURDATE()\n\nReturns the current date as a value in 'YYYY-MM-DD' or YYYYMMDD\nformat, depending on whether the function is used in a string or numeric\ncontext.\n","mysql> SELECT CURDATE();\n -> '1997-12-15'\nmysql> SELECT CURDATE() + 0;\n -> 19971215"),(377,12,"MIN MAX"," MIN([DISTINCT] expr)\n MAX([DISTINCT] expr)\nReturns the minimum or maximum value of expr. MIN() and\nMAX() may take a string argument; in such cases they return the\nminimum or maximum string value. See also : [MySQL indexes].\nThe DISTINCT keyword can be used as of MySQL 5.0.0 to find the minimum\nor maximum of the distinct values of expr; this is supported, but\nproduces the same result as omitting DISTINCT.\n","mysql> SELECT student_name, MIN(test_score), MAX(test_score)\n -> FROM student\n -> GROUP BY student_name;"),(378,7,"SET PASSWORD","","SET PASSWORD = PASSWORD('some password')\nSET PASSWORD FOR user = PASSWORD('some password')"),(379,1,"ENUM"," ENUM('value1','value2',...)\n\nAn enumeration. A string object that can have only one value, chosen\nfrom the list of values 'value1', 'value2', ...,\nNULL or the special '' error value. An ENUM column can\nhave a maximum of 65,535 distinct values.\nENUM values are represented internally as integers.\n",""),(380,25,"DATABASE"," DATABASE()\nReturns the default (current) database name.\nAs of MySQL 4.1, the string has the utf8 character set.\n","mysql> SELECT DATABASE();\n -> 'test'"),(381,13,"POINTFROMWKB"," PointFromWKB(wkb[,srid])\nConstructs a POINT value using its WKB representation and SRID.\n",""),(382,4,"POWER"," POW(X,Y)\n POWER(X,Y)\nReturns the value of X raised to the power of Y.\n","mysql> SELECT POW(2,2);\n -> 4.000000\nmysql> SELECT POW(2,-2);\n -> 0.250000"),(383,4,"ATAN"," ATAN(X)\nReturns the arc tangent of X, that is, the value whose tangent is\nX.\n","mysql> SELECT ATAN(2);\n -> 1.107149\nmysql> SELECT ATAN(-2);\n -> -1.107149"),(384,23,"STRCMP"," STRCMP(expr1,expr2)\nSTRCMP()\nreturns 0 if the strings are the same, -1 if the first\nargument is smaller than the second according to the current sort order,\nand 1 otherwise.\n","mysql> SELECT STRCMP('text', 'text2');\n -> -1\nmysql> SELECT STRCMP('text2', 'text');\n -> 1\nmysql> SELECT STRCMP('text', 'text');\n -> 0"),(385,6,"INSERT DELAYED","The DELAYED option for the INSERT statement is a\nMySQL extension to standard SQL that is very useful if you have clients\nthat can't wait for the INSERT to complete. This is a common\nproblem when you use MySQL for logging and you also\nperiodically run SELECT and UPDATE statements that take a\nlong time to complete. DELAYED was introduced in MySQL\n3.22.15.\n\nWhen a client uses INSERT DELAYED, it gets an okay from the server at\nonce, and the row is queued to be inserted when the table is not in use by\nany other thread.\n\nAnother major benefit of using INSERT DELAYED is that inserts\nfrom many clients are bundled together and written in one block. This is much\nfaster than doing many separate inserts.\n\nThere are some constraints on the use of DELAYED:\n\n\n --- INSERT DELAYED works only with ISAM, MyISAM, and (beginning\nwith MySQL 4.1) MEMORY tables.\nFor MyISAM tables, if there are no free blocks in the middle of the\ndata file, concurrent SELECT and INSERT statements are supported.\nUnder these circumstances, you very seldom need to use INSERT\nDELAYED with MyISAM.\nSee also : [MyISAM storage engine, , MyISAM storage engine].\nSee also : [MEMORY storage engine, , MEMORY storage engine].\n\n --- INSERT DELAYED should be used only for INSERT statements that\nspecify value lists. This is enforced as of MySQL 4.0.18. The server ignores\nDELAYED for INSERT DELAYED ... SELECT statements.\n\n --- The server ignores\nDELAYED for INSERT DELAYED ... ON DUPLICATE UPDATE statements.\n\n --- Because the statement returns immediately before the rows are inserted,\nyou cannot use LAST_INSERT_ID() to get the AUTO_INCREMENT\nvalue the statement might generate.\n\n --- DELAYED rows are not visible to SELECT statements until they\nactually have been inserted.\n\n --- DELAYED are ignored on slaves, because this could cause the slave to\nhave different data than the master.\n","INSERT DELAYED ..."),(386,1,"MEDIUMTEXT"," MEDIUMTEXT\n\nA TEXT column with a maximum length of 16,777,215\n(2^24 - 1) characters.\n",""),(387,4,"LN"," LN(X)\nReturns the natural logarithm of X.\n","mysql> SELECT LN(2);\n -> 0.693147\nmysql> SELECT LN(-2);\n -> NULL"),(388,4,"LOG"," LOG(X)\n LOG(B,X)\nIf called with one parameter, this function returns the natural logarithm\nof X.\n","mysql> SELECT LOG(2);\n -> 0.693147\nmysql> SELECT LOG(-2);\n -> NULL"),(389,6,"SET SQL_LOG_BIN","SET SQL_LOG_BIN = {0|1}\n\nDisables or enables binary logging for the current connection\n(SQL_LOG_BIN is a session variable)\nif the client connects using an account that has the SUPER privilege.\nThe statement is refused with an error if the client does not have that\nprivilege. (Before MySQL 4.1.2, the statement was simply ignored in that case.)\n",""); +insert into help_topic (help_topic_id,help_category_id,name,description,example) values (390,26,"!="," <>\n !=\nNot equal:\n","mysql> SELECT '.01' <> '0.01';\n -> 1\nmysql> SELECT .01 <> '0.01';\n -> 0\nmysql> SELECT 'zapp' <> 'zappp';\n -> 1"),(391,17,"AES_DECRYPT"," AES_ENCRYPT(str,key_str)\n AES_DECRYPT(crypt_str,key_str)\nThese functions allow encryption and decryption of data using the official\nAES (Advanced Encryption Standard) algorithm, previously known as \"Rijndael.\"\nEncoding with a 128-bit key length is used, but you can extend it up to\n256 bits by modifying the source. We chose 128 bits because it is much\nfaster and it is usually secure enough.\n\nThe input arguments may be any length. If either argument is NULL,\nthe result of this function is also NULL.\n\nBecause AES is a block-level algorithm, padding is used to encode uneven length\nstrings and so the result string length may be calculated as\n16*(trunc(string_length/16)+1).\n\nIf AES_DECRYPT() detects invalid data or incorrect padding, it\nreturns NULL. However, it is possible for AES_DECRYPT()\nto return a non-NULL value (possibly garbage) if the input data or\nthe key is invalid.\n\nYou can use the AES functions to store data in an encrypted form by\nmodifying your queries:\n","INSERT INTO t VALUES (1,AES_ENCRYPT('text','password'));"),(392,14,"DAYNAME"," DAYNAME(date)\nReturns the name of the weekday for date.\n","mysql> SELECT DAYNAME('1998-02-05');\n -> 'Thursday'"),(393,25,"COERCIBILITY"," COERCIBILITY(str)\nReturns the collation coercibility value of the string argument.\n","mysql> SELECT COERCIBILITY('abc' COLLATE latin1_swedish_ci);\n -> 0\nmysql> SELECT COERCIBILITY(USER());\n -> 3\nmysql> SELECT COERCIBILITY('abc');\n -> 4"),(394,1,"INT"," INT[(M)] [UNSIGNED] [ZEROFILL]\n\nA normal-size integer. The signed range is -2147483648 to\n2147483647. The unsigned range is 0 to 4294967295.\n\n INTEGER[(M)] [UNSIGNED] [ZEROFILL]\n\nThis is a synonym for INT.\n",""),(395,23,"RLIKE"," expr REGEXP pat\n expr RLIKE pat\n\nPerforms a pattern match of a string expression expr against a pattern\npat. The pattern can be an extended regular expression. The syntax\nfor regular expressions is discussed in [Regexp]. Returns 1\nif expr matches pat, otherwise returns 0. If either\nexpr or pat is NULL, the result is NULL.\nRLIKE is a synonym for REGEXP, provided for mSQL\ncompatibility.\n\nThe pattern need not be a literal string. For example, it can be specified\nas a string expression or table column.\n\nNote: Because MySQL uses the C escape syntax in strings (for example,\n'\\n' to represent newline), you must double any '\\' that you\nuse in your REGEXP strings.\n\nAs of MySQL 3.23.4, REGEXP is not case sensitive for normal (not\nbinary) strings.\n","mysql> SELECT 'Monty!' REGEXP 'm%y%%';\n -> 0\nmysql> SELECT 'Monty!' REGEXP '.*';\n -> 1\nmysql> SELECT 'new*\\n*line' REGEXP 'new\\\\*.\\\\*line';\n -> 1\nmysql> SELECT 'a' REGEXP 'A', 'a' REGEXP BINARY 'A';\n -> 1 0\nmysql> SELECT 'a' REGEXP '^[a-d]';\n -> 1"),(396,18,"GLENGTH"," GLength(ls)\nReturns as a double-precision number the length of the LineString\nvalue ls in its associated spatial reference.\n","mysql> SET @ls = 'LineString(1 1,2 2,3 3)';\nmysql> SELECT GLength(GeomFromText(@ls));\n+----------------------------+\n| GLength(GeomFromText(@ls)) |\n+----------------------------+\n| 2.8284271247462 |\n+----------------------------+"),(397,4,"RADIANS"," RADIANS(X)\nReturns the argument X, converted from degrees to radians.\n","mysql> SELECT RADIANS(90);\n -> 1.570796"),(398,25,"COLLATION"," COLLATION(str)\nReturns the collation for the character set of the string argument.\n","mysql> SELECT COLLATION('abc');\n -> 'latin1_swedish_ci'\nmysql> SELECT COLLATION(_utf8'abc');\n -> 'utf8_general_ci'"),(399,26,"COALESCE"," COALESCE(value,...)\nReturns the first non-NULL value in the list.\n","mysql> SELECT COALESCE(NULL,1);\n -> 1\nmysql> SELECT COALESCE(NULL,NULL,NULL);\n -> NULL"),(400,25,"VERSION"," VERSION()\nReturns a string that indicates the MySQL server version.\nAs of MySQL 4.1, the string has the utf8 character set.\n","mysql> SELECT VERSION();\n -> '4.1.3-beta-log'"),(401,23,"MAKE_SET"," MAKE_SET(bits,str1,str2,...)\nReturns a set value (a string containing substrings separated by ','\ncharacters) consisting of the strings that have the corresponding bit in\nbits set. str1 corresponds to bit 0, str2 to bit 1,\nand so on. NULL values in str1, str2, ...\nare not appended to the result.\n","mysql> SELECT MAKE_SET(1,'a','b','c');\n -> 'a'\nmysql> SELECT MAKE_SET(1 | 4,'hello','nice','world');\n -> 'hello,world'\nmysql> SELECT MAKE_SET(1 | 4,'hello','nice',NULL,'world');\n -> 'hello'\nmysql> SELECT MAKE_SET(0,'a','b','c');\n -> ''"),(402,23,"FIND_IN_SET"," FIND_IN_SET(str,strlist)\nReturns a value 1 to N if the string str is in the string list\nstrlist consisting of N substrings. A string list is a string\ncomposed of substrings separated by ',' characters. If the first\nargument is a constant string and the second is a column of type SET,\nthe FIND_IN_SET() function is optimized to use bit arithmetic.\nReturns 0 if str is not in strlist or if strlist\nis the empty string. Returns NULL if either argument is NULL.\nThis function does not work properly if the first argument contains a comma\n(',') character.\n","mysql> SELECT FIND_IN_SET('b','a,b,c,d');\n -> 2"); + +insert into help_keyword (help_keyword_id,name) values (0,"MIN"),(1,"JOIN"),(2,"SERIALIZABLE"),(3,"REPLACE"),(4,"RETURNS"),(5,"MASTER_SSL_CA"),(6,"NCHAR"),(7,"COLUMNS"),(8,"WORK"),(9,"DATETIME"),(10,"MODE"),(11,"OPEN"),(12,"INTEGER"),(13,"ESCAPE"),(14,"VALUE"); +insert into help_keyword (help_keyword_id,name) values (15,"GEOMETRYCOLLECTIONFROMWKB"),(16,"DROP"),(17,"SQL_BIG_RESULT"),(18,"EVENTS"),(19,"MONTH"),(20,"REGEXP"),(21,"DUPLICATE"),(22,"LINESTRINGFROMTEXT."),(23,"UNLOCK"),(24,"INNODB"),(25,"YEAR_MONTH"),(26,"LOCK"),(27,"NDB"),(28,"CHECK"),(29,"FULL"); +insert into help_keyword (help_keyword_id,name) values (30,"INT4"),(31,"BY"),(32,"NO"),(33,"MINUTE"),(34,"DATA"),(35,"DAY"),(36,"RAID_CHUNKSIZE"),(37,"SHARE"),(38,"REAL"),(39,"SEPARATOR"),(40,"DELETE"),(41,"ON"),(42,"CHANGED"),(43,"CLOSE"),(44,"USE"); +insert into help_keyword (help_keyword_id,name) values (45,"WHERE"),(46,"SPATIAL"),(47,"SQL_BUFFER_RESULT"),(48,"IGNORE"),(49,"QUICK"),(50,"SIGNED"),(51,"FALSE"),(52,"POLYGONFROMWKB"),(53,"NDBCLUSTER"),(54,"LEVEL"),(55,"FORCE"),(56,"BINARY"),(57,"TO"),(58,"CHANGE"),(59,"HOUR_MINUTE"); +insert into help_keyword (help_keyword_id,name) values (60,"UPDATE"),(61,"INTO"),(62,"FEDERATED"),(63,"VARYING"),(64,"HOUR_SECOND"),(65,"VARIABLE"),(66,"ROLLBACK"),(67,"MAX"),(68,"RTREE"),(69,"PROCEDURE"),(70,"TIMESTAMP"),(71,"IMPORT"),(72,"AGAINST"),(73,"CHECKSUM"),(74,"INSERT"); +insert into help_keyword (help_keyword_id,name) values (75,"COUNT"),(76,"LONGBINARY"),(77,"THEN"),(78,"ENGINES"),(79,"DAY_SECOND"),(80,"EXISTS"),(81,"BOOLEAN"),(82,"DEFAULT"),(83,"MOD"),(84,"TYPE"),(85,"NO_WRITE_TO_BINLOG"),(86,"RESET"),(87,"BIGINT"),(88,"SET"),(89,"DATE"); +insert into help_keyword (help_keyword_id,name) values (90,"STATUS"),(91,"FULLTEXT"),(92,"COMMENT"),(93,"MASTER_CONNECT_RETRY"),(94,"INNER"),(95,"STOP"),(96,"MASTER_LOG_FILE"),(97,"MRG_MYISAM"),(98,"PRECISION"),(99,"TRAILING"),(100,"LONG"),(101,"ELSE"),(102,"IO_THREAD"),(103,"FROM"),(104,"READ"); +insert into help_keyword (help_keyword_id,name) values (105,"LEFT"),(106,"MINUTE_SECOND"),(107,"COMPACT"),(108,"DEC"),(109,"FOR"),(110,"WARNINGS"),(111,"MIN_ROWS"),(112,"STRING"),(113,"FUNCTION"),(114,"ENCLOSED"),(115,"AGGREGATE"),(116,"FIELDS"),(117,"INT3"),(118,"ARCHIVE"),(119,"AVG_ROW_LENGTH"); +insert into help_keyword (help_keyword_id,name) values (120,"ADD"),(121,"FLOAT4"),(122,"STRIPED"),(123,"VIEW"),(124,"REPEATABLE"),(125,"INFILE"),(126,"ORDER"),(127,"USING"),(128,"MIDDLEINT"),(129,"UNSIGNED"),(130,"GEOMETRYFROMTEXT"),(131,"INDEXES"),(132,"FOREIGN"),(133,"CACHE"),(134,"HOSTS"); +insert into help_keyword (help_keyword_id,name) values (135,"COMMIT"),(136,"SCHEMAS"),(137,"LEADING"),(138,"LOAD"),(139,"SQL_CACHE"),(140,"CONVERT"),(141,"DYNAMIC"),(142,"POLYGONFROMTEXT"),(143,"BYTE"),(144,"LINESTRINGFROMWKB"),(145,"GLOBAL"),(146,"BERKELEYDB"),(147,"WHEN"),(148,"HAVING"),(149,"AS"); +insert into help_keyword (help_keyword_id,name) values (150,"STARTING"),(151,"AUTOCOMMIT"),(152,"GRANTS"),(153,"OUTER"),(154,"FLOOR"),(155,"AFTER"),(156,"STD"),(157,"DISABLE"),(158,"CSV"),(159,"OUTFILE"),(160,"LOW_PRIORITY"),(161,"BDB"),(162,"SCHEMA"),(163,"SONAME"),(164,"POW"); +insert into help_keyword (help_keyword_id,name) values (165,"MULTIPOINTFROMWKB"),(166,"INDEX"),(167,"MULTIPOINTFROMTEXT"),(168,"BACKUP"),(169,"MULTILINESTRINGFROMWKB"),(170,"EXTENDED"),(171,"CROSS"),(172,"NATIONAL"),(173,"GROUP"),(174,"ZEROFILL"),(175,"MASTER_PASSWORD"),(176,"RELAY_LOG_FILE"),(177,"TRUE"),(178,"CHARACTER"),(179,"MASTER_USER"); +insert into help_keyword (help_keyword_id,name) values (180,"ENGINE"),(181,"TABLE"),(182,"INSERT_METHOD"),(183,"CASCADE"),(184,"RELAY_LOG_POS"),(185,"SQL_CALC_FOUND_ROWS"),(186,"MYISAM"),(187,"MODIFY"),(188,"MATCH"),(189,"MASTER_LOG_POS"),(190,"DESC"),(191,"DISTINCTROW"),(192,"TIME"),(193,"NUMERIC"),(194,"GEOMETRYCOLLECTIONFROMTEXT"); +insert into help_keyword (help_keyword_id,name) values (195,"RAID_CHUNKS"),(196,"FLUSH"),(197,"CREATE"),(198,"ISAM"),(199,"INT2"),(200,"PROCESSLIST"),(201,"LOGS"),(202,"HEAP"),(203,"SOUNDS"),(204,"BETWEEN"),(205,"MULTILINESTRINGFROMTEXT"),(206,"PACK_KEYS"),(207,"VALUES"),(208,"FAST"),(209,"VARCHARACTER"); +insert into help_keyword (help_keyword_id,name) values (210,"SHOW"),(211,"ALL"),(212,"REDUNDANT"),(213,"USER_RESOURCES"),(214,"PARTIAL"),(215,"BINLOG"),(216,"END"),(217,"SECOND"),(218,"AND"),(219,"FLOAT8"),(220,"PREV"),(221,"HOUR"),(222,"SELECT"),(223,"DATABASES"),(224,"OR"); +insert into help_keyword (help_keyword_id,name) values (225,"MASTER_SSL_CIPHER"),(226,"SQL_SLAVE_SKIP_COUNTER"),(227,"BOTH"),(228,"BOOL"),(229,"YEAR"),(230,"MASTER_PORT"),(231,"CONCURRENT"),(232,"UNIQUE"),(233,"MASTER_SSL"),(234,"DATE_ADD"),(235,"LIKE"),(236,"IN"),(237,"COLUMN"),(238,"DUMPFILE"),(239,"MEMORY"); +insert into help_keyword (help_keyword_id,name) values (240,"CEIL"),(241,"QUERY"),(242,"MASTER_HOST"),(243,"LINES"),(244,"SQL_THREAD"),(245,"MULTIPOLYGONFROMWKB"),(246,"MASTER_SSL_CERT"),(247,"DAY_MINUTE"),(248,"TRANSACTION"),(249,"DATE_SUB"),(250,"GEOMETRYFROMWKB"),(251,"INT1"),(252,"RENAME"),(253,"RIGHT"),(254,"ALTER"); +insert into help_keyword (help_keyword_id,name) values (255,"MAX_ROWS"),(256,"STRAIGHT_JOIN"),(257,"NATURAL"),(258,"VARIABLES"),(259,"ESCAPED"),(260,"SHA1"),(261,"RAID_TYPE"),(262,"CHAR"),(263,"OFFSET"),(264,"NEXT"),(265,"SQL_LOG_BIN"),(266,"ERRORS"),(267,"TEMPORARY"),(268,"SQL_SMALL_RESULT"),(269,"COMMITTED"); +insert into help_keyword (help_keyword_id,name) values (270,"DELAY_KEY_WRITE"),(271,"BEGIN"),(272,"MEDIUM"),(273,"INTERVAL"),(274,"DAY_HOUR"),(275,"REFERENCES"),(276,"AES_ENCRYPT"),(277,"ISOLATION"),(278,"INT8"),(279,"RESTRICT"),(280,"IS"),(281,"UNCOMMITTED"),(282,"NOT"),(283,"DES_KEY_FILE"),(284,"COMPRESSED"); +insert into help_keyword (help_keyword_id,name) values (285,"START"),(286,"IF"),(287,"SAVEPOINT"),(288,"PRIMARY"),(289,"LAST"),(290,"INNOBASE"),(291,"LIMIT"),(292,"KEYS"),(293,"KEY"),(294,"MERGE"),(295,"SQL_NO_CACHE"),(296,"DELAYED"),(297,"CONSTRAINT"),(298,"SERIAL"),(299,"ACTION"); +insert into help_keyword (help_keyword_id,name) values (300,"WRITE"),(301,"SESSION"),(302,"DATABASE"),(303,"NULL"),(304,"USE_FRM"),(305,"SLAVE"),(306,"TERMINATED"),(307,"ASC"),(308,"OPTIONALLY"),(309,"ENABLE"),(310,"DIRECTORY"),(311,"LOCAL"),(312,"DISTINCT"),(313,"MASTER_SSL_KEY"),(314,"TABLES"); +insert into help_keyword (help_keyword_id,name) values (315,"<>"),(316,"HIGH_PRIORITY"),(317,"BTREE"),(318,"FIRST"),(319,"TYPES"),(320,"MASTER"),(321,"FIXED"),(322,"RAID0"),(323,"MULTIPOLYGONFROMTEXT"),(324,"ROW_FORMAT"); + +insert into help_relation (help_topic_id,help_keyword_id) values (377,0),(280,1),(349,2),(329,3),(126,4),(147,5),(335,6),(271,7),(108,8),(298,9),(61,10),(280,10),(271,11),(77,11),(394,12); +insert into help_relation (help_topic_id,help_keyword_id) values (126,12),(301,13),(189,14),(79,15),(19,16),(60,16),(126,16),(148,16),(218,16),(366,16),(280,17),(185,18),(20,19),(395,20),(116,21); +insert into help_relation (help_topic_id,help_keyword_id) values (39,22),(23,23),(271,24),(369,24),(20,25),(23,26),(280,26),(369,27),(369,28),(271,29),(369,29),(394,30),(34,31),(369,31),(280,31); +insert into help_relation (help_topic_id,help_keyword_id) values (59,31),(329,31),(366,31),(286,31),(373,32),(369,32),(20,33),(86,34),(369,34),(329,34),(20,35),(369,36),(280,37),(246,38),(126,38); +insert into help_relation (help_topic_id,help_keyword_id) values (286,39),(373,40),(369,40),(373,41),(0,41),(24,42),(77,43),(0,44),(34,45),(59,45),(77,45),(165,46),(366,46),(280,47),(0,48); +insert into help_relation (help_topic_id,help_keyword_id) values (116,48),(280,48),(59,48),(329,48),(366,48),(264,49),(34,49),(24,49),(298,50),(304,51),(63,52),(369,53),(349,54),(0,55),(235,56); +insert into help_relation (help_topic_id,help_keyword_id) values (203,56),(335,56),(298,56),(361,57),(147,57),(147,58),(366,58),(20,59),(373,60),(116,60),(280,60),(116,61),(280,61),(30,61),(369,62); +insert into help_relation (help_topic_id,help_keyword_id) values (203,63),(20,64),(95,65),(108,66),(361,66),(377,67),(165,68),(280,69),(149,70),(69,70),(329,71),(61,72),(369,73),(116,74),(385,74); +insert into help_relation (help_topic_id,help_keyword_id) values (338,75),(225,76),(103,77),(271,78),(20,79),(118,80),(19,80),(148,80),(218,80),(61,81),(15,81),(116,82),(369,82),(189,82),(366,82); +insert into help_relation (help_topic_id,help_keyword_id) values (136,83),(369,84),(366,84),(372,85),(258,85),(264,85),(25,86),(208,86),(113,86),(173,87),(108,88),(373,88),(144,88),(389,88),(166,88); +insert into help_relation (help_topic_id,help_keyword_id) values (59,88),(30,88),(366,88),(207,89),(96,89),(298,89),(20,89),(271,90),(40,90),(290,90),(175,90),(369,91),(165,91),(366,91),(369,92); +insert into help_relation (help_topic_id,help_keyword_id) values (147,93),(0,94),(37,95),(147,96),(369,97),(246,98),(357,99),(225,100),(103,101),(37,102),(257,102),(271,103),(86,103),(357,103),(34,103); +insert into help_relation (help_topic_id,help_keyword_id) values (280,103),(185,103),(285,103),(349,104),(23,104),(77,104),(0,105),(20,106),(369,107),(163,108),(271,109),(280,109),(271,110),(369,111),(126,112); +insert into help_relation (help_topic_id,help_keyword_id) values (126,113),(329,114),(126,115),(271,116),(329,116),(198,117),(369,118),(369,119),(366,119),(42,120),(366,120),(130,121),(369,122),(19,123),(121,123); +insert into help_relation (help_topic_id,help_keyword_id) values (349,124),(329,125),(34,126),(280,126),(59,126),(366,126),(286,126),(0,127),(34,127),(198,128),(246,129),(394,129),(163,129),(15,129),(298,129); +insert into help_relation (help_topic_id,help_keyword_id) values (130,129),(93,129),(324,130),(271,131),(373,132),(369,132),(366,132),(113,133),(107,134),(271,134),(108,135),(271,136),(357,137),(86,138),(329,138); +insert into help_relation (help_topic_id,help_keyword_id) values (285,138),(280,139),(298,140),(369,141),(313,142),(367,143),(353,144),(95,145),(349,145),(144,145),(369,146),(103,147),(280,148),(0,149),(23,149); +insert into help_relation (help_topic_id,help_keyword_id) values (280,149),(329,150),(108,151),(271,152),(0,153),(173,154),(366,155),(321,156),(366,157),(369,158),(329,158),(280,159),(116,160),(23,160),(34,160); +insert into help_relation (help_topic_id,help_keyword_id) values (59,160),(30,160),(329,160),(369,161),(271,162),(118,162),(148,162),(166,162),(126,163),(382,164),(365,165),(271,166),(0,166),(60,166),(42,166); +insert into help_relation (help_topic_id,help_keyword_id) values (369,166),(165,166),(366,166),(332,167),(282,168),(214,169),(264,170),(24,170),(0,171),(203,172),(335,172),(280,173),(246,174),(394,174),(163,174); +insert into help_relation (help_topic_id,help_keyword_id) values (15,174),(130,174),(93,174),(147,175),(147,176),(304,177),(203,178),(335,178),(166,178),(147,179),(271,180),(290,180),(369,180),(366,180),(271,181); +insert into help_relation (help_topic_id,help_keyword_id) values (117,181),(24,181),(218,181),(372,181),(264,181),(42,181),(282,181),(285,181),(369,182),(373,183),(19,183),(369,183),(218,183),(147,184),(280,185); +insert into help_relation (help_topic_id,help_keyword_id) values (369,186),(366,187),(61,188),(147,189),(259,190),(280,190),(286,190),(280,191),(247,192),(297,192),(298,192),(163,193),(193,194),(369,195),(113,196); +insert into help_relation (help_topic_id,help_keyword_id) values (271,197),(118,197),(126,197),(42,197),(369,197),(165,197),(369,198),(181,199),(271,200),(235,201),(271,201),(290,201),(369,202),(299,203),(109,204); +insert into help_relation (help_topic_id,help_keyword_id) values (78,205),(369,206),(30,207),(24,208),(203,209),(107,210),(235,210),(40,210),(290,210),(175,210),(185,210),(240,211),(280,211),(369,212),(258,213); +insert into help_relation (help_topic_id,help_keyword_id) values (369,214),(185,215),(103,216),(20,217),(109,218),(248,218),(246,219),(77,220),(20,221),(30,222),(202,222),(271,223),(102,224),(147,225),(144,226); +insert into help_relation (help_topic_id,help_keyword_id) values (357,227),(81,228),(15,228),(20,229),(147,230),(329,231),(366,232),(147,233),(20,234),(271,235),(299,235),(61,236),(280,236),(185,236),(366,237); +insert into help_relation (help_topic_id,help_keyword_id) values (280,238),(280,239),(350,240),(113,241),(147,242),(329,243),(37,244),(257,244),(90,245),(147,246),(20,247),(108,248),(349,248),(20,249),(106,250); +insert into help_relation (help_topic_id,help_keyword_id) values (15,251),(366,252),(0,253),(42,254),(121,254),(366,254),(369,255),(0,256),(280,256),(0,257),(271,258),(329,259),(224,260),(369,261),(367,262); +insert into help_relation (help_topic_id,help_keyword_id) values (298,262),(280,263),(77,264),(389,265),(271,266),(218,267),(280,268),(349,269),(369,270),(108,271),(24,272),(20,273),(20,274),(373,275),(369,275); +insert into help_relation (help_topic_id,help_keyword_id) values (391,276),(349,277),(93,278),(373,279),(19,279),(218,279),(292,280),(349,281),(118,282),(244,282),(258,283),(369,284),(108,285),(257,285),(118,286); +insert into help_relation (help_topic_id,help_keyword_id) values (19,286),(148,286),(218,286),(361,287),(366,288),(77,289),(369,290),(34,291),(280,291),(185,291),(59,291),(77,291),(271,292),(366,292),(373,293); +insert into help_relation (help_topic_id,help_keyword_id) values (116,293),(42,293),(369,293),(366,293),(369,294),(280,295),(116,296),(30,296),(385,296),(369,297),(366,297),(369,298),(189,298),(373,299),(369,299); +insert into help_relation (help_topic_id,help_keyword_id) values (23,300),(95,301),(349,301),(271,302),(118,302),(148,302),(373,303),(292,303),(264,304),(25,305),(107,305),(175,305),(37,305),(257,305),(329,306); +insert into help_relation (help_topic_id,help_keyword_id) values (280,307),(286,307),(329,308),(366,309),(369,310),(372,311),(258,311),(264,311),(23,311),(329,311),(338,312),(377,312),(305,312),(280,312),(227,312); +insert into help_relation (help_topic_id,help_keyword_id) values (286,312),(147,313),(271,314),(23,314),(390,315),(116,316),(280,316),(165,317),(369,318),(366,318),(77,318),(271,319),(235,320),(86,320),(40,320); +insert into help_relation (help_topic_id,help_keyword_id) values (147,320),(208,320),(285,320),(163,321),(369,321),(369,322),(156,323),(369,324); + diff --git a/index.txt b/index.txt new file mode 100644 index 0000000..4f43c44 --- /dev/null +++ b/index.txt @@ -0,0 +1,65 @@ +@patch 010_all_slot-my-print-default-r1.patch +@ver 4.01.15.30 to 4.01.99.99 +@@ Move config directory to the gentoo default + +@patch 010_all_slot-my-print-default-r2.patch +@ver 5.00.15.30 to 5.00.99.99 +@@ Move config directory to the gentoo default + +@patch 020_all_gentoo-nptl.patch +@ver 4.00.18.00 to 4.01.11.99 +@ver 5.00.00.00 to 5.00.03.99 +@@ Add support for NPTL + +@patch 030_all_thrssl-r0.patch +@ver 4.00.00.00 to 4.00.99.99 +@@ Link libmysqlclient_r against ssl +# attempt to get libmysqlclient_r linked against ssl if USE="ssl" enabled +# i would really prefer to fix this at the Makefile.am level, but can't +# get the software to autoreconf as distributed - too many missing files + +@patch 030_all_thrssl-r1.patch +@ver 4.01.11.00 to 5.00.04.00 +@@ Link libmysqlclient_r against ssl + +@patch 035_x86_asm-pic-fixes-r7.patch +@ver 4.01.12.00 to 4.01.99.99 +@ver 5.00.12.00 to 5.00.99.99 +@@ remove page relocations +@@ Most part of the original patch has already been accepted by MysQL, +@@ here is the remaining. +@@ _many_ tanks to pageexec@freemail.hu + +@patch 040_all_tcpd-vars-fix.patch +@ver 4.00.14.00 to 4.01.99.99 + +@patch 080_all_slot_script-r0.patch +@ver 4.00.26.30 to 4.00.99.99 +@@ add slot MySQL support to scripts utilities + +@patch 080_all_slot_script-r1.patch +@@ add slot MySQL support to scripts utilities + +@patch 080_all_slot_script-r2.patch +@ver 5.00.15.30 to 5.00.15.99 +@@ add slot MySQL support to scripts utilities + +@patch 080_all_slot_script-r3.patch +@ver 5.00.16.00 to 5.00.99.99 +@@ add slot MySQL support to scripts utilities + +@patch 090_all_install-db-sh.patch +@ver 4.00.00.00 to 4.00.99.99 +@@ Change an output message + +@patch 110_all_nisam.h.patch +@ver 4.00.00.00 to 4.00.99.99 +@@ enlarge isam (not myisam) key capacity to 500 bytes +@@ needed from some external app. + +@patch 703_all_test-rpl_rotate_logs.patch +@ver 5.00.06.00 to 5.01.99.99 +@@ fix for the test suite +# MySQL Bugs: #9763: Test rpl_rotate_logs fails in default mode and with --force +# Error: 1201 SQLSTATE: HY000 (ER_MASTER_INFO) +# Message: Could not initialize master info structure; more error messages can be found in the MySQL diff --git a/mysql-3.23-my-print-defaults.diff b/mysql-3.23-my-print-defaults.diff deleted file mode 100644 index dbdf14d..0000000 --- a/mysql-3.23-my-print-defaults.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- orig/mysys/default.c Sun May 13 16:40:06 2001 -+++ mysql-patched/mysys/default.c Sun May 13 16:40:17 2001 -@@ -48,7 +48,7 @@ - #ifdef __WIN__ - "C:/", - #else --"/etc/", -+"/etc/mysql/", - #endif - #ifdef DATADIR - DATADIR, diff --git a/mysql-3.23-nisam.h.diff b/mysql-3.23-nisam.h.diff deleted file mode 100644 index 8b44504..0000000 --- a/mysql-3.23-nisam.h.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- include/nisam.h~ Tue Mar 27 10:11:02 2001 -+++ include/nisam.h Fri Apr 13 16:26:02 2001 -@@ -31,7 +31,7 @@ - - #define N_MAXKEY 16 /* Max allowed keys */ - #define N_MAXKEY_SEG 16 /* Max segments for key */ --#define N_MAX_KEY_LENGTH 256 /* May be increased up to 500 */ -+#define N_MAX_KEY_LENGTH 500 /* May be increased up to 500 */ - #define N_MAX_KEY_BUFF (N_MAX_KEY_LENGTH+N_MAXKEY_SEG+sizeof(double)-1) - #define N_MAX_POSSIBLE_KEY_BUFF 500+9 - diff --git a/mysql-3.23-safe-mysqld-sh.diff b/mysql-3.23-safe-mysqld-sh.diff deleted file mode 100644 index d47ef58..0000000 --- a/mysql-3.23-safe-mysqld-sh.diff +++ /dev/null @@ -1,50 +0,0 @@ -diff -ur mysql-3.23.47.orig/scripts/safe_mysqld.sh mysql-3.23.47/scripts/safe_mysqld.sh ---- mysql-3.23.47.orig/scripts/safe_mysqld.sh Thu Dec 27 07:23:28 2001 -+++ mysql-3.23.47/scripts/safe_mysqld.sh Fri Jan 4 05:08:08 2002 -@@ -68,42 +68,14 @@ - done - } - --MY_PWD=`pwd` --# Check if we are starting this relative (for the binary release) --if test -d $MY_PWD/data/mysql -a -f ./share/mysql/english/errmsg.sys -a \ -- -x ./bin/mysqld --then -- MY_BASEDIR_VERSION=$MY_PWD # Where bin, share and data are -- ledir=$MY_BASEDIR_VERSION/bin # Where mysqld is -- DATADIR=$MY_BASEDIR_VERSION/data -- if test -z "$defaults" -- then -- defaults="--defaults-extra-file=$MY_BASEDIR_VERSION/data/my.cnf" -- fi --# Check if this is a 'moved install directory' --elif test -f ./var/mysql/db.frm -a -f ./share/mysql/english/errmsg.sys -a \ -- -x ./libexec/mysqld --then -- MY_BASEDIR_VERSION=$MY_PWD # Where libexec, share and var are -- ledir=$MY_BASEDIR_VERSION/libexec # Where mysqld is -- DATADIR=$MY_BASEDIR_VERSION/var --else -- MY_BASEDIR_VERSION=@prefix@ -- DATADIR=@localstatedir@ -- ledir=@libexecdir@ --fi -+MY_BASEDIR_VERSION=@prefix@ -+DATADIR=@localstatedir@ -+ledir=@libexecdir@ - - MYSQL_UNIX_PORT=${MYSQL_UNIX_PORT:-@MYSQL_UNIX_ADDR@} - MYSQL_TCP_PORT=${MYSQL_TCP_PORT:-@MYSQL_TCP_PORT@} - user=@MYSQLD_USER@ -- --# Use the mysqld-max binary by default if the user doesn't specify a binary --if test -x $ledir/mysqld-max --then -- MYSQLD=mysqld-max --else -- MYSQLD=mysqld --fi -+MYSQLD=mysqld - - # these rely on $DATADIR by default, so we'll set them later on - pid_file= diff --git a/mysql-3.23.52-install-db-sh.diff b/mysql-3.23.52-install-db-sh.diff deleted file mode 100644 index 6cbbaf1..0000000 --- a/mysql-3.23.52-install-db-sh.diff +++ /dev/null @@ -1,35 +0,0 @@ -diff -uNr mysql-3.23.52.orig/scripts/mysql_install_db.sh mysql-3.23.52/scripts/mysql_install_db.sh ---- mysql-3.23.52.orig/scripts/mysql_install_db.sh Tue Aug 13 22:08:16 2002 -+++ mysql-3.23.52/scripts/mysql_install_db.sh Sun Aug 25 04:11:09 2002 -@@ -309,14 +309,10 @@ - END_OF_DATA - then - echo "" -- if test "$IN_RPM" -eq 0 -- then -- echo "To start mysqld at boot time you have to copy support-files/mysql.server" -- echo "to the right place for your system" -- echo - fi - echo "PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !" - echo "This is done with:" -+ echo "/etc/init.d/mysql start (you have to start the server first!)" - echo "$bindir/mysqladmin -u root password 'new-password'" - echo "$bindir/mysqladmin -u root -h $hostname password 'new-password'" - echo "See the manual for more instructions." -@@ -330,15 +326,6 @@ - echo "able to use the new GRANT command!" - fi - echo -- if test "$IN_RPM" -eq 0 -- then -- echo "You can start the MySQL daemon with:" -- echo "cd @prefix@ ; $bindir/safe_mysqld &" -- echo -- echo "You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:" -- echo "cd sql-bench ; run-all-tests" -- echo -- fi - echo "Please report any problems with the @scriptdir@/mysqlbug script!" - echo - echo "The latest information about MySQL is available on the web at" diff --git a/mysql-4.0-my-print-defaults.diff b/mysql-4.0-my-print-defaults.diff deleted file mode 100644 index b086563..0000000 --- a/mysql-4.0-my-print-defaults.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- mysql-4.0.1-alpha.orig/mysys/default.c Sun Dec 23 01:22:08 2001 -+++ mysql-4.0.1-alpha/mysys/default.c Sat Jun 22 18:56:03 2002 -@@ -47,7 +47,7 @@ - #ifdef __WIN__ - "C:/", - #else --"/etc/", -+"/etc/mysql/", - #endif - #ifdef DATADIR - DATADIR, diff --git a/mysql-4.0-mysqlhotcopy-security.patch b/mysql-4.0-mysqlhotcopy-security.patch deleted file mode 100644 index f2f2e74..0000000 --- a/mysql-4.0-mysqlhotcopy-security.patch +++ /dev/null @@ -1,48 +0,0 @@ ---- 1.42/scripts/mysqlhotcopy.sh Tue May 25 21:00:12 2004 -+++ 1.43/scripts/mysqlhotcopy.sh Fri Jul 9 14:30:48 2004 -@@ -8,5 +8,7 @@ - use DBI; - use Sys::Hostname; -+use File::Copy; -+use File::Temp; - - =head1 NAME - -@@ -626,7 +628,6 @@ - sub copy_index - { - my ($method, $files, $source, $target) = @_; -- my $tmpfile="$opt_tmpdir/mysqlhotcopy$$"; - - print "Copying indices for ".@$files." files...\n" unless $opt{quiet}; - foreach my $file (@$files) -@@ -652,21 +653,21 @@ - } - close OUTPUT || die "Error on close of $to: $!\n"; - } -- elsif ($opt{method} eq 'scp') -+ elsif ($opt{method} =~ /^scp\b/) - { -- my $tmp=$tmpfile; -- open(OUTPUT,">$tmp") || die "Can\'t create file $tmp: $!\n"; -- if (syswrite(OUTPUT,$buff) != length($buff)) -+ my ($fh, $tmp)=tempfile('mysqlhotcopy-XXXXXX', DIR => $opt_tmpdir); -+ die "Can\'t create/open file in $opt_tmpdir\n"; -+ if (syswrite($fh,$buff) != length($buff)) - { - die "Error when writing data to $tmp: $!\n"; - } -- close OUTPUT || die "Error on close of $tmp: $!\n"; -- safe_system("scp $tmp $to"); -+ close $fh || die "Error on close of $tmp: $!\n"; -+ safe_system("$opt{method} $tmp $to"); -+ unlink $tmp; - } - else - { - die "Can't use unsupported method '$opt{method}'\n"; - } - } -- unlink "$tmpfile" if ($opt{method} eq 'scp'); - } - diff --git a/mysql-4.0.14-r1-tcpd-vars-fix.diff b/mysql-4.0.14-r1-tcpd-vars-fix.diff deleted file mode 100644 index 18fd9c8..0000000 --- a/mysql-4.0.14-r1-tcpd-vars-fix.diff +++ /dev/null @@ -1,14 +0,0 @@ -diff -Naur orig/sql/mysqld.cc new/sql/mysqld.cc ---- orig/sql/mysqld.cc 2003-06-10 22:22:10.000000000 +0200 -+++ new/sql/mysqld.cc 2003-06-10 22:21:38.000000000 +0200 -@@ -101,8 +101,8 @@ - #ifdef NEED_SYS_SYSLOG_H - #include <sys/syslog.h> - #endif /* NEED_SYS_SYSLOG_H */ --int allow_severity = LOG_INFO; --int deny_severity = LOG_WARNING; -+//int allow_severity = LOG_INFO; -+//int deny_severity = LOG_WARNING; - - #ifdef __STDC__ - #define my_fromhost(A) fromhost(A) diff --git a/mysql-4.0.15.rc6 b/mysql-4.0.15.rc6 deleted file mode 100644 index be157f2..0000000 --- a/mysql-4.0.15.rc6 +++ /dev/null @@ -1,43 +0,0 @@ -#!/sbin/runscript -# Copyright 1999-2004 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/dev-db/mysql/files/mysql-4.0.15.rc6,v 1.5 2004/09/07 04:03:24 robbat2 Exp $ - -depend() { - use dns net -} - -checkconfig() { - if [ ! -f /etc/mysql/my.cnf ]; then - eerror "No /etc/mysql/my.cnf file exists!" - fi - - #dir=`my_print_defaults mysqld | grep -- '^--datadir' | tail -n1 | sed -e 's|^--datadir=||'` - dir=`my_print_defaults mysqld | sed -ne '/datadir/s|^--datadir=||p' | tail -n1` - - if [ -z "$dir" ]; then - eerror "Your mysql doesn't have any datadir setting, default or specific" - eerror "Please check your my.cnf" - return 1 - fi - - if [ ! -d "$dir/mysql" ]; then - eerror "You don't appear to have the mysql database installed yet." - eerror "Please run /usr/bin/mysql_install_db to have this done..." - return 1 - fi -} - -start() { - checkconfig || return 1 - ebegin "Starting mysqld" - start-stop-daemon --start --quiet --exec /usr/bin/mysqld_safe \ - --background -- >/dev/null 2>&1 - eend $? -} - -stop () { - ebegin "Stopping mysqld" - start-stop-daemon --stop --retry 5 --quiet --pidfile=/var/run/mysqld/mysqld.pid - eend $? -} diff --git a/mysql-4.0.18-gentoo-nptl.diff b/mysql-4.0.18-gentoo-nptl.diff deleted file mode 100644 index d5815b7..0000000 --- a/mysql-4.0.18-gentoo-nptl.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- mysql-4.0.18/configure.in.orig 2004-03-04 13:53:36.000000000 -0800 -+++ mysql-4.0.18/configure.in 2004-03-04 13:53:37.000000000 -0800 -@@ -1191,7 +1191,10 @@ - then - # Look for LinuxThreads. - AC_MSG_CHECKING("LinuxThreads") -- res=`grep Linuxthreads /usr/include/pthread.h 2>/dev/null | wc -l` -+ # res=`grep Linuxthreads /usr/include/pthread.h 2>/dev/null | wc -l` -+ # All gentoo systems support this stuff, and this is an improper detection -+ # for LinuxThreads anyhow, always set the result to 1 -+ res=1 - if test "$res" -gt 0 - then - AC_MSG_RESULT("Found") diff --git a/mysql-4.0.18-mysqld-safe-sh.diff b/mysql-4.0.18-mysqld-safe-sh.diff deleted file mode 100644 index 18d4f1c..0000000 --- a/mysql-4.0.18-mysqld-safe-sh.diff +++ /dev/null @@ -1,45 +0,0 @@ ---- mysql-4.0.18/scripts/mysqld_safe.sh.orig 2004-02-10 10:15:48.000000000 -0800 -+++ mysql-4.0.18/scripts/mysqld_safe.sh 2004-03-04 13:45:27.000000000 -0800 -@@ -89,42 +89,14 @@ - done - } - -- --MY_PWD=`pwd` --# Check if we are starting this relative (for the binary release) --if test -d $MY_PWD/data/mysql -a -f ./share/mysql/english/errmsg.sys -a \ -- -x ./bin/mysqld --then -- MY_BASEDIR_VERSION=$MY_PWD # Where bin, share and data are -- ledir=$MY_BASEDIR_VERSION/bin # Where mysqld is -- DATADIR=$MY_BASEDIR_VERSION/data -- if test -z "$defaults" -- then -- defaults="--defaults-extra-file=$MY_BASEDIR_VERSION/data/my.cnf" -- fi --# Check if this is a 'moved install directory' --elif test -f ./var/mysql/db.frm -a -f ./share/mysql/english/errmsg.sys -a \ -- -x ./libexec/mysqld --then -- MY_BASEDIR_VERSION=$MY_PWD # Where libexec, share and var are -- ledir=$MY_BASEDIR_VERSION/libexec # Where mysqld is -- DATADIR=$MY_BASEDIR_VERSION/var --else - MY_BASEDIR_VERSION=@prefix@ - DATADIR=@localstatedir@ - ledir=@libexecdir@ --fi - - user=@MYSQLD_USER@ - niceness=0 - --# Use the mysqld-max binary by default if the user doesn't specify a binary --if test -x $ledir/mysqld-max --then -- MYSQLD=mysqld-max --else - MYSQLD=mysqld --fi - - # these rely on $DATADIR by default, so we'll set them later on - pid_file= diff --git a/mysql-4.0.21-install-db-sh.diff b/mysql-4.0.21-install-db-sh.diff deleted file mode 100644 index 8940e99..0000000 --- a/mysql-4.0.21-install-db-sh.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- mysql-4.0.21/scripts/mysql_install_db.sh.orig -+++ mysql-4.0.21/scripts/mysql_install_db.sh -@@ -371,6 +371,7 @@ - echo "To do so, start the server, then issue the following commands:" -- echo "$bindir/mysqladmin -u root password 'new-password'" -+ echo "/etc/init.d/mysql start (you have to start the server first!)" - echo "$bindir/mysqladmin -u root -h $hostname password 'new-password'" -+ echo "$bindir/mysqladmin -u root password 'new-password'" - echo "See the manual for more instructions." - # - # Print message about upgrading unless we have created a new db table. diff --git a/mysql-4.0.21-thrssl.patch b/mysql-4.0.21-thrssl.patch deleted file mode 100644 index e180572..0000000 --- a/mysql-4.0.21-thrssl.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- mysql-4.0.21/libmysql_r/Makefile.in.orig -+++ mysql-4.0.21/libmysql_r/Makefile.in -@@ -135,7 +135,7 @@ - LDFLAGS = @LDFLAGS@ - LIBDL = @LIBDL@ - LIBOBJS = @LIBOBJS@ --LIBS = @LIBS@ @openssl_libs@ -+LIBS = @CLIENT_LIBS@ @openssl_libs@ - LIBTOOL = @LIBTOOL@ - LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@ - LM_CFLAGS = @LM_CFLAGS@ diff --git a/mysql-4.0.24-manual.texi.patch b/mysql-4.0.24-manual.texi.patch deleted file mode 100644 index 2789efb..0000000 --- a/mysql-4.0.24-manual.texi.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- mysql-4.0.24.bbb/Docs/manual.texi 2005-03-11 22:49:27.000000000 +0100 -+++ mysql-4.0.24/Docs/manual.texi 2005-03-11 22:57:56.000000000 +0100 -@@ -91349,7 +91349,7 @@ - - @c NOTE: To regenerate this list, run the make-errmsg-table.pl script. - --@include errmsg-table.texi -+failed to include errmsg-table.texi - - Client error information comes from the following files: - -@@ -91370,7 +91370,7 @@ - - @c NOTE: To regenerate this list, run the make-cl-errmsg-table.pl script. - --@include cl-errmsg-table.texi -+failed to include cl-errmsg-table.texi - - - @node Extending MySQL, Problems, Error-handling, Top diff --git a/mysql-4.0.24-r1.rc6 b/mysql-4.0.24-r1.rc6 deleted file mode 100644 index 4873370..0000000 --- a/mysql-4.0.24-r1.rc6 +++ /dev/null @@ -1,59 +0,0 @@ -#!/sbin/runscript -# Copyright 1999-2004 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/dev-db/mysql/files/mysql-4.0.24-r1.rc6,v 1.2 2005/03/13 20:10:08 robbat2 Exp $ - -depend() { - use dns net -} - - -getconfig() { - MY_CNF=${MY_CNF=/etc/mysql/my.cnf} - if [ ! -f ${MY_CNF} ]; then - eerror "No ${MY_CNF} file exists! Using automatic defaults!" - fi - - #dir=`my_print_defaults mysqld | grep -- '^--datadir' | tail -n1 | sed -e 's|^--datadir=||'` - #dir=`my_print_defaults mysqld | sed -ne '/datadir/s|^--datadir=||p' | tail -n1` - local mysqld_cnf="`my_print_defaults --config-file=${MY_CNF} mysqld`" - datadir=`echo "${mysqld_cnf}" | sed -ne '/datadir/s|^--datadir=||p' | tail -n1` - pidfile=`echo "${mysqld_cnf}" | sed -ne '/pid-file/s|^--pid-file=||p' | tail -n1` - - # push these out to the script - export MY_CNF - export pidfile - export datadir -} - -checkconfig() { - getconfig - if [ -z "${datadir}" ]; then - eerror "Your mysql doesn't have any datadir setting, default or specific" - eerror "Please check your my.cnf : ${MY_CNF}" - return 1 - fi - - if [ ! -d "$datadir/mysql" ]; then - eerror "You don't appear to have the mysql database installed yet." - eerror "Please run /usr/bin/mysql_install_db to have this done..." - return 1 - fi -} - -start() { - getconfig - checkconfig || return 1 - ebegin "Starting mysqld (${MY_CNF})" - start-stop-daemon --start --quiet --background \ - --exec /usr/bin/mysqld_safe \ - -- --defaults-file=${MY_CNF} >/dev/null 2>&1 - eend $? -} - -stop () { - getconfig - ebegin "Stopping mysqld (${MY_CNF})" - start-stop-daemon --stop --retry 5 --quiet --pidfile=${pidfile} - eend $? -} diff --git a/mysql-4.0.24-r2.rc6 b/mysql-4.0.24-r2.rc6 deleted file mode 100644 index ec22177..0000000 --- a/mysql-4.0.24-r2.rc6 +++ /dev/null @@ -1,71 +0,0 @@ -#!/sbin/runscript -# Copyright 1999-2004 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/dev-db/mysql/files/mysql-4.0.24-r2.rc6,v 1.1 2005/05/17 09:08:46 robbat2 Exp $ - -depend() { - use dns net -} - -getconfig() { - MY_CNF=${MY_CNF=/etc/mysql/my.cnf} - if [ ! -f ${MY_CNF} ]; then - eerror "No ${MY_CNF} file exists! Using automatic defaults!" - fi - - #dir=`my_print_defaults mysqld | grep -- '^--datadir' | tail -n1 | sed -e 's|^--datadir=||'` - #dir=`my_print_defaults mysqld | sed -ne '/datadir/s|^--datadir=||p' | tail -n1` - local mysqld_cnf="`my_print_defaults --config-file=${MY_CNF} mysqld`" - datadir=`echo "${mysqld_cnf}" | sed -ne '/datadir/s|^--datadir=||p' | tail -n1` - pidfile=`echo "${mysqld_cnf}" | sed -ne '/pid-file/s|^--pid-file=||p' | tail -n1` - basedir=`echo "${mysqld_cnf}" | sed -ne '/basedir/s|^--basedir=||p' | tail -n1` - socket=`echo "${mysqld_cnf}" | sed -ne '/socket/s|^--socket=||p' | tail -n1` - - # push these out to the script - export MY_CNF - export pidfile - export datadir - export basedir - export socket -} - -checkconfig() { - getconfig - if [ -z "${datadir}" ]; then - eerror "Your mysql doesn't have any datadir setting, default or specific" - eerror "Please check your my.cnf : ${MY_CNF}" - return 1 - fi - - if [ ! -d "$datadir/mysql" ]; then - eerror "You don't appear to have the mysql database installed yet." - eerror "Please run /usr/bin/mysql_install_db to have this done..." - return 1 - fi -} - -start() { - local retstatus=1 - local maxtry=5 - getconfig - checkconfig || return 1 - ebegin "Starting mysqld (${MY_CNF})" - start-stop-daemon --start --quiet --background \ - --exec "${basedir}/bin/mysqld_safe" \ - -- --defaults-file=${MY_CNF} >/dev/null 2>&1 - retstatus=$? - while ! [[ -S "${socket}" || "${maxtry}" -lt "1" || "${retstatus}" -gt "0" ]] ; do - maxtry=$(($maxtry-1)) - echo -n "." - sleep 1 - done - ! [[ -S "${socket}" ]] && eerror "MySQL NOT started, proceding anyway" - eend $retstatus -} - -stop () { - getconfig - ebegin "Stopping mysqld (${MY_CNF})" - start-stop-daemon --stop --retry 5 --quiet --pidfile=${pidfile} - eend $? -} diff --git a/mysql-4.0.25-r2-asm-pic-fixes.patch b/mysql-4.0.25-r2-asm-pic-fixes.patch deleted file mode 100644 index 48e5517..0000000 --- a/mysql-4.0.25-r2-asm-pic-fixes.patch +++ /dev/null @@ -1,304 +0,0 @@ ---- mysql-4.0.25/strings/strings-x86.s 2005-06-29 19:06:44.000000000 +0200 -+++ mysql/strings/strings-x86.s 2005-07-19 15:41:31.000000000 +0200 -@@ -403,3 +403,5 @@ - ret - .strxmov_end: - .size strxmov,.strxmov_end-strxmov -+ -+ .section .note.GNU-stack,"",@progbits ---- mysql-4.0.25/strings/longlong2str-x86.s 2005-06-29 19:06:43.000000000 +0200 -+++ mysql/strings/longlong2str-x86.s 2005-07-19 15:41:31.000000000 +0200 -@@ -13,8 +13,9 @@ - # along with this program; if not, write to the Free Software - # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - --# Optimized longlong2str function for Intel 80x86 (gcc/gas syntax) --# Some set sequences are optimized for pentuimpro II -+# longlong2str function for Intel 80x86 (gcc/gas syntax) -+ -+# See longlong2str(dst,radix,val) description in longlong2str.c. - - .file "longlong2str.s" - .version "1.01" -@@ -24,8 +25,123 @@ - - .globl longlong2str - .type longlong2str,@function -- -+ - longlong2str: -+ subl $80,%esp # Temporary buffer for up to 64 radix-2 digits -+ pushl %ebp -+ pushl %esi -+ pushl %edi -+ pushl %ebx -+ -+ movl 100(%esp),%esi # esi = Lower part of val -+ movl 112(%esp),%ebx # ebx = Radix -+ movl 104(%esp),%ebp # ebp = Higher part of val -+ movl 108(%esp),%edi # edi -> dst -+ -+ testl %ebx,%ebx -+ jge .L144 # (Radix >= 0) -+ -+ testl %ebp,%ebp -+ jge .L146 # (Higher part of val >= 0) -+ movb $45,(%edi) # Add '-' sign -+ incl %edi -+ negl %esi # Change val to positive -+ adcl $0,%ebp -+ negl %ebp -+.L146: -+ negl %ebx # Change radix to positive -+.L144: -+ cmpl $36,%ebx # Radix must be between 2 and 36 -+ ja .Lerror # (Radix not in range) -+ cmpl $2,%ebx -+ jb .Lerror # (Radix not in range) -+ -+ movl %esi,%eax # eax = lower part of val ... -+ orl %ebp,%eax # and it stays thus if ebp=0 -+ je Lzero # (Treat zero as special case) -+ -+ leal 92(%esp),%ecx # ecx -> End of temporary buffer -+ -+ testl %ebp,%ebp -+ je Llow # (Higher part of val = 0) -+ -+Lhigh: -+ #val in ebp:esi. div the high part by the radix, -+ #then div remainder + low part by the radix. -+ movl %ebp,%eax # edx=0,eax=high(from ebp) -+ xorl %edx,%edx -+ decl %ecx -+ divl %ebx -+ movl %eax,%ebp # edx=result of last, eax=low(from esi) -+ movl %esi,%eax -+ divl %ebx -+ movl %eax,%esi # ebp:esi = quotient -+ movb %dl,(%ecx) # store byte in temporary buffer -+ testl %ebp,%ebp -+ jne Lhigh # (Higher part of val still > 0) -+ -+Llow: -+ #val in 0:eax. div 0 + low part by the radix. -+ xorl %edx,%edx -+ decl %ecx -+ divl %ebx -+ movb %dl,(%ecx) # store byte in temporary buffer -+ testl %eax,%eax -+ jne Llow # (Lower part of val still <> 0) -+ -+ leal 92(%esp),%esi # esi -> End of temporary buffer -+ -+Lmov: -+ movb (%ecx),%dl # dl = byte from temporary buffer -+ movb $-1,%bl -+ cmpb $10,%dl # add 7 if dl > '9' -+ adcb $0,%bl -+ addb $48,%dl # add '0' -+ andb $7,%bl -+ addb %bl,%dl -+ incl %ecx -+ movb %dl,(%edi) # put dl in dst -+ incl %edi -+ cmpl %ecx,%esi -+ ja Lmov # (more bytes exist in temporary buffer) -+ movb $0,(%edi) # trailing '\0' in dst -+ movl %edi,%eax # eax = return value = pointer to '\0' -+.Lret: -+ popl %ebx -+ popl %edi -+ popl %esi -+ popl %ebp -+ addl $80,%esp -+ ret -+ -+.Lerror: -+ xorl %eax,%eax # Wrong radix -+ jmp .Lret -+ -+Lzero: -+ # Treat 0 as a special case. Unnecessary but we -+ # expect 0 will be frequent. -+ movl 108(%esp),%eax # eax = dst -+ popl %ebx -+ movb $48,(%eax) # '0' -+ popl %edi -+ incl %eax -+ popl %esi -+ popl %ebp -+ addl $80,%esp -+ movb $0,(%eax) # '\0' -+ ret -+ -+# -+# This is almost equal to the above, except that we can do the final -+# loop much more efficient -+# -+ -+ .align 4 -+ -+.globl longlong10_to_str -+ .type longlong10_to_str,@function -+longlong10_to_str: - subl $80,%esp - pushl %ebp - pushl %esi -@@ -34,85 +150,82 @@ - movl 100(%esp),%esi # Lower part of val - movl 104(%esp),%ebp # Higher part of val - movl 108(%esp),%edi # get dst -- movl 112(%esp),%ebx # Radix -- movl %ebx,%eax -- testl %eax,%eax -- jge .L144 -- -- addl $36,%eax -- cmpl $34,%eax -- ja .Lerror # Wrong radix -- testl %ebp,%ebp -- jge .L146 -+ movl 112(%esp),%ebx # Radix (10 or -10) -+ testl %ebx,%ebx -+ jge .L10_10 # Positive radix -+ -+ negl %ebx # Change radix to positive (= 10) -+ -+ testl %ebp,%ebp # Test if negative value -+ jge .L10_10 - movb $45,(%edi) # Add sign -- incl %edi # Change sign of val -- negl %esi -+ incl %edi -+ negl %esi # Change sign of val (ebp:esi) - adcl $0,%ebp - negl %ebp --.L146: -- negl %ebx # Change radix to positive -- jmp .L148 - .align 4 --.L144: -- addl $-2,%eax -- cmpl $34,%eax -- ja .Lerror # Radix in range - --.L148: -+.L10_10: -+ leal 92(%esp),%ecx # End of buffer - movl %esi,%eax # Test if zero (for easy loop) - orl %ebp,%eax -- jne .L150 -+ jne .L10_30 # Not zero -+ -+ # Here when value is zero - movb $48,(%edi) - incl %edi -- jmp .L164 -- .align 4 -- --.L150: -- leal 92(%esp),%ecx # End of buffer -- jmp .L155 -+ jmp .L10_end - .align 4 - --.L153: -+.L10_20: - # val is stored in in ebp:esi -- - movl %ebp,%eax # High part of value - xorl %edx,%edx -- divl %ebx -+ divl %ebx # Divide by 10 - movl %eax,%ebp - movl %esi,%eax -- divl %ebx -- movl %eax,%esi # quotent in ebp:esi -- movb _dig_vec(%edx),%al # al is faster than dl -+ divl %ebx # Divide by 10 - decl %ecx -- movb %al,(%ecx) # store value in buff -- .align 4 --.L155: -+ movl %eax,%esi # quotent in ebp:esi -+ addl $48,%edx # Convert to ascii -+ movb %dl,(%ecx) # store value in buff -+ -+.L10_30: - testl %ebp,%ebp -- ja .L153 -+ ja .L10_20 - testl %esi,%esi # rest value -- jl .L153 -- je .L160 # Ready -- movl %esi,%eax -- movl $_dig_vec,%ebp -- .align 4 -+ jl .L10_20 # Unsigned, do ulonglong div once more -+ je .L10_mov # Ready -+ movl %esi,%ebx # Move val to %ebx -+ -+ # The following code uses some tricks to change division by 10 to -+ # multiplication and shifts -+ movl $0xcccccccd,%esi # set %esi to 0xcccccccd -+ -+.L10_40: -+ movl %ebx,%eax -+ mull %esi -+ decl %ecx -+ shrl $3,%edx -+ leal (%edx,%edx,4),%eax -+ addl %eax,%eax -+ subb %al,%bl # %bl now contains val % 10 -+ addb $48,%bl -+ movb %bl,(%ecx) -+ movl %edx,%ebx -+ testl %ebx,%ebx -+ jne .L10_40 -+# jmp .L10_mov # Shared end with longlong10_to_str - --.L154: # Do rest with integer precision -- cltd -- divl %ebx -- decl %ecx -- movb (%edx,%ebp),%dl # bh is always zero as ebx=radix < 36 -- testl %eax,%eax -- movb %dl,(%ecx) -- jne .L154 - --.L160: -+.L10_mov: - movl %ecx,%esi - leal 92(%esp),%ecx # End of buffer - subl %esi,%ecx - rep - movsb - --.L164: -+.L10_end: - movl %edi,%eax # Pointer to end null - movb $0,(%edi) # Store the end null - -@@ -123,18 +236,8 @@ - popl %ebp - addl $80,%esp - ret -- --.Lerror: -- xorl %eax,%eax # Wrong radix -- jmp .L165 -- --.Lfe3: -- .size longlong2str,.Lfe3-longlong2str -- --.globl longlong10_to_str -- .type longlong10_to_str,@function --longlong10_to_str: -- jmp longlong2str -- -+ - .L10end: - .size longlong10_to_str,.L10end-longlong10_to_str -+ -+ .section .note.GNU-stack,"",@progbits diff --git a/mysql-4.1.9-thrssl.patch b/mysql-4.1.9-thrssl.patch deleted file mode 100644 index d50325e..0000000 --- a/mysql-4.1.9-thrssl.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- mysql-4.1.10.orig/libmysql_r/Makefile.in 2005-02-12 21:38:04.000000000 +0100 -+++ mysql-4.1.10/libmysql_r/Makefile.in 2005-02-19 01:41:11.000000000 +0100 -@@ -242,7 +242,7 @@ - LIBDL = @LIBDL@ - LIBEDIT_LOBJECTS = @LIBEDIT_LOBJECTS@ - LIBOBJS = @LIBOBJS@ --LIBS = @LIBS@ @ZLIB_LIBS@ @openssl_libs@ -+LIBS = @CLIENT_LIBS@ @ZLIB_LIBS@ @openssl_libs@ @LIBS@ - LIBTOOL = @LIBTOOL@ - LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@ - LM_CFLAGS = @LM_CFLAGS@ ---- mysql-4.1.10.orig/libmysql_r/Makefile.am 2005-02-12 21:37:33.000000000 +0100 -+++ mysql-4.1.10/libmysql_r/Makefile.am 2005-02-19 01:43:49.000000000 +0100 -@@ -22,7 +22,7 @@ - - target = libmysqlclient_r.la - target_defs = -DDONT_USE_RAID -DMYSQL_CLIENT @LIB_EXTRA_CCFLAGS@ --LIBS = @LIBS@ @ZLIB_LIBS@ @openssl_libs@ -+LIBS = @CLIENT_LIBS@ @ZLIB_LIBS@ @openssl_libs@ @LIBS@ - - INCLUDES = @MT_INCLUDES@ \ - -I$(top_srcdir)/include $(openssl_includes) @ZLIB_INCLUDES@ diff --git a/mysql-accesstmp.patch b/mysql-accesstmp.patch deleted file mode 100644 index 700084e..0000000 --- a/mysql-accesstmp.patch +++ /dev/null @@ -1,90 +0,0 @@ ---- mysql-4.1.8/scripts/mysqlaccess.sh 2004-12-14 13:40:36.000000000 +0100 -+++ mysql-4.1.8.bug77805/scripts/mysqlaccess.sh 2005-01-18 00:48:07.692271624 +0100 -@@ -2,7 +2,7 @@ - # **************************** - package MySQLaccess; - #use strict; --use POSIX qw(tmpnam); -+use File::Temp qw(tempfile tmpnam); - use Fcntl; - - BEGIN { -@@ -32,7 +32,6 @@ - $ACCESS_U_BCK = 'user_backup'; - $ACCESS_D_BCK = 'db_backup'; - $DIFF = '/usr/bin/diff'; -- $TMP_PATH = '/tmp'; #path to writable tmp-directory - $MYSQLDUMP = '@bindir@/mysqldump'; - #path to mysqldump executable - -@@ -431,7 +430,7 @@ - # no caching on STDOUT - $|=1; - -- $MYSQL_CNF = POSIX::tmpnam(); -+ $MYSQL_CNF = tmpnam(); - %MYSQL_CNF = (client => { }, - mysql => { }, - mysqldump => { }, -@@ -576,8 +575,6 @@ - push(@MySQLaccess::Grant::Error,'not_found_mysql') if !(-x $MYSQL); - push(@MySQLaccess::Grant::Error,'not_found_diff') if !(-x $DIFF); - push(@MySQLaccess::Grant::Error,'not_found_mysqldump') if !(-x $MYSQLDUMP); --push(@MySQLaccess::Grant::Error,'not_found_tmp') if !(-d $TMP_PATH); --push(@MySQLaccess::Grant::Error,'write_err_tmp') if !(-w $TMP_PATH); - if (@MySQLaccess::Grant::Error) { - MySQLaccess::Report::Print_Error_Messages() ; - exit 0; -@@ -1776,17 +1773,15 @@ - @before = sort(@before); - @after = sort(@after); - -- $before = "$MySQLaccess::TMP_PATH/$MySQLaccess::script.before.$$"; -- $after = "$MySQLaccess::TMP_PATH/$MySQLaccess::script.after.$$"; -- #$after = "/tmp/t0"; -- open(BEFORE,"> $before") || -- push(@MySQLaccess::Report::Errors,"Can't open temporary file $before for writing"); -- open(AFTER,"> $after") || -- push(@MySQLaccess::Report::Errors,"Can't open temporary file $after for writing"); -- print BEFORE join("\n",@before); -- print AFTER join("\n",@after); -- close(BEFORE); -- close(AFTER); -+ ($hb, $before) = tempfile("$MySQLaccess::script.XXXXXX") or -+ push(@MySQLaccess::Report::Errors,"Can't create temporary file: $!"); -+ ($ha, $after) = tempfile("$MySQLaccess::script.XXXXXX") or -+ push(@MySQLaccess::Report::Errors,"Can't create temporary file: $!"); -+ -+ print $hb join("\n",@before); -+ print $ha join("\n",@after); -+ close $hb; -+ close $ha; - - # ---------------------------------- - # compute difference -@@ -1799,8 +1794,8 @@ - - # ---------------------------------- - # cleanup temp. files -- unlink(BEFORE); -- unlink(AFTER); -+ unlink($before); -+ unlink($after); - - return \@diffs; - } -@@ -2315,14 +2310,6 @@ - => "The diff program <$MySQLaccess::DIFF> could not be found.\n" - ."+ Check your path, or\n" - ."+ edit the source of this script to point \$DIFF to the diff program.\n" -- ,'not_found_tmp' -- => "The temporary directory <$MySQLaccess::TMP_PATH> could not be found.\n" -- ."+ create this directory (writeable!), or\n" -- ."+ edit the source of this script to point \$TMP_PATH to the right directory.\n" -- ,'write_err_tmp' -- => "The temporary directory <$MySQLaccess::TMP_PATH> is not writable.\n" -- ."+ make this directory writeable!, or\n" -- ."+ edit the source of this script to point \$TMP_PATH to another directory.\n" - ,'Unrecognized_option' - => "Sorry,\n" - ."You are using an old version of the mysql-program,\n" diff --git a/mysql-test-myisam-geometry.patch b/mysql-test-myisam-geometry.patch deleted file mode 100644 index 54a4a93..0000000 --- a/mysql-test-myisam-geometry.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- mysql.orig/mysql-test/t/myisam.test 2005-03-27 16:07:37.000000000 +0200 -+++ mysql/mysql-test/t/myisam.test 2005-03-27 16:17:33.000000000 +0200 -@@ -476,7 +476,7 @@ - # - # Test RTREE index - # ----error 1235 -+--error 1289 - CREATE TABLE t1 (`a` int(11) NOT NULL default '0', `b` int(11) NOT NULL default '0', UNIQUE KEY `a` USING RTREE (`a`,`b`)) ENGINE=MyISAM; - # INSERT INTO t1 VALUES (1,1),(1,1); - # DELETE FROM rt WHERE a<1; ---- mysql.orig/mysql-test/r/myisam.result 2005-03-27 16:08:20.000000000 +0200 -+++ mysql/mysql-test/r/myisam.result 2005-03-27 16:12:18.000000000 +0200 -@@ -499,7 +499,7 @@ - 1 SIMPLE t2 index NULL PRIMARY 4 NULL 2 Using index; Distinct - drop table t1,t2; - CREATE TABLE t1 (`a` int(11) NOT NULL default '0', `b` int(11) NOT NULL default '0', UNIQUE KEY `a` USING RTREE (`a`,`b`)) ENGINE=MyISAM; --ERROR 42000: This version of MySQL doesn't yet support 'RTREE INDEX' -+ERROR HY000: The 'RTree keys' feature is disabled; you need MySQL built with 'HAVE_RTREE_KEYS' to have it working - create table t1 (a int, b varchar(200), c text not null) checksum=1; - create table t2 (a int, b varchar(200), c text not null) checksum=0; - insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, ""); |