# At a local mysql-trunk-bugfixing repository of davi
3133 Davi Arnaut 2010-07-19
WL#5498: Remove dead and unused source code
Remove unused source code and associated paraphernalia.
removed:
include/my_trie.h
include/my_vle.h
mysys/make-conf.c
mysys/my_append.c
mysys/my_clock.c
mysys/my_dup.c
mysys/my_net.c
mysys/my_vle.c
sql/sql_map.h
sql/sql_olap.cc
modified:
client/Makefile.am
include/Makefile.am
include/my_net.h
include/my_sys.h
libmysqld/CMakeLists.txt
libmysqld/Makefile.am
mysql-test/suite/perfschema/r/server_init.result
mysql-test/suite/perfschema/t/server_init.test
mysys/CMakeLists.txt
mysys/Makefile.am
mysys/my_init.c
mysys/my_static.c
mysys/my_static.h
sql/CMakeLists.txt
sql/Makefile.am
sql/mysqld.cc
sql/mysqld.h
=== modified file 'client/Makefile.am'
--- a/client/Makefile.am 2010-05-19 13:00:23 +0000
+++ b/client/Makefile.am 2010-07-20 02:30:37 +0000
@@ -62,7 +62,6 @@ mysqlbinlog_SOURCES = mysqlbinlog.cc \
$(top_srcdir)/mysys/my_new.cc \
$(top_srcdir)/mysys/my_bit.c \
$(top_srcdir)/mysys/my_bitmap.c \
- $(top_srcdir)/mysys/my_vle.c \
$(top_srcdir)/mysys/base64.c
mysqlbinlog_LDADD = $(LDADD) $(CXXLDFLAGS)
=== modified file 'include/Makefile.am'
--- a/include/Makefile.am 2010-07-16 20:02:40 +0000
+++ b/include/Makefile.am 2010-07-20 02:30:37 +0000
@@ -38,11 +38,11 @@ noinst_HEADERS = config-win.h lf.h my_bi
myisam.h myisampack.h myisammrg.h ft_global.h\
mysys_err.h my_base.h \
my_nosys.h my_alarm.h queues.h rijndael.h sha1.h sha2.h \
- my_aes.h my_tree.h my_trie.h hash.h thr_alarm.h \
+ my_aes.h my_tree.h hash.h thr_alarm.h \
thr_lock.h t_ctype.h violite.h my_md5.h base64.h \
my_handler.h my_time.h service_versions.h \
my_rdtsc.h mysql/psi/psi_abi_v1.h mysql/psi/psi_abi_v2.h \
- my_vle.h my_user.h my_atomic.h atomic/nolock.h \
+ my_user.h my_atomic.h atomic/nolock.h \
atomic/rwlock.h atomic/x86-gcc.h atomic/generic-msvc.h \
atomic/gcc_builtins.h my_libwrap.h my_stacktrace.h \
atomic/solaris.h mysql/innodb_priv.h my_compiler.h
=== modified file 'include/my_net.h'
--- a/include/my_net.h 2010-07-15 11:13:30 +0000
+++ b/include/my_net.h 2010-07-20 02:30:37 +0000
@@ -14,9 +14,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*
- thread safe version of some common functions:
- my_inet_ntoa
-
This file is also used to make handling of sockets and ioctl()
portable accross systems.
@@ -76,10 +73,6 @@ C_MODE_START
#define in_addr_t uint32
#endif
-/* Thread safe or portable version of some functions */
-
-void my_inet_ntoa(struct in_addr in, char *buf);
-
/*
Handling of gethostbyname_r()
*/
=== modified file 'include/my_sys.h'
--- a/include/my_sys.h 2010-07-17 14:56:00 +0000
+++ b/include/my_sys.h 2010-07-20 02:30:37 +0000
@@ -101,10 +101,6 @@ extern int my_errno; /* Last error in m
#define MY_GIVE_INFO 2 /* Give time info about process*/
#define MY_DONT_FREE_DBUG 4 /* Do not call DBUG_END() in my_end() */
-#define MY_REMOVE_NONE 0 /* Params for modify_defaults_file */
-#define MY_REMOVE_OPTION 1
-#define MY_REMOVE_SECTION 2
-
#define ME_HIGHBYTE 8 /* Shift for colours */
#define ME_NOCUR 1 /* Don't use curses message */
#define ME_OLDWIN 2 /* Use old window */
@@ -266,13 +262,6 @@ extern const char *my_defaults_file;
extern my_bool timed_mutexes;
-typedef struct wild_file_pack /* Struct to hold info when selecting files */
-{
- uint wilds; /* How many wildcards */
- uint not_pos; /* Start of not-theese-files */
- char * *wild; /* Pointer to wildcards */
-} WF_PACK;
-
enum loglevel {
ERROR_LEVEL,
WARNING_LEVEL,
@@ -568,7 +557,6 @@ typedef int (*Process_option_func)(void
/* Prototypes for mysys and my_func functions */
extern int my_copy(const char *from,const char *to,myf MyFlags);
-extern int my_append(const char *from,const char *to,myf MyFlags);
extern int my_delete(const char *name,myf MyFlags);
extern int my_getwd(char * buf,size_t size,myf MyFlags);
extern int my_setwd(const char *dir,myf MyFlags);
@@ -584,7 +572,6 @@ extern File my_register_filename(File fd
extern File my_create(const char *FileName,int CreateFlags,
int AccessFlags, myf MyFlags);
extern int my_close(File Filedes,myf MyFlags);
-extern File my_dup(File file, myf MyFlags);
extern int my_mkdir(const char *dir, int Flags, myf MyFlags);
extern int my_readlink(char *to, const char *filename, myf MyFlags);
extern int my_is_symlink(const char *filename);
@@ -713,9 +700,6 @@ extern char * my_load_path(char * to, co
const char *own_path_prefix);
extern int wild_compare(const char *str,const char *wildstr,
pbool str_is_pattern);
-extern WF_PACK *wf_comp(char * str);
-extern int wf_test(struct wild_file_pack *wf_pack,const char *name);
-extern void wf_end(struct wild_file_pack *buffer);
extern my_bool array_append_string_unique(const char *str,
const char **array, size_t size);
extern void get_date(char * to,int timeflag,time_t use_time);
@@ -729,8 +713,6 @@ extern int end_record_cache(RECORD_CACHE
extern int write_cache_record(RECORD_CACHE *info,my_off_t filepos,
const uchar *record,size_t length);
extern int flush_write_cache(RECORD_CACHE *info);
-extern long my_clock(void);
-extern sig_handler sigtstp_handler(int signal_number);
extern void handle_recived_signals(void);
extern sig_handler my_set_alarm_variable(int signo);
@@ -852,9 +834,6 @@ extern int my_load_defaults(const char *
int *argc, char ***argv, const char ***);
extern int load_defaults(const char *conf_file, const char **groups,
int *argc, char ***argv);
-extern int modify_defaults_file(const char *file_location, const char *option,
- const char *option_value,
- const char *section_name, int remove_option);
extern int my_search_option_files(const char *conf_file, int *argc,
char ***argv, uint *args_used,
Process_option_func func, void *func_ctx,
=== removed file 'include/my_trie.h'
--- a/include/my_trie.h 2007-05-10 09:59:39 +0000
+++ b/include/my_trie.h 1970-01-01 00:00:00 +0000
@@ -1,141 +0,0 @@
-/* Copyright (C) 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; version 2 of the License.
-
- 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 */
-
-#ifndef _trie_h
-#define _trie_h
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct st_trie_node
-{
- uint16 leaf; /* Depth from root node if match, 0 else */
- uchar c; /* Label on this edge */
- struct st_trie_node *next; /* Next label */
- struct st_trie_node *links; /* Array of edges leaving this node */
- struct st_trie_node *fail; /* AC failure function */
-} TRIE_NODE;
-
-typedef struct st_trie
-{
- TRIE_NODE root;
- MEM_ROOT mem_root;
- CHARSET_INFO *charset;
- uint32 nnodes;
- uint32 nwords;
-} TRIE;
-
-typedef struct st_ac_trie_state
-{
- TRIE *trie;
- TRIE_NODE *node;
-} AC_TRIE_STATE;
-
-extern TRIE *trie_init (TRIE *trie, CHARSET_INFO *charset);
-extern void trie_free (TRIE *trie);
-extern my_bool trie_insert (TRIE *trie, const uchar *key, uint keylen);
-extern my_bool ac_trie_prepare (TRIE *trie);
-extern void ac_trie_init (TRIE *trie, AC_TRIE_STATE *state);
-
-
-/* `trie_goto' is internal function and shouldn't be used. */
-
-static inline TRIE_NODE *trie_goto (TRIE_NODE *root, TRIE_NODE *node, uchar c)
-{
- TRIE_NODE *next;
- DBUG_ENTER("trie_goto");
- for (next= node->links; next; next= next->next)
- if (next->c == c)
- DBUG_RETURN(next);
- if (root == node)
- DBUG_RETURN(root);
- DBUG_RETURN(NULL);
-}
-
-
-/*
- SYNOPSIS
- int ac_trie_next (AC_TRIE_STATE *state, uchar *c);
- state - valid pointer to `AC_TRIE_STATE'
- c - character to lookup
-
- DESCRIPTION
- Implementation of search using Aho-Corasick automaton.
- Performs char-by-char search.
-
- RETURN VALUE
- `ac_trie_next' returns length of matched word or 0.
-*/
-
-static inline int ac_trie_next (AC_TRIE_STATE *state, uchar *c)
-{
- TRIE_NODE *root, *node;
- DBUG_ENTER("ac_trie_next");
- DBUG_ASSERT(state && c);
- root= &state->trie->root;
- node= state->node;
- while (! (state->node= trie_goto(root, node, *c)))
- node= node->fail;
- DBUG_RETURN(state->node->leaf);
-}
-
-
-/*
- SYNOPSIS
- my_bool trie_search (TRIE *trie, const uchar *key, uint keylen);
- trie - valid pointer to `TRIE'
- key - valid pointer to key to insert
- keylen - non-0 key length
-
- DESCRIPTION
- Performs key lookup in trie.
-
- RETURN VALUE
- `trie_search' returns `true' if key is in `trie'. Otherwise,
- `false' is returned.
-
- NOTES
- Consecutive search here is "best by test". arrays are very short, so
- binary search or hashing would add too much complexity that would
- overweight speed gain. Especially because compiler can optimize simple
- consecutive loop better (tested)
-*/
-
-static inline my_bool trie_search (TRIE *trie, const uchar *key, uint keylen)
-{
- TRIE_NODE *node;
- uint k;
- DBUG_ENTER("trie_search");
- DBUG_ASSERT(trie && key && keylen);
- node= &trie->root;
-
- for (k= 0; k < keylen; k++)
- {
- uchar p;
- if (! (node= node->links))
- DBUG_RETURN(FALSE);
- p= key[k];
- while (p != node->c)
- if (! (node= node->next))
- DBUG_RETURN(FALSE);
- }
-
- DBUG_RETURN(node->leaf > 0);
-}
-
-#ifdef __cplusplus
-}
-#endif
-#endif
=== removed file 'include/my_vle.h'
--- a/include/my_vle.h 2007-05-10 09:59:39 +0000
+++ b/include/my_vle.h 1970-01-01 00:00:00 +0000
@@ -1,38 +0,0 @@
-/* Copyright (C) 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; version 2 of the License.
-
- 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 */
-
-#ifndef VLE_H
-#define VLE_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "my_global.h"
-
-/*
- The size (in bytes) required to store the object ITEM, which can be
- either an expression or a type (since sizeof() is used on the item).
-*/
-#define my_vle_sizeof(ITEM) (((sizeof(ITEM) * CHAR_BIT) + 6) / 7)
-
-uchar *my_vle_encode(uchar *vle, size_t max, ulong value);
-uchar const *my_vle_decode(ulong *value_ptr, uchar const *vle);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
=== modified file 'libmysqld/CMakeLists.txt'
--- a/libmysqld/CMakeLists.txt 2010-06-21 13:08:16 +0000
+++ b/libmysqld/CMakeLists.txt 2010-07-20 02:30:37 +0000
@@ -67,7 +67,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc l
../sql/sql_truncate.cc
../sql/sql_lex.cc ../sql/keycaches.cc
../sql/sql_list.cc ../sql/sql_load.cc ../sql/sql_locale.cc
- ../sql/sql_binlog.cc ../sql/sql_manager.cc ../sql/sql_map.cc
+ ../sql/sql_binlog.cc ../sql/sql_manager.cc
../sql/sql_parse.cc ../sql/sql_partition.cc ../sql/sql_plugin.cc
../sql/debug_sync.cc
../sql/sql_prepare.cc ../sql/sql_rename.cc ../sql/sql_repl.cc
=== modified file 'libmysqld/Makefile.am'
--- a/libmysqld/Makefile.am 2010-07-15 18:44:15 +0000
+++ b/libmysqld/Makefile.am 2010-07-20 02:30:37 +0000
@@ -66,7 +66,7 @@ sqlsources = derror.cc field.cc field_co
sql_profile.cc sql_truncate.cc datadict.cc \
sql_analyse.cc sql_base.cc sql_cache.cc sql_class.cc \
sql_crypt.cc sql_db.cc sql_delete.cc sql_error.cc sql_insert.cc \
- sql_lex.cc sql_list.cc sql_manager.cc sql_map.cc \
+ sql_lex.cc sql_list.cc sql_manager.cc \
scheduler.cc sql_connect.cc sql_parse.cc \
sql_prepare.cc sql_derived.cc sql_rename.cc \
sql_select.cc sql_do.cc sql_show.cc set_var.cc sys_vars.cc \
=== modified file 'mysql-test/suite/perfschema/r/server_init.result'
--- a/mysql-test/suite/perfschema/r/server_init.result 2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/server_init.result 2010-07-20 02:30:37 +0000
@@ -56,10 +56,6 @@ where name like "wait/synch/mutex/sql/LO
count(name)
1
select count(name) from MUTEX_INSTANCES
-where name like "wait/synch/mutex/sql/LOCK_mapped_file";
-count(name)
-1
-select count(name) from MUTEX_INSTANCES
where name like "wait/synch/mutex/sql/LOCK_status";
count(name)
1
=== modified file 'mysql-test/suite/perfschema/t/server_init.test'
--- a/mysql-test/suite/perfschema/t/server_init.test 2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/t/server_init.test 2010-07-20 02:30:37 +0000
@@ -81,9 +81,6 @@ select count(name) from MUTEX_INSTANCES
where name like "wait/synch/mutex/sql/LOCK_thread_count";
select count(name) from MUTEX_INSTANCES
- where name like "wait/synch/mutex/sql/LOCK_mapped_file";
-
-select count(name) from MUTEX_INSTANCES
where name like "wait/synch/mutex/sql/LOCK_status";
select count(name) from MUTEX_INSTANCES
=== modified file 'mysys/CMakeLists.txt'
--- a/mysys/CMakeLists.txt 2010-07-15 13:47:50 +0000
+++ b/mysys/CMakeLists.txt 2010-07-20 02:30:37 +0000
@@ -17,23 +17,23 @@
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/mysys)
-SET(MYSYS_SOURCES array.c charset-def.c charset.c checksum.c default.c default_modify.c
+SET(MYSYS_SOURCES array.c charset-def.c charset.c checksum.c default.c
errors.c hash.c list.c md5.c mf_brkhant.c mf_cache.c mf_dirname.c mf_fn_ext.c
mf_format.c mf_getdate.c mf_iocache.c mf_iocache2.c mf_keycache.c
mf_keycaches.c mf_loadpath.c mf_pack.c mf_path.c mf_qsort.c mf_qsort2.c
mf_radix.c mf_same.c mf_sort.c mf_soundex.c mf_arr_appstr.c mf_tempdir.c
- mf_tempfile.c mf_unixpath.c mf_wcomp.c mf_wfile.c mulalloc.c my_access.c
- my_aes.c my_alarm.c my_alloc.c my_append.c my_bit.c my_bitmap.c my_chsize.c
- my_clock.c my_compress.c my_copy.c my_crc32.c my_create.c my_delete.c
+ mf_tempfile.c mf_unixpath.c mf_wcomp.c mulalloc.c my_access.c
+ my_aes.c my_alarm.c my_alloc.c my_bit.c my_bitmap.c my_chsize.c
+ my_compress.c my_copy.c my_crc32.c my_create.c my_delete.c
my_div.c my_error.c my_file.c my_fopen.c my_fstream.c my_gethostbyname.c
my_gethwaddr.c my_getopt.c my_getsystime.c my_getwd.c my_handler.c my_init.c
my_lib.c my_lock.c my_lockmem.c my_malloc.c my_mess.c
- my_mkdir.c my_mmap.c my_net.c my_once.c my_open.c my_pread.c my_pthread.c
+ my_mkdir.c my_mmap.c my_once.c my_open.c my_pread.c my_pthread.c
my_quick.c my_read.c my_redel.c my_rename.c my_seek.c my_sleep.c
my_static.c my_symlink.c my_symlink2.c my_sync.c my_thr_init.c
my_write.c ptr_cmp.c queues.c stacktrace.c
rijndael.c sha1.c string.c thr_alarm.c thr_lock.c thr_mutex.c
- thr_rwlock.c tree.c typelib.c my_vle.c base64.c my_memmem.c my_getpagesize.c
+ thr_rwlock.c tree.c typelib.c base64.c my_memmem.c my_getpagesize.c
lf_alloc-pin.c lf_dynarray.c lf_hash.c
my_atomic.c my_getncpus.c
my_rdtsc.c)
=== modified file 'mysys/Makefile.am'
--- a/mysys/Makefile.am 2010-07-15 13:47:50 +0000
+++ b/mysys/Makefile.am 2010-07-20 02:30:37 +0000
@@ -24,31 +24,29 @@ LDADD = libmysys.a $(top_builddir)/str
noinst_HEADERS = mysys_priv.h my_static.h my_handler_errors.h
libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c my_mmap.c \
mf_path.c mf_loadpath.c my_file.c \
- my_open.c my_create.c my_dup.c my_seek.c my_read.c \
+ my_open.c my_create.c my_seek.c my_read.c \
my_pread.c my_write.c my_getpagesize.c \
mf_keycaches.c my_crc32.c \
mf_iocache.c mf_iocache2.c mf_cache.c mf_tempfile.c \
mf_tempdir.c my_lock.c mf_brkhant.c my_alarm.c \
my_malloc.c my_once.c mulalloc.c \
- my_alloc.c my_new.cc my_vle.c my_atomic.c lf_hash.c \
+ my_alloc.c my_new.cc my_atomic.c lf_hash.c \
lf_dynarray.c lf_alloc-pin.c \
my_fopen.c my_fstream.c my_getsystime.c \
my_error.c errors.c my_div.c my_mess.c \
mf_format.c mf_same.c mf_dirname.c mf_fn_ext.c \
my_symlink.c my_symlink2.c \
mf_pack.c mf_unixpath.c mf_arr_appstr.c \
- mf_wcomp.c mf_wfile.c my_gethwaddr.c \
+ mf_wcomp.c my_gethwaddr.c \
mf_qsort.c mf_qsort2.c mf_sort.c \
ptr_cmp.c mf_radix.c queues.c my_getncpus.c \
tree.c trie.c list.c hash.c array.c string.c typelib.c \
- my_copy.c my_append.c my_lib.c \
+ my_copy.c my_lib.c \
my_delete.c my_rename.c my_redel.c \
- my_chsize.c my_clock.c \
- my_quick.c my_lockmem.c my_static.c \
+ my_chsize.c my_quick.c my_lockmem.c my_static.c \
my_sync.c my_getopt.c my_mkdir.c \
- default_modify.c default.c \
- my_compress.c checksum.c \
- my_net.c my_port.c my_sleep.c \
+ default.c my_compress.c checksum.c \
+ my_port.c my_sleep.c \
charset.c charset-def.c my_bitmap.c my_bit.c md5.c \
my_gethostbyname.c rijndael.c my_aes.c sha1.c \
my_handler.c my_largepage.c \
=== removed file 'mysys/make-conf.c'
--- a/mysys/make-conf.c 2006-12-23 19:17:15 +0000
+++ b/mysys/make-conf.c 1970-01-01 00:00:00 +0000
@@ -1,71 +0,0 @@
-/* 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; version 2 of the License.
-
- 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 */
-
-/* make-conf.c
- * make a charset .conf file out of a ctype-charset.c file.
- */
-
-#ifndef CHARSET
-#error You must define the charset, e.g.: -DCHARSET=latin1
-#endif
-
-/* some pre-processor tricks to get us going */
-#define _STRINGIZE_HELPER(x) #x
-#define STRINGIZE(x) _STRINGIZE_HELPER(x)
-
-#define _JOIN_WORDS_HELPER(a, b) a ## b
-#define JOIN_WORDS(a, b) _JOIN_WORDS_HELPER(a, b)
-
-#define CH_SRC ctype- ## CHARSET ## .c
-#define CH_INCLUDE STRINGIZE(CH_SRC)
-
-/* aaaah, that's better */
-#include <my_my_global.h>
-#include CH_INCLUDE
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#define ROW_LEN 16
-
-void print_array(const char *name, const uchar *array, uint size);
-
-int main(void)
-{
- printf("# Configuration file for the "
- STRINGIZE(CHARSET)
- " character set.\n");
-
- print_array("ctype", JOIN_WORDS(ctype_, CHARSET), 257);
- print_array("to_lower", JOIN_WORDS(to_lower_, CHARSET), 256);
- print_array("to_upper", JOIN_WORDS(to_upper_, CHARSET), 256);
- print_array("sort_order", JOIN_WORDS(sort_order_, CHARSET), 256);
-
- exit(EXIT_SUCCESS);
-}
-
-void print_array(const char *name, const uchar *array, uint size)
-{
- uint i;
-
- printf("\n# The %s array must have %d elements.\n", name, size);
-
- for (i = 0; i < size; ++i) {
- printf(" %02X", array[i]);
-
- if ((i+1) % ROW_LEN == size % ROW_LEN)
- printf("\n");
- }
-}
=== removed file 'mysys/my_append.c'
--- a/mysys/my_append.c 2009-11-24 13:54:59 +0000
+++ b/mysys/my_append.c 1970-01-01 00:00:00 +0000
@@ -1,64 +0,0 @@
-/* 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; version 2 of the License.
-
- 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 */
-
-#include "mysys_priv.h"
-#include <sys/stat.h>
-#include <m_string.h>
-#if defined(HAVE_UTIME_H)
-#include <utime.h>
-#elif defined(HAVE_SYS_UTIME_H)
-#include <sys/utime.h>
-#elif !defined(HPUX10)
-struct utimbuf {
- time_t actime;
- time_t modtime;
-};
-#endif
-
-/*
- Append a file to another
-
- NOTES
- Don't set MY_FNABP or MY_NABP bits on when calling this function
-*/
-
-int my_append(const char *from, const char *to, myf MyFlags)
-{
- size_t Count;
- File from_file,to_file;
- uchar buff[IO_SIZE];
- DBUG_ENTER("my_append");
- DBUG_PRINT("my",("from %s to %s MyFlags %d", from, to, MyFlags));
-
- from_file= to_file= -1;
-
- if ((from_file=my_open(from,O_RDONLY,MyFlags)) >= 0)
- {
- if ((to_file=my_open(to,O_APPEND | O_WRONLY,MyFlags)) >= 0)
- {
- while ((Count=my_read(from_file,buff,IO_SIZE,MyFlags)) != 0)
- if (Count == (uint) -1 ||
- my_write(to_file,buff,Count,MYF(MyFlags | MY_NABP)))
- goto err;
- if (my_close(from_file,MyFlags) | my_close(to_file,MyFlags))
- DBUG_RETURN(-1); /* Error on close */
- DBUG_RETURN(0);
- }
- }
-err:
- if (from_file >= 0) (void) my_close(from_file,MyFlags);
- if (to_file >= 0) (void) my_close(to_file,MyFlags);
- DBUG_RETURN(-1);
-}
=== removed file 'mysys/my_clock.c'
--- a/mysys/my_clock.c 2010-07-15 11:13:30 +0000
+++ b/mysys/my_clock.c 1970-01-01 00:00:00 +0000
@@ -1,32 +0,0 @@
-/* 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; version 2 of the License.
-
- 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 */
-
-#include "my_global.h"
-
-#if !defined(_MSC_VER) && !defined(__BORLANDC__)
-#include "mysys_priv.h"
-#include <sys/times.h>
-#endif
-
-long my_clock(void)
-{
-#if !defined(__WIN__)
- struct tms tmsbuf;
- (void) times(&tmsbuf);
- return (tmsbuf.tms_utime + tmsbuf.tms_stime);
-#else
- return clock();
-#endif
-}
=== removed file 'mysys/my_dup.c'
--- a/mysys/my_dup.c 2009-09-11 20:26:35 +0000
+++ b/mysys/my_dup.c 1970-01-01 00:00:00 +0000
@@ -1,41 +0,0 @@
-/* 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; version 2 of the License.
-
- 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 */
-
-#include "mysys_priv.h"
-#include "mysys_err.h"
-#include <my_dir.h>
-#include <errno.h>
-#if defined(__WIN__)
-#include <share.h>
-#endif
-
- /* Open a file */
-
-File my_dup(File file, myf MyFlags)
-{
- File fd;
- const char *filename;
- DBUG_ENTER("my_dup");
- DBUG_PRINT("my",("file: %d MyFlags: %d", file, MyFlags));
-#ifdef _WIN32
- fd= my_win_dup(file);
-#else
- fd= dup(file);
-#endif
- filename= (((uint) file < my_file_limit) ?
- my_file_info[(int) file].name : "Unknown");
- DBUG_RETURN(my_register_filename(fd, filename, FILE_BY_DUP,
- EE_FILENOTFOUND, MyFlags));
-} /* my_open */
=== modified file 'mysys/my_init.c'
--- a/mysys/my_init.c 2010-07-15 11:26:38 +0000
+++ b/mysys/my_init.c 2010-07-20 02:30:37 +0000
@@ -138,9 +138,6 @@ my_bool my_init(void)
#ifdef THREAD
if (my_thread_global_init())
return 1;
-#if !defined(__WIN__)
- sigfillset(&my_signals); /* signals blocked by mf_brkhant */
-#endif
#endif /* THREAD */
{
DBUG_ENTER("my_init");
=== removed file 'mysys/my_net.c'
--- a/mysys/my_net.c 2009-12-10 03:19:51 +0000
+++ b/mysys/my_net.c 1970-01-01 00:00:00 +0000
@@ -1,42 +0,0 @@
-/* Copyright (C) 2000 MySQL AB, 2008-2009 Sun Microsystems, Inc
-
- 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; version 2 of the License.
-
- 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 */
-
-/* thread safe version of some common functions */
-
-#include "mysys_priv.h"
-#include <m_string.h>
-
-/* for thread safe my_inet_ntoa */
-#if !defined(__WIN__)
-#include <netdb.h>
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-#ifdef HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-#endif /* !defined(__WIN__) */
-
-void my_inet_ntoa(struct in_addr in, char *buf)
-{
- char *ptr;
- mysql_mutex_lock(&THR_LOCK_net);
- ptr=inet_ntoa(in);
- strmov(buf,ptr);
- mysql_mutex_unlock(&THR_LOCK_net);
-}
=== modified file 'mysys/my_static.c'
--- a/mysys/my_static.c 2010-07-17 14:56:00 +0000
+++ b/mysys/my_static.c 2010-07-20 02:30:37 +0000
@@ -43,9 +43,6 @@ struct st_my_file_info *my_file_info= my
int my_dont_interrupt=0;
volatile int _my_signals=0;
struct st_remember _my_sig_remember[MAX_SIGNALS]={{0,0}};
-#ifdef THREAD
-sigset_t my_signals; /* signals blocked by mf_brkhant */
-#endif
/* from mf_reccache.c */
ulong my_default_record_cache_size=RECORD_CACHE_SIZE;
=== modified file 'mysys/my_static.h'
--- a/mysys/my_static.h 2010-07-17 14:56:00 +0000
+++ b/mysys/my_static.h 2010-07-20 02:30:37 +0000
@@ -25,9 +25,6 @@ C_MODE_START
#include <signal.h>
#define MAX_SIGNALS 10 /* Max signals under a dont-allow */
-#define MIN_KEYBLOCK (min(IO_SIZE,1024))
-#define MAX_KEYBLOCK 8192 /* Max keyblocklength == 8*IO_SIZE */
-#define MAX_BLOCK_TYPES MAX_KEYBLOCK/MIN_KEYBLOCK
struct st_remember {
int number;
@@ -48,9 +45,6 @@ extern struct st_my_file_info my_file_in
extern ulonglong query_performance_frequency, query_performance_offset;
-#if defined(THREAD) && !defined(__WIN__)
-extern sigset_t my_signals; /* signals blocked by mf_brkhant */
-#endif
C_MODE_END
#endif /* MYSYS_MY_STATIC_INCLUDED */
=== removed file 'mysys/my_vle.c'
--- a/mysys/my_vle.c 2007-05-10 09:59:39 +0000
+++ b/mysys/my_vle.c 1970-01-01 00:00:00 +0000
@@ -1,109 +0,0 @@
-/* Copyright (C) 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; version 2 of the License.
-
- 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 */
-
-/*
- Variable length encoding.
-
- A method to store an arbitrary-size non-negative integer. We let the
- most significant bit of the number indicate that the next byte
- should be contatenated to form the real number.
-*/
-
-#include "my_vle.h"
-
-/*
- Function to encode an unsigned long as VLE. The bytes for the VLE
- will be written to the location pointed to by 'out'. The maximum
- number of bytes written will be 'max'.
-
- PARAMETERS
-
- out Pointer to beginning of where to store VLE bytes.
- max Maximum number of bytes to write.
- n Number to encode.
-
- RETURN VALUE
- On success, one past the end of the array containing the VLE
- bytes. On failure, the 'out' pointer is returned.
-*/
-
-uchar*
-my_vle_encode(uchar* out, size_t max, ulong n)
-{
- uchar buf[my_vle_sizeof(n)];
- uchar *ptr= buf;
- size_t len;
-
- do
- {
- *ptr++= (uchar) (n & 0x7F);
- n>>= 7;
- }
- while (n > 0);
-
- len= ptr - buf;
-
- if (len <= max)
- {
- /*
- The bytes are stored in reverse order in 'buf'. Let's write them
- in correct order to the output buffer and set the MSB at the
- same time.
- */
- while (ptr-- > buf)
- {
- uchar v= *ptr;
- if (ptr > buf)
- v|= 0x80;
- *out++= v;
- }
- }
-
- return out;
-}
-
-/*
- Function to decode a VLE representation of an integral value.
-
-
- PARAMETERS
-
- result_ptr Pointer to an unsigned long where the value will be written.
- vle Pointer to the VLE bytes.
-
- RETURN VALUE
-
- One-past the end of the VLE bytes. The routine will never read
- more than sizeof(*result_ptr) + 1 bytes.
-*/
-
-uchar const*
-my_vle_decode(ulong *result_ptr, uchar const *vle)
-{
- ulong result= 0;
- size_t cnt= 1;
-
- do
- {
- result<<= 7;
- result|= (*vle & 0x7F);
- }
- while ((*vle++ & 0x80) && ++cnt <= sizeof(*result_ptr) + 1);
-
- if (cnt <= sizeof(*result_ptr) + 1)
- *result_ptr= result;
-
- return vle;
-}
=== modified file 'sql/CMakeLists.txt'
--- a/sql/CMakeLists.txt 2010-07-15 13:47:50 +0000
+++ b/sql/CMakeLists.txt 2010-07-20 02:30:37 +0000
@@ -60,7 +60,7 @@ SET (SQL_SOURCE
sql_cache.cc sql_class.cc sql_client.cc sql_crypt.cc sql_crypt.h
sql_cursor.cc sql_db.cc sql_delete.cc sql_derived.cc sql_do.cc
sql_error.cc sql_handler.cc sql_help.cc sql_insert.cc sql_lex.cc
- sql_list.cc sql_load.cc sql_manager.cc sql_map.cc sql_parse.cc
+ sql_list.cc sql_load.cc sql_manager.cc sql_parse.cc
sql_partition.cc sql_plugin.cc sql_prepare.cc sql_rename.cc
debug_sync.cc debug_sync.h
sql_repl.cc sql_select.cc sql_show.cc sql_state.c sql_string.cc
=== modified file 'sql/Makefile.am'
--- a/sql/Makefile.am 2010-07-15 11:13:30 +0000
+++ b/sql/Makefile.am 2010-07-20 02:30:37 +0000
@@ -90,7 +90,7 @@ noinst_HEADERS = item.h item_func.h item
item_create.h item_subselect.h item_row.h \
sql_priv.h item_geofunc.h sql_bitmap.h \
procedure.h sql_class.h sql_lex.h sql_list.h \
- sql_map.h sql_string.h unireg.h \
+ sql_string.h unireg.h \
sql_error.h field.h handler.h mysqld_suffix.h \
sql_profile.h mysqld.h sql_help.h frm_crypt.h \
ha_ndbcluster.h ha_ndbcluster_cond.h \
@@ -135,7 +135,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.
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 sql_string.cc sql_manager.cc sql_map.cc \
+ lock.cc sql_string.cc sql_manager.cc \
main.cc mysqld.cc password.c hash_filo.cc hostname.cc \
sql_connect.cc scheduler.cc sql_parse.cc \
keycaches.cc set_var.cc sql_yacc.yy sys_vars.cc \
@@ -160,8 +160,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.
rpl_reporting.cc \
sql_union.cc sql_derived.cc \
sql_client.cc \
- repl_failsafe.h repl_failsafe.cc \
- sql_olap.cc sql_view.cc \
+ repl_failsafe.h repl_failsafe.cc sql_view.cc \
gstream.cc spatial.cc sql_help.cc sql_cursor.cc \
tztime.cc my_decimal.cc\
sp_head.cc sp_pcontext.cc sp_rcontext.cc sp.cc \
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2010-07-20 02:27:11 +0000
+++ b/sql/mysqld.cc 2010-07-20 02:30:37 +0000
@@ -602,7 +602,7 @@ pthread_key(MEM_ROOT**,THR_MALLOC);
pthread_key(THD*, THR_THD);
mysql_mutex_t LOCK_thread_count;
mysql_mutex_t LOCK_mysql_create_db, LOCK_open,
- LOCK_mapped_file, LOCK_status, LOCK_global_read_lock,
+ LOCK_status, LOCK_global_read_lock,
LOCK_error_log, LOCK_uuid_generator,
LOCK_delayed_insert, LOCK_delayed_status, LOCK_delayed_create,
LOCK_crypt,
@@ -1532,7 +1532,6 @@ static void clean_up_mutexes()
mysql_rwlock_destroy(&LOCK_grant);
mysql_mutex_destroy(&LOCK_open);
mysql_mutex_destroy(&LOCK_thread_count);
- mysql_mutex_destroy(&LOCK_mapped_file);
mysql_mutex_destroy(&LOCK_status);
mysql_mutex_destroy(&LOCK_delayed_insert);
mysql_mutex_destroy(&LOCK_delayed_status);
@@ -3512,7 +3511,6 @@ static int init_thread_environment()
mysql_mutex_init(key_LOCK_lock_db, &LOCK_lock_db, MY_MUTEX_INIT_SLOW);
mysql_mutex_init(key_LOCK_open, &LOCK_open, MY_MUTEX_INIT_FAST);
mysql_mutex_init(key_LOCK_thread_count, &LOCK_thread_count, MY_MUTEX_INIT_FAST);
- mysql_mutex_init(key_LOCK_mapped_file, &LOCK_mapped_file, MY_MUTEX_INIT_SLOW);
mysql_mutex_init(key_LOCK_status, &LOCK_status, MY_MUTEX_INIT_FAST);
mysql_mutex_init(key_LOCK_delayed_insert,
&LOCK_delayed_insert, MY_MUTEX_INIT_FAST);
@@ -7691,7 +7689,7 @@ PSI_mutex_key key_BINLOG_LOCK_index, key
key_LOCK_connection_count, key_LOCK_crypt, key_LOCK_delayed_create,
key_LOCK_delayed_insert, key_LOCK_delayed_status, key_LOCK_error_log,
key_LOCK_gdl, key_LOCK_global_read_lock, key_LOCK_global_system_variables,
- key_LOCK_lock_db, key_LOCK_manager, key_LOCK_mapped_file,
+ key_LOCK_lock_db, key_LOCK_manager,
key_LOCK_mysql_create_db, key_LOCK_open, key_LOCK_prepared_stmt_count,
key_LOCK_rpl_status, key_LOCK_server_started, key_LOCK_status,
key_LOCK_system_variables_hash, key_LOCK_table_share, key_LOCK_thd_data,
@@ -7732,7 +7730,6 @@ static PSI_mutex_info all_server_mutexes
{ &key_LOCK_global_system_variables, "LOCK_global_system_variables", PSI_FLAG_GLOBAL},
{ &key_LOCK_lock_db, "LOCK_lock_db", PSI_FLAG_GLOBAL},
{ &key_LOCK_manager, "LOCK_manager", PSI_FLAG_GLOBAL},
- { &key_LOCK_mapped_file, "LOCK_mapped_file", PSI_FLAG_GLOBAL},
{ &key_LOCK_mysql_create_db, "LOCK_mysql_create_db", PSI_FLAG_GLOBAL},
{ &key_LOCK_open, "LOCK_open", PSI_FLAG_GLOBAL},
{ &key_LOCK_prepared_stmt_count, "LOCK_prepared_stmt_count", PSI_FLAG_GLOBAL},
=== modified file 'sql/mysqld.h'
--- a/sql/mysqld.h 2010-07-20 02:27:11 +0000
+++ b/sql/mysqld.h 2010-07-20 02:30:37 +0000
@@ -228,7 +228,7 @@ extern PSI_mutex_key key_BINLOG_LOCK_ind
key_LOCK_connection_count, key_LOCK_crypt, key_LOCK_delayed_create,
key_LOCK_delayed_insert, key_LOCK_delayed_status, key_LOCK_error_log,
key_LOCK_gdl, key_LOCK_global_read_lock, key_LOCK_global_system_variables,
- key_LOCK_lock_db, key_LOCK_logger, key_LOCK_manager, key_LOCK_mapped_file,
+ key_LOCK_lock_db, key_LOCK_logger, key_LOCK_manager,
key_LOCK_mysql_create_db, key_LOCK_open, key_LOCK_prepared_stmt_count,
key_LOCK_rpl_status, key_LOCK_server_started, key_LOCK_status,
key_LOCK_table_share, key_LOCK_thd_data,
@@ -317,7 +317,7 @@ extern MYSQL_PLUGIN_IMPORT key_map key_m
Server mutex locks and condition variables.
*/
extern mysql_mutex_t LOCK_mysql_create_db, LOCK_open, LOCK_lock_db,
- LOCK_mapped_file, LOCK_user_locks, LOCK_status,
+ LOCK_user_locks, LOCK_status,
LOCK_error_log, LOCK_delayed_insert, LOCK_uuid_generator,
LOCK_delayed_status, LOCK_delayed_create, LOCK_crypt, LOCK_timezone,
LOCK_slave_list, LOCK_active_mi, LOCK_manager, LOCK_global_read_lock,
=== removed file 'sql/sql_map.h'
--- a/sql/sql_map.h 2010-03-31 14:05:33 +0000
+++ b/sql/sql_map.h 1970-01-01 00:00:00 +0000
@@ -1,70 +0,0 @@
-#ifndef SQL_MAP_INCLUDED
-#define SQL_MAP_INCLUDED
-
-/* Copyright (C) 2000-2001, 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; version 2 of the License.
-
- 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 */
-
-
-/* interface for memory mapped files */
-
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
-#include "my_base.h" /* ha_rows */
-#include "sql_list.h" /* ilink */
-
-class mapped_files;
-mapped_files *map_file(const char * name,uchar *magic,uint magic_length);
-void unmap_file(mapped_files *map);
-
-class mapped_files :public ilink {
- uchar *map;
- ha_rows size;
- char *name; // name of mapped file
- File file; // >= 0 if open
- int error; // If not mapped
- uint use_count;
-
-public:
- mapped_files(const char * name,uchar *magic,uint magic_length);
- ~mapped_files();
-
- friend class mapped_file;
- friend mapped_files *map_file(const char * name,uchar *magic,
- uint magic_length);
- friend void unmap_file(mapped_files *map);
-};
-
-
-class mapped_file
-{
- mapped_files *file;
-public:
- mapped_file(const char * name,uchar *magic,uint magic_length)
- {
- file=map_file(name,magic,magic_length); /* old or new map */
- }
- ~mapped_file()
- {
- unmap_file(file); /* free map */
- }
- uchar *map()
- {
- return file->map;
- }
-};
-
-#endif /* SQL_MAP_INCLUDED */
=== removed file 'sql/sql_olap.cc'
--- a/sql/sql_olap.cc 2010-06-11 01:30:49 +0000
+++ b/sql/sql_olap.cc 1970-01-01 00:00:00 +0000
@@ -1,188 +0,0 @@
-/* Copyright (C) 2000-2006 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; version 2 of the License.
-
- 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 */
-
-
-/*
- OLAP implementation by Sinisa Milivojevic <sinisa@stripped>
- Inspired by code submitted by Srilakshmi <lakshmi@stripped>
-
- The ROLLUP code in this file has to be complitely rewritten as it's
- not good enough to satisfy the goals of MySQL.
-
- In 4.1 we will replace this with a working, superior implementation
- of ROLLUP.
-*/
-
-#ifdef DISABLED_UNTIL_REWRITTEN_IN_4_1
-
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
-#include "sql_priv.h"
-#include "unireg.h"
-#include "sql_select.h"
-
-
-/****************************************************************************
- Functions that recursively actually creates new SELECT's
- Returns 0 if OK, 1 if error, -1 if error already printed to client
-****************************************************************************/
-
-
-static int make_new_olap_select(LEX *lex, SELECT_LEX *select_lex, List<Item> new_fields)
-{
- THD *thd=current_thd;
- Item *item, *new_item;
- Item_null *constant= new Item_null("ALL");
-
- SELECT_LEX *new_select = (SELECT_LEX *) thd->memdup((char*) select_lex, sizeof(*select_lex));
- if (!new_select)
- return 1;
- lex->last_selects->next=new_select;
- new_select->linkage=OLAP_TYPE;
- new_select->olap=NON_EXISTING_ONE;
- new_select->group_list.elements=0;
- new_select->group_list.first=(uchar *)0;
- new_select->group_list.next=(uchar **)&new_select->group_list.first;
- List<Item> privlist;
-
- List_iterator<Item> list_it(select_lex->item_list);
- List_iterator<Item> new_it(new_fields);
-
- while ((item=list_it++))
- {
- bool not_found= TRUE;
- if (item->type()==Item::FIELD_ITEM)
- {
- Item_field *iif = (Item_field *)item;
- new_it.rewind();
- while ((new_item=new_it++))
- {
- if (new_item->type()==Item::FIELD_ITEM &&
- !strcmp(((Item_field*)new_item)->table_name,iif->table_name) &&
- !strcmp(((Item_field*)new_item)->field_name,iif->field_name))
- {
- not_found= 0;
- ((Item_field*)new_item)->db_name=iif->db_name;
- Item_field *new_one=new Item_field(&select_lex->context,
- iif->db_name, iif->table_name, iif->field_name);
- privlist.push_back(new_one);
- if (add_to_list(new_select->group_list,new_one,1))
- return 1;
- break;
- }
- }
- }
- if (not_found)
- {
- if (item->type() == Item::FIELD_ITEM)
- privlist.push_back(constant);
- else
- privlist.push_back((Item*)thd->memdup((char *)item,item->size_of()));
- }
- }
- new_select->item_list=privlist;
-
- lex->last_selects = new_select;
- return 0;
-}
-
-/****************************************************************************
- Functions that recursively creates combinations of queries for OLAP
- Returns 0 if OK, 1 if error, -1 if error already printed to client
-****************************************************************************/
-
-static int olap_combos(List<Item> old_fields, List<Item> new_fields, Item *item, LEX *lex,
- SELECT_LEX *select_lex, int position, int selection, int num_fields,
- int num_new_fields)
-{
- int sl_return = 0;
- if (position == num_new_fields)
- {
- if (item)
- new_fields.push_front(item);
- sl_return = make_new_olap_select(lex, select_lex, new_fields);
- }
- else
- {
- if (item)
- new_fields.push_front(item);
- while ((num_fields - num_new_fields >= selection - position) && !sl_return)
- {
- item = old_fields.pop();
- sl_return = olap_combos(old_fields, new_fields, item, lex, select_lex, position+1, ++selection, num_fields, num_new_fields);
- }
- }
- return sl_return;
-}
-
-
-/****************************************************************************
- Top level function for converting OLAP clauses to multiple selects
- This is also a place where clauses treatment depends on OLAP type
- Returns 0 if OK, 1 if error, -1 if error already printed to client
-****************************************************************************/
-
-int handle_olaps(LEX *lex, SELECT_LEX *select_lex)
-{
- List<Item> item_list_copy, new_item_list;
- item_list_copy.empty();
- new_item_list.empty();
- int count=select_lex->group_list.elements;
- int sl_return=0;
-
-
- lex->last_selects=select_lex;
-
- for (ORDER *order= select_lex->group_list.first ; order ; order=order->next)
- item_list_copy.push_back(*(order->item));
-
- List<Item> all_fields(select_lex->item_list);
-
-
- if (setup_tables(lex->thd, &select_lex->context, &select_lex->top_join_list,
- select_lex->table_list.first
- &select_lex->leaf_tables, FALSE) ||
- setup_fields(lex->thd, 0, select_lex->item_list, MARK_COLUMNS_READ,
- &all_fields,1) ||
- setup_fields(lex->thd, 0, item_list_copy, MARK_COLUMNS_READ,
- &all_fields, 1))
- return -1;
-
- if (select_lex->olap == CUBE_TYPE)
- {
- for ( int i=count-1; i>=0 && !sl_return; i--)
- sl_return=olap_combos(item_list_copy, new_item_list, (Item *)0, lex, select_lex, 0, 0, count, i);
- }
- else if (select_lex->olap == ROLLUP_TYPE)
- {
- for ( int i=count-1; i>=0 && !sl_return; i--)
- {
- Item *item;
- item_list_copy.pop();
- List_iterator<Item> it(item_list_copy);
- new_item_list.empty();
- while ((item = it++))
- new_item_list.push_front(item);
- sl_return=make_new_olap_select(lex, select_lex, new_item_list);
- }
- }
- else
- sl_return=1; // impossible
- return sl_return;
-}
-
-#endif /* DISABLED_UNTIL_REWRITTEN_IN_4_1 */
Attachment: [text/bzr-bundle] bzr/davi.arnaut@oracle.com-20100720023037-790j2d0t68wum5qv.bundle