#At file:///home/bm136801/my/mtr-60/ based on revid:bjorn.munch@stripped
2939 Bjorn Munch 2010-04-13 [merge]
merge from 6.0-codebase
added:
include/mysql/innodb_priv.h
include/password.h
sql/derror.h
sql/des_key_file.h
sql/discover.h
sql/filesort.h
sql/frm_crypt.h
sql/hostname.h
sql/init.h
sql/key.h
sql/lock.h
sql/mysqld.h
sql/sql_base.h
sql/sql_binlog.h
sql/sql_connect.h
sql/sql_const.h
sql/sql_db.h
sql/sql_delete.h
sql/sql_derived.h
sql/sql_do.h
sql/sql_handler.h
sql/sql_help.h
sql/sql_insert.h
sql/sql_load.h
sql/sql_locale.h
sql/sql_manager.h
sql/sql_parse.h
sql/sql_rename.h
sql/sql_table.h
sql/sql_tablespace.h
sql/sql_test.h
sql/sql_time.h
sql/sql_union.h
sql/sql_update.h
sql/strfunc.h
sql/thr_malloc.h
renamed:
sql/mysql_priv.h => sql/sql_priv.h
sql/time.cc => sql/sql_time.cc
modified:
.bzrignore
client/Makefile.am
client/client_priv.h
client/mysqlbinlog.cc
include/Makefile.am
include/atomic/rwlock.h
include/hash.h
include/keycache.h
include/m_ctype.h
include/m_string.h
include/my_bitmap.h
include/my_dbug.h
include/my_dir.h
include/my_getopt.h
include/my_global.h
include/my_handler.h
include/my_net.h
include/my_pthread.h
include/my_sys.h
include/my_tree.h
include/mysql/psi/mysql_file.h
include/mysql/psi/mysql_thread.h
include/mysys_err.h
include/queues.h
include/violite.h
libmysql/Makefile.am
libmysqld/CMakeLists.txt
libmysqld/Makefile.am
libmysqld/emb_qcache.cc
libmysqld/emb_qcache.h
libmysqld/libmysqld.c
mysql-test/collections/default.experimental
plugin/daemon_example/daemon_example.cc
plugin/semisync/semisync.h
plugin/semisync/semisync_master_plugin.cc
plugin/semisync/semisync_slave.cc
plugin/semisync/semisync_slave_plugin.cc
sql/CMakeLists.txt
sql/Makefile.am
sql/backup/api_types.h
sql/backup/backup_aux.h
sql/backup/backup_engine.h
sql/backup/backup_info.cc
sql/backup/backup_test.cc
sql/backup/be_default.cc
sql/backup/be_nodata.cc
sql/backup/be_snapshot.cc
sql/backup/be_thread.cc
sql/backup/buffer_iterator.cc
sql/backup/buffer_iterator.h
sql/backup/data_backup.cc
sql/backup/error.h
sql/backup/image_info.cc
sql/backup/image_info.h
sql/backup/kernel.cc
sql/backup/logger.cc
sql/backup/logger.h
sql/backup/restore_info.cc
sql/backup/restore_info.h
sql/backup/stream.cc
sql/backup/stream.h
sql/bml.cc
sql/bml.h
sql/debug_sync.cc
sql/derror.cc
sql/des_key_file.cc
sql/discover.cc
sql/event_data_objects.cc
sql/event_data_objects.h
sql/event_db_repository.cc
sql/event_parse_data.cc
sql/event_parse_data.h
sql/event_queue.cc
sql/event_queue.h
sql/event_scheduler.cc
sql/event_scheduler.h
sql/events.cc
sql/events.h
sql/field.cc
sql/field.h
sql/field_conv.cc
sql/filesort.cc
sql/frm_crypt.cc
sql/gstream.cc
sql/gstream.h
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.h
sql/ha_ndbcluster_binlog.cc
sql/ha_ndbcluster_binlog.h
sql/ha_ndbcluster_cond.cc
sql/ha_ndbcluster_cond.h
sql/ha_ndbcluster_connection.cc
sql/ha_partition.cc
sql/ha_partition.h
sql/handler.cc
sql/handler.h
sql/hash_filo.cc
sql/hash_filo.h
sql/hostname.cc
sql/init.cc
sql/item.cc
sql/item.h
sql/item_buff.cc
sql/item_cmpfunc.cc
sql/item_cmpfunc.h
sql/item_create.cc
sql/item_create.h
sql/item_func.cc
sql/item_func.h
sql/item_geofunc.cc
sql/item_row.cc
sql/item_strfunc.cc
sql/item_strfunc.h
sql/item_subselect.cc
sql/item_subselect.h
sql/item_sum.cc
sql/item_sum.h
sql/item_timefunc.cc
sql/item_timefunc.h
sql/item_xmlfunc.cc
sql/key.cc
sql/keycaches.h
sql/lock.cc
sql/log.cc
sql/log.h
sql/log_event.cc
sql/log_event.h
sql/log_event_old.cc
sql/mf_iocache.cc
sql/my_decimal.cc
sql/my_decimal.h
sql/mysqld.cc
sql/net_serv.cc
sql/opt_range.cc
sql/opt_range.h
sql/opt_sum.cc
sql/parse_file.cc
sql/parse_file.h
sql/partition_element.h
sql/partition_info.cc
sql/password.c
sql/procedure.cc
sql/procedure.h
sql/protocol.cc
sql/protocol.h
sql/records.cc
sql/repl_failsafe.cc
sql/rpl_filter.cc
sql/rpl_filter.h
sql/rpl_handler.cc
sql/rpl_handler.h
sql/rpl_info.cc
sql/rpl_info.h
sql/rpl_injector.cc
sql/rpl_injector.h
sql/rpl_mi.cc
sql/rpl_mi.h
sql/rpl_mi_file.cc
sql/rpl_record.cc
sql/rpl_record.h
sql/rpl_record_old.cc
sql/rpl_record_old.h
sql/rpl_reporting.cc
sql/rpl_reporting.h
sql/rpl_rli.cc
sql/rpl_rli.h
sql/rpl_rli_file.cc
sql/rpl_tblmap.cc
sql/rpl_tblmap.h
sql/rpl_utility.cc
sql/rpl_utility.h
sql/scheduler.cc
sql/set_var.cc
sql/set_var.h
sql/si_logs.cc
sql/si_logs.h
sql/si_objects.cc
sql/si_objects.h
sql/slave.cc
sql/slave.h
sql/sp.cc
sql/sp.h
sql/sp_cache.cc
sql/sp_cache.h
sql/sp_head.cc
sql/sp_head.h
sql/sp_pcontext.cc
sql/sp_pcontext.h
sql/sp_rcontext.cc
sql/sp_rcontext.h
sql/spatial.cc
sql/spatial.h
sql/sql_acl.cc
sql/sql_acl.h
sql/sql_analyse.cc
sql/sql_analyse.h
sql/sql_audit.cc
sql/sql_audit.h
sql/sql_base.cc
sql/sql_binlog.cc
sql/sql_bitmap.h
sql/sql_cache.cc
sql/sql_cache.h
sql/sql_class.cc
sql/sql_class.h
sql/sql_client.cc
sql/sql_connect.cc
sql/sql_crypt.cc
sql/sql_crypt.h
sql/sql_cursor.cc
sql/sql_cursor.h
sql/sql_db.cc
sql/sql_delete.cc
sql/sql_derived.cc
sql/sql_do.cc
sql/sql_error.cc
sql/sql_error.h
sql/sql_handler.cc
sql/sql_help.cc
sql/sql_insert.cc
sql/sql_join_cache.cc
sql/sql_lex.cc
sql/sql_lex.h
sql/sql_list.cc
sql/sql_list.h
sql/sql_load.cc
sql/sql_locale.cc
sql/sql_manager.cc
sql/sql_map.cc
sql/sql_map.h
sql/sql_olap.cc
sql/sql_parse.cc
sql/sql_partition.cc
sql/sql_partition.h
sql/sql_plugin.cc
sql/sql_plugin.h
sql/sql_prepare.cc
sql/sql_profile.cc
sql/sql_profile.h
sql/sql_rename.cc
sql/sql_repl.cc
sql/sql_repl.h
sql/sql_select.cc
sql/sql_select.h
sql/sql_servers.cc
sql/sql_servers.h
sql/sql_show.cc
sql/sql_show.h
sql/sql_signal.cc
sql/sql_sort.h
sql/sql_string.h
sql/sql_table.cc
sql/sql_tablespace.cc
sql/sql_test.cc
sql/sql_trigger.cc
sql/sql_trigger.h
sql/sql_udf.cc
sql/sql_union.cc
sql/sql_update.cc
sql/sql_view.cc
sql/sql_view.h
sql/sql_yacc.yy
sql/strfunc.cc
sql/structs.h
sql/sys_vars.cc
sql/sys_vars.h
sql/sys_vars_shared.h
sql/table.cc
sql/table.h
sql/thr_malloc.cc
sql/transaction.cc
sql/tztime.cc
sql/tztime.h
sql/uniques.cc
sql/unireg.cc
sql/unireg.h
storage/archive/ha_archive.cc
storage/blackhole/ha_blackhole.cc
storage/blackhole/ha_blackhole.h
storage/csv/ha_tina.cc
storage/csv/transparent_file.cc
storage/example/ha_example.cc
storage/example/ha_example.h
storage/federated/ha_federated.cc
storage/heap/ha_heap.cc
storage/heap/ha_heap.h
storage/ibmdb2i/db2i_charsetSupport.h
storage/ibmdb2i/db2i_collationSupport.h
storage/ibmdb2i/db2i_conversion.cc
storage/ibmdb2i/db2i_errors.cc
storage/ibmdb2i/db2i_ileBridge.h
storage/ibmdb2i/db2i_ioBuffers.h
storage/ibmdb2i/ha_ibmdb2i.cc
storage/innobase/handler/ha_innodb.cc
storage/myisam/ha_myisam.cc
storage/myisam/ha_myisam.h
storage/myisam/myisam_backup_engine.cc
storage/myisammrg/ha_myisammrg.cc
storage/perfschema/ha_perfschema.cc
storage/perfschema/ha_perfschema.h
storage/perfschema/pfs.cc
storage/perfschema/pfs.h
storage/perfschema/pfs_check.cc
storage/perfschema/pfs_column_values.cc
storage/perfschema/pfs_column_values.h
storage/perfschema/pfs_engine_table.cc
storage/perfschema/pfs_engine_table.h
storage/perfschema/pfs_instr.cc
storage/perfschema/pfs_instr.h
storage/perfschema/pfs_instr_class.h
storage/perfschema/pfs_server.cc
storage/perfschema/table_all_instr.cc
storage/perfschema/table_events_waits.cc
storage/perfschema/table_events_waits_summary.cc
storage/perfschema/table_file_instances.cc
storage/perfschema/table_file_summary.cc
storage/perfschema/table_performance_timers.cc
storage/perfschema/table_processlist.cc
storage/perfschema/table_setup_consumers.cc
storage/perfschema/table_setup_instruments.cc
storage/perfschema/table_setup_objects.cc
storage/perfschema/table_setup_timers.cc
storage/perfschema/table_sync_instances.cc
storage/perfschema/unittest/pfs-t.cc
storage/perfschema/unittest/pfs_instr-oom-t.cc
storage/perfschema/unittest/pfs_instr-t.cc
storage/perfschema/unittest/pfs_instr_class-oom-t.cc
storage/perfschema/unittest/pfs_instr_class-t.cc
storage/perfschema/unittest/pfs_timer-t.cc
storage/perfschema/unittest/stub_print_error.h
sql/sql_priv.h
sql/sql_time.cc
=== modified file '.bzrignore'
--- a/.bzrignore 2010-03-15 20:28:40 +0000
+++ b/.bzrignore 2010-04-08 10:50:40 +0000
@@ -100,6 +100,7 @@ BitKeeper/log
BitKeeper/etc/SCCS
CMakeFiles
CMakeFiles/*
+CTestTestfile.cmake
COPYING
COPYING.LIB
Docs/#manual.texi#
@@ -345,6 +346,7 @@ client/rpl_tblmap.cc
client/rpl_utility.h
client/rpl_utility.cc
client/select_test
+client/sql_const.h
client/sql_string.cpp
client/ssl_test
client/thimble
@@ -685,7 +687,7 @@ libmysqld/stacktrace.c
libmysqld/strfunc.cc
libmysqld/table.cc
libmysqld/thr_malloc.cc
-libmysqld/time.cc
+libmysqld/sql_time.cc
libmysqld/tztime.cc
libmysqld/uniques.cc
libmysqld/unireg.cc
@@ -905,7 +907,7 @@ mysql-test/var/*
mysql-test/windows_sys_vars.inc
mysql.kdevprj
mysql.proj
-mysql_priv.h
+sql_priv.h
mysqlbinlog/*.ds?
mysqlbinlog/*.vcproj
mysqlcheck/*.ds?
=== modified file 'client/Makefile.am'
--- a/client/Makefile.am 2010-02-10 21:11:06 +0000
+++ b/client/Makefile.am 2010-04-08 10:50:40 +0000
@@ -111,13 +111,13 @@ DEFS = -DMYSQL_CLIENT_NO_THREADS \
-DDEFAULT_MYSQL_HOME="\"$(prefix)\"" \
-DMYSQL_DATADIR="\"$(localstatedir)\""
-sql_src=log_event.h mysql_priv.h rpl_constants.h \
+sql_src=log_event.h sql_priv.h rpl_constants.h \
rpl_tblmap.h rpl_tblmap.cc \
log_event.cc my_decimal.h my_decimal.cc \
log_event_old.h log_event_old.cc \
rpl_record_old.h rpl_record_old.cc \
rpl_utility.h rpl_utility.cc \
- transaction.h
+ transaction.h sql_const.h
strings_src=decimal.c dtoa.c
backup_src=stream_v1.h stream_v1_services.h
=== modified file 'client/client_priv.h'
--- a/client/client_priv.h 2010-03-09 09:54:10 +0000
+++ b/client/client_priv.h 2010-04-08 10:50:40 +0000
@@ -19,7 +19,6 @@
#include <my_sys.h>
#include <m_string.h>
#include <mysql.h>
-#include <mysql_embed.h>
#include <errmsg.h>
#include <my_getopt.h>
=== modified file 'client/mysqlbinlog.cc'
--- a/client/mysqlbinlog.cc 2010-03-25 09:02:07 +0000
+++ b/client/mysqlbinlog.cc 2010-04-09 08:22:10 +0000
@@ -31,7 +31,8 @@
#include "client_priv.h"
#include <my_time.h>
/* That one is necessary for defines of OPTION_NO_FOREIGN_KEY_CHECKS etc */
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#include "log_event.h"
#include "sql_common.h"
=== modified file 'include/Makefile.am'
--- a/include/Makefile.am 2010-01-28 00:38:13 +0000
+++ b/include/Makefile.am 2010-04-08 10:50:40 +0000
@@ -33,7 +33,7 @@ pkginclude_HEADERS = $(HEADERS_ABI) my_d
m_ctype.h my_attribute.h $(HEADERS_GEN_CONFIGURE) \
$(HEADERS_GEN_MAKE) probes_mysql.h probes_mysql_nodtrace.h
noinst_HEADERS = config-win.h config-netware.h lf.h my_bit.h \
- heap.h myisamchk.h my_bitmap.h my_uctype.h \
+ heap.h myisamchk.h my_bitmap.h my_uctype.h password.h \
myisam.h myisampack.h myisammrg.h ft_global.h\
mysys_err.h my_base.h help_start.h help_end.h \
my_nosys.h my_alarm.h queues.h rijndael.h sha1.h sha2.h \
=== modified file 'include/atomic/rwlock.h'
--- a/include/atomic/rwlock.h 2009-12-14 16:28:50 +0000
+++ b/include/atomic/rwlock.h 2010-04-08 13:15:12 +0000
@@ -16,6 +16,8 @@
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_pthread.h"
+
#define MY_ATOMIC_MODE_RWLOCKS 1
#ifdef MY_ATOMIC_MODE_DUMMY
=== modified file 'include/hash.h'
--- a/include/hash.h 2009-12-14 16:28:50 +0000
+++ b/include/hash.h 2010-04-08 10:50:40 +0000
@@ -17,6 +17,21 @@
#ifndef _hash_h
#define _hash_h
+
+#include "my_global.h" /* uchar */
+#include "my_sys.h" /* DYNAMIC_ARRAY */
+
+/*
+ This forward declaration is used from C files where the real
+ definition is included before. Since C does not allow repeated
+ typedef declarations, even when identical, the definition may not be
+ repeated.
+*/
+#ifndef CHARSET_INFO_DEFINED
+#define CHARSET_INFO_DEFINED
+typedef struct charset_info_st CHARSET_INFO;
+#endif /* CHARSET_INFO_DEFINED */
+
#ifdef __cplusplus
extern "C" {
#endif
=== modified file 'include/keycache.h'
--- a/include/keycache.h 2010-01-28 00:38:13 +0000
+++ b/include/keycache.h 2010-04-08 10:50:40 +0000
@@ -20,6 +20,9 @@
#ifndef _keycache_h
#define _keycache_h
+
+#include "my_sys.h" /* flush_type */
+
C_MODE_START
/* declare structures that is used by st_key_cache */
=== modified file 'include/m_ctype.h'
--- a/include/m_ctype.h 2010-03-04 13:25:46 +0000
+++ b/include/m_ctype.h 2010-04-08 10:50:40 +0000
@@ -15,13 +15,13 @@
/*
A better inplementation of the UNIX ctype(3) library.
- Notes: my_global.h should be included before ctype.h
*/
#ifndef _m_ctype_h
#define _m_ctype_h
#include <my_attribute.h>
+#include "my_global.h" /* uint16, uchar */
#ifdef __cplusplus
extern "C" {
@@ -299,6 +299,12 @@ extern MY_CHARSET_HANDLER my_charset_8bi
extern MY_CHARSET_HANDLER my_charset_ucs2_handler;
+/*
+ We define this CHARSET_INFO_DEFINED here to prevent a repeat of the
+ typedef in hash.c, which will cause a compiler error.
+*/
+#define CHARSET_INFO_DEFINED
+
/* See strings/CHARSET_INFO.txt about information on this structure */
typedef struct charset_info_st
{
=== modified file 'include/m_string.h'
--- a/include/m_string.h 2010-02-04 10:55:39 +0000
+++ b/include/m_string.h 2010-04-08 10:50:40 +0000
@@ -20,6 +20,9 @@
#ifndef _m_string_h
#define _m_string_h
+
+#include "my_global.h" /* HAVE_* */
+
#ifndef __USE_GNU
#define __USE_GNU /* We want to use stpcpy */
#endif
@@ -276,13 +279,6 @@ extern ulonglong strtoull(const char *st
#endif
#define longlong2str(A,B,C) ll2str((A),(B),(C),1)
-/* my_vsnprintf.c */
-
-extern size_t my_vsnprintf(char *str, size_t n,
- const char *format, va_list ap);
-extern size_t my_snprintf(char *to, size_t n, const char *fmt, ...)
- ATTRIBUTE_FORMAT(printf, 3, 4);
-
#if defined(__cplusplus)
}
#endif
@@ -390,4 +386,10 @@ static inline const uchar *skip_trailing
#define TRASH(A,B) /* nothing */
#endif /* SAFEMALLOC */
+static inline void lex_string_set(LEX_STRING *lex_str, const char *c_str)
+{
+ lex_str->str= (char *) c_str;
+ lex_str->length= strlen(c_str);
+}
+
#endif /* _m_string_h */
=== modified file 'include/my_bitmap.h'
--- a/include/my_bitmap.h 2009-12-11 06:27:10 +0000
+++ b/include/my_bitmap.h 2010-04-08 10:50:40 +0000
@@ -19,6 +19,7 @@
#define MY_BIT_NONE (~(uint) 0)
#include <m_string.h>
+#include <my_pthread.h>
typedef uint32 my_bitmap_map;
=== modified file 'include/my_dbug.h'
--- a/include/my_dbug.h 2009-12-02 14:52:07 +0000
+++ b/include/my_dbug.h 2010-04-08 10:50:40 +0000
@@ -145,7 +145,23 @@ extern const char* _db_get_func_(void);
#define DBUG_CRASH_VOID_RETURN do { return; } while(0)
#endif
-#ifdef __cplusplus
+
+#ifdef EXTRA_DEBUG
+/**
+ Sync points allow us to force the server to reach a certain line of code
+ and block there until the client tells the server it is ok to go on.
+ The client tells the server to block with SELECT GET_LOCK()
+ and unblocks it with SELECT RELEASE_LOCK(). Used for debugging difficult
+ concurrency problems
+*/
+#define DBUG_SYNC_POINT(lock_name,lock_timeout) \
+ debug_sync_point(lock_name,lock_timeout)
+void debug_sync_point(const char* lock_name, uint lock_timeout);
+#else
+#define DBUG_SYNC_POINT(lock_name,lock_timeout)
+#endif /* EXTRA_DEBUG */
+
+#ifdef __cplusplus
}
#endif
#endif
=== modified file 'include/my_dir.h'
--- a/include/my_dir.h 2009-12-24 16:38:19 +0000
+++ b/include/my_dir.h 2010-04-08 10:50:40 +0000
@@ -13,17 +13,17 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#ifndef _my_dir_h
-#define _my_dir_h
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#ifndef MY_DIR_H
#define MY_DIR_H
+#include "my_global.h"
+
#include <sys/stat.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Defines for my_dir and my_stat */
#define MY_S_IFMT S_IFMT /* type of file */
@@ -104,9 +104,9 @@ extern my_bool test_if_directory(const c
extern my_bool test_if_real_directory(const char* path);
extern my_bool test_if_writable_directory(const char *path);
-#endif /* MY_DIR_H */
-
#ifdef __cplusplus
}
#endif
-#endif
+
+#endif /* MY_DIR_H */
+
=== modified file 'include/my_getopt.h'
--- a/include/my_getopt.h 2009-12-22 09:35:56 +0000
+++ b/include/my_getopt.h 2010-03-31 14:05:33 +0000
@@ -16,6 +16,8 @@
#ifndef _my_getopt_h
#define _my_getopt_h
+#include "my_sys.h" /* loglevel */
+
C_MODE_START
#define GET_NO_ARG 1
=== modified file 'include/my_global.h'
--- a/include/my_global.h 2010-02-25 15:50:31 +0000
+++ b/include/my_global.h 2010-04-09 08:22:10 +0000
@@ -1226,6 +1226,12 @@ typedef unsigned long my_off_t;
#endif /*_WIN32*/
#define MY_FILEPOS_ERROR (~(my_off_t) 0)
+/*
+ TODO Convert these to use Bitmap class.
+ */
+typedef ulonglong table_map; /* Used for table bits in join */
+typedef ulong nesting_map; /* Used for flags of nesting constructs */
+
#if defined(__WIN__)
#define socket_errno WSAGetLastError()
#define SOCKET_EINTR WSAEINTR
@@ -1677,7 +1683,13 @@ inline void operator delete[](void*, vo
#if !defined(max)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
-#endif
+#endif
+
+#define x_free(A) \
+ do { my_free((uchar*)(A), MYF(MY_WME|MY_FAE|MY_ALLOW_ZERO_PTR)); } while (0)
+#define safeFree(X) \
+ do { if (X) { my_free((uchar*)(X), MYF(0)); (X) = NULL; } } while (0)
+
/*
Only Linux is known to need an explicit sync of the directory to make sure a
file creation/deletion/renaming in(from,to) this directory durable.
@@ -1767,4 +1779,20 @@ static inline double rint(double x)
#endif
#endif
+/* Defines that are unique to the embedded version of MySQL */
+
+#ifdef EMBEDDED_LIBRARY
+
+/* Things we don't need in the embedded version of MySQL */
+/* TODO HF add #undef HAVE_VIO if we don't want client in embedded library */
+
+#undef HAVE_PSTACK /* No stacktrace */
+#undef HAVE_OPENSSL
+#undef HAVE_SMEM /* No shared memory */
+#undef HAVE_NDBCLUSTER_DB /* No NDB cluster */
+
+#define DONT_USE_RAID
+
+#endif /* EMBEDDED_LIBRARY */
+
#endif /* my_global_h */
=== modified file 'include/my_handler.h'
--- a/include/my_handler.h 2009-10-15 11:12:52 +0000
+++ b/include/my_handler.h 2010-04-08 10:50:40 +0000
@@ -24,6 +24,8 @@
extern "C" {
#endif
+#include "m_ctype.h" /* CHARSET_INFO */
+
/*
There is a hard limit for the maximum number of keys as there are only
8 bits in the index file header for the number of keys in a table.
=== modified file 'include/my_net.h'
--- a/include/my_net.h 2009-11-25 10:55:53 +0000
+++ b/include/my_net.h 2010-04-08 10:50:40 +0000
@@ -24,6 +24,9 @@
#ifndef _my_net_h
#define _my_net_h
+
+#include "my_global.h" /* C_MODE_START, C_MODE_END */
+
C_MODE_START
#include <errno.h>
=== modified file 'include/my_pthread.h'
--- a/include/my_pthread.h 2010-03-01 18:08:17 +0000
+++ b/include/my_pthread.h 2010-04-08 10:50:40 +0000
@@ -18,6 +18,8 @@
#ifndef _my_pthread_h
#define _my_pthread_h
+#include "my_global.h" /* myf */
+
#ifndef ETIME
#define ETIME ETIMEDOUT /* For FreeBSD */
#endif
=== modified file 'include/my_sys.h'
--- a/include/my_sys.h 2010-03-25 09:02:07 +0000
+++ b/include/my_sys.h 2010-04-08 15:48:00 +0000
@@ -20,6 +20,9 @@
#ifndef _my_sys_h
#define _my_sys_h
+
+#include "my_global.h" /* C_MODE_START, C_MODE_END */
+
C_MODE_START
#ifdef HAVE_AIOWAIT
@@ -1086,6 +1089,7 @@ void netware_reg_user(const char *ip, co
const char *application);
#endif
+#include <my_pthread.h>
#include <mysql/psi/psi.h>
#ifdef HAVE_PSI_INTERFACE
=== modified file 'include/my_tree.h'
--- a/include/my_tree.h 2008-05-29 15:33:33 +0000
+++ b/include/my_tree.h 2010-04-08 10:50:40 +0000
@@ -20,6 +20,7 @@ extern "C" {
#endif
#include "my_base.h" /* get 'enum ha_rkey_function' */
+#include "my_alloc.h" /* MEM_ROOT */
/* Worst case tree is half full. This gives use 2^(MAX_TREE_HEIGHT/2) leafs */
#define MAX_TREE_HEIGHT 64
=== added file 'include/mysql/innodb_priv.h'
--- a/include/mysql/innodb_priv.h 1970-01-01 00:00:00 +0000
+++ b/include/mysql/innodb_priv.h 2010-04-09 08:22:10 +0000
@@ -0,0 +1,37 @@
+/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+
+ 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 INNODB_PRIV_INCLUDED
+#define INNODB_PRIV_INCLUDED
+
+/** @file Declaring server-internal functions that are used by InnoDB. */
+
+#include <my_global.h>
+#include <sql_priv.h>
+
+class THD;
+typedef struct charset_info_st CHARSET_INFO;
+
+uint filename_to_tablename(const char *from, char *to, uint to_length);
+int get_quote_char_for_identifier(THD *thd, const char *name, uint length);
+bool check_global_access(THD *thd, ulong want_access);
+
+uint strconvert(CHARSET_INFO *from_cs, const char *from,
+ CHARSET_INFO *to_cs, char *to, uint to_length,
+ uint *errors);
+void sql_print_error(const char *format, ...);
+void sql_print_warning(const char *format, ...);
+
+#endif /* INNODB_PRIV_INCLUDED */
=== modified file 'include/mysql/psi/mysql_file.h'
--- a/include/mysql/psi/mysql_file.h 2009-12-01 00:49:15 +0000
+++ b/include/mysql/psi/mysql_file.h 2010-04-08 17:42:14 +0000
@@ -20,6 +20,8 @@
#include <string.h>
/* For MY_STAT */
#include <my_dir.h>
+/* For my_chsize */
+#include <my_sys.h>
/**
@file mysql/psi/mysql_file.h
@@ -37,6 +39,7 @@
the dependency on my_sys already exists.
*/
+#include "my_pthread.h"
#include "mysql/psi/psi.h"
/**
=== modified file 'include/mysql/psi/mysql_thread.h'
--- a/include/mysql/psi/mysql_thread.h 2010-03-09 22:03:08 +0000
+++ b/include/mysql/psi/mysql_thread.h 2010-04-08 17:42:14 +0000
@@ -54,6 +54,7 @@
This causes complexity with '#ifdef'-ery that can't be avoided.
*/
+#include "my_pthread.h"
#include "mysql/psi/psi.h"
/**
=== modified file 'include/mysys_err.h'
--- a/include/mysys_err.h 2008-01-03 07:45:46 +0000
+++ b/include/mysys_err.h 2010-04-08 10:50:40 +0000
@@ -16,6 +16,9 @@
#ifndef _mysys_err_h
#define _mysys_err_h
#ifdef __cplusplus
+
+#include "my_global.h" /* NEAR */
+
extern "C" {
#endif
=== added file 'include/password.h'
--- a/include/password.h 1970-01-01 00:00:00 +0000
+++ b/include/password.h 2010-03-31 14:05:33 +0000
@@ -0,0 +1,32 @@
+/* Copyright 2006-2008 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef PASSWORD_INCLUDED
+#define PASSWORD_INCLUDED
+
+#include "my_global.h"
+
+C_MODE_START
+
+void my_make_scrambled_password_323(char *to, const char *password,
+ size_t pass_len);
+void my_make_scrambled_password(char *to, const char *password,
+ size_t pass_len);
+
+void hash_password(ulong *result, const char *password, uint password_len);
+
+C_MODE_END
+
+#endif /* PASSWORD_INCLUDED */
=== modified file 'include/queues.h'
--- a/include/queues.h 2007-11-14 18:20:31 +0000
+++ b/include/queues.h 2010-03-31 14:05:33 +0000
@@ -22,6 +22,9 @@
#ifndef _queues_h
#define _queues_h
+
+#include "my_global.h" /* uchar */
+
#ifdef __cplusplus
extern "C" {
#endif
=== modified file 'include/violite.h'
--- a/include/violite.h 2009-12-15 06:57:50 +0000
+++ b/include/violite.h 2010-04-08 10:50:40 +0000
@@ -30,6 +30,10 @@
extern "C" {
#endif /* __cplusplus */
+#ifdef __cplusplus
+typedef struct st_vio Vio;
+#endif /* __cplusplus */
+
enum enum_vio_type
{
VIO_CLOSED, VIO_TYPE_TCPIP, VIO_TYPE_SOCKET, VIO_TYPE_NAMEDPIPE,
=== modified file 'libmysql/Makefile.am'
--- a/libmysql/Makefile.am 2009-12-01 01:33:55 +0000
+++ b/libmysql/Makefile.am 2010-04-08 10:50:40 +0000
@@ -73,7 +73,7 @@ link_sources:
#
# A list of needed headers collected from the deps information 000213
nh = my_global.h config-win32.h dbug.h errmsg.h \
- m_ctype.h m_string.h \
+ m_ctype.h m_string.h password.h \
my_alarm.h my_config.h my_dir.h my_list.h my_net.h my_sys.h \
mysql.h mysql_com.h mysql_version.h mysqld_error.h \
mysys_err.h my_pthread.h thr_alarm.h violite.h hash.h \
=== modified file 'libmysqld/CMakeLists.txt'
--- a/libmysqld/CMakeLists.txt 2010-03-17 19:59:27 +0000
+++ b/libmysqld/CMakeLists.txt 2010-04-08 10:50:40 +0000
@@ -77,7 +77,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc l
../sql/sql_trigger.cc ../sql/sql_udf.cc ../sql/sql_union.cc
../sql/sql_update.cc ../sql/sql_view.cc ../sql/sql_profile.cc
../sql/strfunc.cc ../sql/table.cc ../sql/thr_malloc.cc
- ../sql/time.cc ../sql/tztime.cc ../sql/uniques.cc ../sql/unireg.cc
+ ../sql/sql_time.cc ../sql/tztime.cc ../sql/uniques.cc ../sql/unireg.cc
../sql/partition_info.cc ../sql/sql_connect.cc
../sql/scheduler.cc ../sql/sql_audit.cc
../sql/bml.cc ../sql/si_objects.cc
=== modified file 'libmysqld/Makefile.am'
--- a/libmysqld/Makefile.am 2010-02-24 16:27:03 +0000
+++ b/libmysqld/Makefile.am 2010-04-08 10:50:40 +0000
@@ -74,7 +74,7 @@ sqlsources = derror.cc field.cc field_co
sql_prepare.cc sql_derived.cc sql_rename.cc \
sql_select.cc sql_do.cc sql_show.cc set_var.cc sys_vars.cc \
sql_string.cc sql_table.cc sql_test.cc sql_udf.cc \
- sql_update.cc sql_yacc.cc table.cc thr_malloc.cc time.cc \
+ sql_update.cc sql_yacc.cc table.cc thr_malloc.cc sql_time.cc \
unireg.cc uniques.cc sql_union.cc hash_filo.cc \
spatial.cc gstream.cc sql_help.cc tztime.cc sql_cursor.cc \
sp_head.cc sp_pcontext.cc sp.cc sp_cache.cc sp_rcontext.cc \
=== modified file 'libmysqld/emb_qcache.cc'
--- a/libmysqld/emb_qcache.cc 2009-09-25 14:15:30 +0000
+++ b/libmysqld/emb_qcache.cc 2010-04-09 08:22:10 +0000
@@ -13,11 +13,14 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "mysql_priv.h"
+#include "my_global.h" // HAVE_*
+#include "sql_priv.h"
+
#ifdef HAVE_QUERY_CACHE
#include <mysql.h>
#include "emb_qcache.h"
#include "embedded_priv.h"
+#include "sql_class.h" // THD
void Querycache_stream::store_uchar(uchar c)
{
=== modified file 'libmysqld/emb_qcache.h'
--- a/libmysqld/emb_qcache.h 2009-10-23 06:24:37 +0000
+++ b/libmysqld/emb_qcache.h 2010-04-08 10:50:40 +0000
@@ -13,6 +13,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include "sql_cache.h" /* Query_cache_block */
+
class Querycache_stream
{
uchar *cur_data;
=== modified file 'libmysqld/libmysqld.c'
--- a/libmysqld/libmysqld.c 2009-11-02 15:11:43 +0000
+++ b/libmysqld/libmysqld.c 2010-04-08 10:50:40 +0000
@@ -15,7 +15,6 @@
#include <my_global.h>
#include <mysql.h>
-#include <mysql_embed.h>
#include <mysqld_error.h>
#include <my_pthread.h>
#include "embedded_priv.h"
=== modified file 'mysql-test/collections/default.experimental'
--- a/mysql-test/collections/default.experimental 2010-03-25 09:02:07 +0000
+++ b/mysql-test/collections/default.experimental 2010-04-10 15:35:01 +0000
@@ -21,6 +21,7 @@ main.mysqlbinlog_row_myisam @solaris
main.outfile_loaddata @solaris # Bug#46895 2010-01-20 alik Test "outfile_loaddata" fails (reproducible)
main.plugin* @solaris # Bug#47146 Linking problem with example plugin when dtrace enabled
main.plugin_notembedded # Bug#47662 2009-09-27 alik main.plugin_notembedded fails sporadically in pb2
+main.query_cache_debug @linux # Bug#52356 2010-04-10 alik query_cache_debug fails on Linux
main.signal_demo3 @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
main.sp @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
main.truncate_coverage # Bug#46785 2009-08-18 alik main.truncate_coverage fails sporadically
=== modified file 'plugin/daemon_example/daemon_example.cc'
--- a/plugin/daemon_example/daemon_example.cc 2007-06-27 14:49:12 +0000
+++ b/plugin/daemon_example/daemon_example.cc 2010-04-09 08:22:10 +0000
@@ -13,13 +13,17 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
-#include <mysql_priv.h>
+#include <my_global.h>
+#include <sql_priv.h>
#include <stdlib.h>
#include <ctype.h>
#include <mysql_version.h>
#include <mysql/plugin.h>
-#include <my_global.h>
#include <my_dir.h>
+#include "my_pthread.h" // pthread_handler_t
+#include "my_sys.h" // my_write, my_malloc
+#include "m_string.h" // strlen
+#include "sql_plugin.h" // st_plugin_int
/*
Disable __attribute__() on non-gcc compilers.
=== modified file 'plugin/semisync/semisync.h'
--- a/plugin/semisync/semisync.h 2009-12-08 07:39:23 +0000
+++ b/plugin/semisync/semisync.h 2010-04-09 08:22:10 +0000
@@ -20,11 +20,13 @@
#define MYSQL_SERVER
#define HAVE_REPLICATION
-#include <mysql_priv.h>
#include <my_global.h>
+#include <sql_priv.h>
+#include "unireg.h"
#include <my_pthread.h>
#include <mysql/plugin.h>
#include <replication.h>
+#include "log.h" /* sql_print_information */
typedef struct st_mysql_show_var SHOW_VAR;
typedef struct st_mysql_sys_var SYS_VAR;
=== modified file 'plugin/semisync/semisync_master_plugin.cc'
--- a/plugin/semisync/semisync_master_plugin.cc 2009-12-11 09:01:00 +0000
+++ b/plugin/semisync/semisync_master_plugin.cc 2010-04-08 10:50:40 +0000
@@ -16,6 +16,7 @@
#include "semisync_master.h"
+#include "sql_class.h" // THD
ReplSemiSyncMaster repl_semisync;
=== modified file 'plugin/semisync/semisync_slave.cc'
--- a/plugin/semisync/semisync_slave.cc 2009-12-08 07:39:23 +0000
+++ b/plugin/semisync/semisync_slave.cc 2010-04-08 10:50:40 +0000
@@ -15,6 +15,7 @@
#include "semisync_slave.h"
+#include <mysql.h>
char rpl_semi_sync_slave_enabled;
char rpl_semi_sync_slave_status= 0;
=== modified file 'plugin/semisync/semisync_slave_plugin.cc'
--- a/plugin/semisync/semisync_slave_plugin.cc 2009-12-08 07:39:23 +0000
+++ b/plugin/semisync/semisync_slave_plugin.cc 2010-04-08 10:50:40 +0000
@@ -16,6 +16,7 @@
#include "semisync_slave.h"
+#include <mysql.h>
ReplSemiSyncSlave repl_semisync;
=== modified file 'sql/CMakeLists.txt'
--- a/sql/CMakeLists.txt 2010-03-03 14:52:07 +0000
+++ b/sql/CMakeLists.txt 2010-04-08 10:50:40 +0000
@@ -67,7 +67,7 @@ SET (SQL_SOURCE
sql_repl.cc sql_select.cc sql_show.cc sql_state.c sql_string.cc
sql_table.cc sql_test.cc sql_trigger.cc sql_udf.cc sql_union.cc
sql_update.cc sql_view.cc strfunc.cc table.cc thr_malloc.cc
- time.cc tztime.cc uniques.cc unireg.cc item_xmlfunc.cc
+ sql_time.cc tztime.cc uniques.cc unireg.cc item_xmlfunc.cc
rpl_tblmap.cc sql_binlog.cc event_scheduler.cc event_data_objects.cc
event_queue.cc event_db_repository.cc
sql_tablespace.cc events.cc ../sql-common/my_user.c
=== modified file 'sql/Makefile.am'
--- a/sql/Makefile.am 2010-02-16 23:13:24 +0000
+++ b/sql/Makefile.am 2010-04-08 10:50:40 +0000
@@ -87,11 +87,11 @@ noinst_HEADERS = item.h item_func.h item
item_strfunc.h item_timefunc.h \
item_xmlfunc.h sql_plugin_services.h \
item_create.h item_subselect.h item_row.h \
- mysql_priv.h item_geofunc.h sql_bitmap.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_error.h field.h handler.h mysqld_suffix.h \
- sql_profile.h \
+ sql_profile.h mysqld.h sql_help.h frm_crypt.h \
ha_ndbcluster.h ha_ndbcluster_cond.h \
ha_ndbcluster_binlog.h ha_ndbcluster_tables.h \
ha_ndbcluster_connection.h ha_ndbcluster_connection.h \
@@ -99,13 +99,20 @@ noinst_HEADERS = item.h item_func.h item
ha_partition.h rpl_constants.h \
debug_sync.h \
opt_range.h protocol.h rpl_tblmap.h rpl_utility.h \
- rpl_reporting.h \
+ rpl_reporting.h sql_locale.h sql_parse.h \
log.h sql_show.h rpl_info.h \
rpl_rli.h rpl_rli_file.h rpl_mi.h rpl_mi_file.h \
sql_select.h structs.h table.h sql_udf.h hash_filo.h \
- lex.h lex_symbol.h sql_acl.h sql_crypt.h \
+ lex.h lex_symbol.h sql_acl.h sql_crypt.h sql_base.h \
+ sql_table.h key.h lock.h thr_malloc.h strfunc.h \
+ sql_delete.h sql_insert.h sql_update.h sql_db.h \
+ sql_connect.h sql_rename.h sql_time.h sql_tablespace.h \
+ hostname.h sql_test.h records.h filesort.h \
+ sql_derived.h sql_load.h sql_handler.h init.h \
+ derror.h sql_union.h des_key_file.h sql_binlog.h \
+ discover.h sql_manager.h sql_do.h \
sql_repl.h slave.h rpl_filter.h rpl_injector.h \
- log_event.h rpl_record.h \
+ log_event.h rpl_record.h sql_const.h \
log_event_old.h rpl_record_old.h \
sql_sort.h sql_cache.h set_var.h sys_vars_shared.h \
spatial.h gstream.h client_settings.h tzfile.h \
@@ -145,7 +152,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.
unireg.cc des_key_file.cc \
log_event.cc rpl_record.cc \
log_event_old.cc rpl_record_old.cc \
- discover.cc time.cc opt_range.cc opt_sum.cc \
+ discover.cc sql_time.cc opt_range.cc opt_sum.cc \
records.cc filesort.cc handler.cc \
ha_partition.cc \
debug_sync.cc \
=== modified file 'sql/backup/api_types.h'
--- a/sql/backup/api_types.h 2009-12-15 19:23:11 +0000
+++ b/sql/backup/api_types.h 2010-04-08 10:50:40 +0000
@@ -18,6 +18,8 @@
class anyway.
*/
+#include "sql_string.h" /* stringcmp */
+
/// A null string external reference.
extern const String my_null_string;
=== modified file 'sql/backup/backup_aux.h'
--- a/sql/backup/backup_aux.h 2009-12-15 20:24:46 +0000
+++ b/sql/backup/backup_aux.h 2010-04-08 10:50:40 +0000
@@ -7,6 +7,11 @@
@brief Auxiliary declarations used in MySQL backup code.
*/
+#include "../sql_array.h" /* Dynamic_array */
+#include "../sql_plugin.h" /* st_plugin_int */
+#include "handler.h" /* handler */
+#include "table.h" /* TABLE_LIST */
+
/// Definition for storage engine reference type.
typedef st_plugin_int* storage_engine_ref;
=== modified file 'sql/backup/backup_engine.h'
--- a/sql/backup/backup_engine.h 2009-10-21 13:32:24 +0000
+++ b/sql/backup/backup_engine.h 2010-04-08 10:50:40 +0000
@@ -1,10 +1,6 @@
#ifndef BACKUP_BACKUP_ENGINE_INCLUDED
#define BACKUP_BACKUP_ENGINE_INCLUDED
-#ifndef MYSQL_PRIV_H
- #error backup_engine.h must be included after mysql_priv.h
-#endif
-
/**
@file backup_engine.h
@brief Backup engine and backup/restore driver API.
=== modified file 'sql/backup/backup_info.cc'
--- a/sql/backup/backup_info.cc 2010-02-03 20:33:28 +0000
+++ b/sql/backup/backup_info.cc 2010-04-08 10:50:40 +0000
@@ -21,8 +21,12 @@
given table.
*/
-#include "../mysql_priv.h"
+#include "my_global.h"
+#include "../sql_priv.h"
#include "../ha_partition.h"
+#include "../sql_table.h"
+#include "../sql_base.h"
+#include "../sql_parse.h"
#include "backup_info.h"
#include "backup_kernel.h"
=== modified file 'sql/backup/backup_test.cc'
--- a/sql/backup/backup_test.cc 2009-10-21 13:32:24 +0000
+++ b/sql/backup/backup_test.cc 2010-04-08 10:50:40 +0000
@@ -6,7 +6,10 @@
@todo Implement code to test service interface(s).
*/
-#include "../mysql_priv.h"
+#include "my_global.h"
+#include "../sql_priv.h"
+#include "../protocol.h"
+#include "../sql_class.h"
#include "si_objects.h"
#include "backup_aux.h"
=== modified file 'sql/backup/be_default.cc'
--- a/sql/backup/be_default.cc 2010-01-21 21:27:12 +0000
+++ b/sql/backup/be_default.cc 2010-04-08 10:50:40 +0000
@@ -63,7 +63,8 @@
@todo Change code to ignore blobs with no data (NULL).
*/
-#include "../mysql_priv.h"
+#include "my_global.h"
+#include "../sql_priv.h"
#include "backup_engine.h"
#include "be_default.h"
#include "backup_aux.h"
=== modified file 'sql/backup/be_nodata.cc'
--- a/sql/backup/be_nodata.cc 2009-10-21 13:32:24 +0000
+++ b/sql/backup/be_nodata.cc 2010-04-08 10:50:40 +0000
@@ -30,7 +30,8 @@
DB_TYPE_EXAMPLE_DB
*/
-#include "../mysql_priv.h"
+#include "my_global.h"
+#include "../sql_priv.h"
#include "backup_engine.h"
#include "be_nodata.h"
#include "backup_aux.h"
=== modified file 'sql/backup/be_snapshot.cc'
--- a/sql/backup/be_snapshot.cc 2010-02-26 14:25:52 +0000
+++ b/sql/backup/be_snapshot.cc 2010-04-08 10:50:40 +0000
@@ -40,7 +40,10 @@
Please see <code> be_default.cc </code> for a complete description.
*/
-#include "../mysql_priv.h"
+#include "my_global.h"
+#include "../sql_priv.h"
+#include "../sql_base.h"
+#include "../lock.h"
#include "backup_engine.h"
#include "be_snapshot.h"
#include "backup_aux.h"
=== modified file 'sql/backup/be_thread.cc'
--- a/sql/backup/be_thread.cc 2010-02-26 14:25:52 +0000
+++ b/sql/backup/be_thread.cc 2010-04-08 10:50:40 +0000
@@ -24,8 +24,12 @@
calls easier for the driver code.
*/
-#include "../mysql_priv.h"
+#include "my_global.h"
#include "be_thread.h"
+#include "../sql_priv.h"
+#include "../sql_parse.h"
+#include "../lock.h"
+#include "../sql_base.h"
/**
@brief Creates a new THD object.
=== modified file 'sql/backup/buffer_iterator.cc'
--- a/sql/backup/buffer_iterator.cc 2009-10-21 13:32:24 +0000
+++ b/sql/backup/buffer_iterator.cc 2010-04-08 10:50:40 +0000
@@ -25,7 +25,8 @@
It can also be used to recombine the data from smaller windows.
*/
-#include "../mysql_priv.h"
+#include "my_global.h"
+#include "../sql_priv.h"
#include "buffer_iterator.h"
=== modified file 'sql/backup/buffer_iterator.h'
--- a/sql/backup/buffer_iterator.h 2009-10-21 13:32:24 +0000
+++ b/sql/backup/buffer_iterator.h 2010-04-08 10:50:40 +0000
@@ -1,6 +1,8 @@
#ifndef _BUFFER_ITERATOR_H
#define _BUFFER_ITERATOR_H
+#include "api_types.h"
+
using backup::byte;
/**
=== modified file 'sql/backup/data_backup.cc'
--- a/sql/backup/data_backup.cc 2010-02-17 21:07:50 +0000
+++ b/sql/backup/data_backup.cc 2010-04-08 10:50:40 +0000
@@ -13,7 +13,8 @@
of the error in the log.
*/
-#include "../mysql_priv.h"
+#include "my_global.h"
+#include "../sql_priv.h"
#include "backup_kernel.h"
#include "backup_engine.h"
=== modified file 'sql/backup/error.h'
--- a/sql/backup/error.h 2009-10-23 15:41:56 +0000
+++ b/sql/backup/error.h 2010-04-08 10:50:40 +0000
@@ -1,6 +1,9 @@
#ifndef _BACKUP_ERROR_H
#define _BACKUP_ERROR_H
+#include "../sql_error.h"
+#include "../sql_class.h"
+
namespace util {
/// Used to save messages pushed into the stack.
=== modified file 'sql/backup/image_info.cc'
--- a/sql/backup/image_info.cc 2009-12-15 19:23:11 +0000
+++ b/sql/backup/image_info.cc 2010-04-08 10:50:40 +0000
@@ -1,4 +1,5 @@
-#include "../mysql_priv.h"
+#include "my_global.h"
+#include "../sql_priv.h"
#include "../rpl_mi.h"
#include "image_info.h"
=== modified file 'sql/backup/image_info.h'
--- a/sql/backup/image_info.h 2009-12-15 19:23:11 +0000
+++ b/sql/backup/image_info.h 2010-04-08 10:50:40 +0000
@@ -10,6 +10,8 @@
#include <si_objects.h>
#include <backup_stream.h> // For st_bstream_* types.
#include <backup/backup_aux.h> // For Map template.
+#include <../log.h> /* LOG_INFO */
+#include <../rpl_mi.h> /* Master_info */
/**
@brief The maximal number of table data snapshots per backup image.
=== modified file 'sql/backup/kernel.cc'
--- a/sql/backup/kernel.cc 2010-02-26 14:25:52 +0000
+++ b/sql/backup/kernel.cc 2010-04-08 10:50:40 +0000
@@ -120,8 +120,11 @@
*/
-#include "../mysql_priv.h"
+#include "my_global.h"
+#include "../sql_priv.h"
#include "../si_objects.h"
+#include "../lock.h"
+#include "../sql_table.h"
#include "backup_kernel.h"
#include "backup_info.h"
=== modified file 'sql/backup/logger.cc'
--- a/sql/backup/logger.cc 2009-12-09 19:45:51 +0000
+++ b/sql/backup/logger.cc 2010-04-08 10:50:40 +0000
@@ -1,4 +1,5 @@
-#include "../mysql_priv.h"
+#include "my_global.h"
+#include "../sql_priv.h"
#include "logger.h"
#include "image_info.h"
=== modified file 'sql/backup/logger.h'
--- a/sql/backup/logger.h 2009-11-24 16:47:23 +0000
+++ b/sql/backup/logger.h 2010-04-08 10:50:40 +0000
@@ -1,12 +1,14 @@
#ifndef _BACKUP_LOGGER_H
#define _BACKUP_LOGGER_H
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#include <backup_stream.h>
#include <backup/error.h>
#include "si_logs.h"
#include "rpl_mi.h"
#include "debug_sync.h"
+#include "slave.h" /* active_mi */
namespace backup {
=== modified file 'sql/backup/restore_info.cc'
--- a/sql/backup/restore_info.cc 2010-01-19 10:35:38 +0000
+++ b/sql/backup/restore_info.cc 2010-04-08 10:50:40 +0000
@@ -22,7 +22,7 @@
*/
#include <backup/restore_info.h>
-
+#include "../sql_parse.h"
/**
Perform privilege checking for restore.
=== modified file 'sql/backup/restore_info.h'
--- a/sql/backup/restore_info.h 2010-01-19 10:35:38 +0000
+++ b/sql/backup/restore_info.h 2010-04-08 10:50:40 +0000
@@ -19,7 +19,7 @@
#include <backup_kernel.h>
#include <backup/image_info.h>
#include <backup/stream_services.h>
-
+#include "../sql_acl.h"
class Restore_info;
=== modified file 'sql/backup/stream.cc'
--- a/sql/backup/stream.cc 2009-10-21 13:32:24 +0000
+++ b/sql/backup/stream.cc 2010-04-08 10:50:40 +0000
@@ -60,7 +60,8 @@
to send the 10-byte prefix.
*/
-#include "../mysql_priv.h"
+#include "my_global.h"
+#include "../sql_priv.h"
#include "my_dir.h"
#include "backup_stream.h"
=== modified file 'sql/backup/stream.h'
--- a/sql/backup/stream.h 2009-10-21 13:32:24 +0000
+++ b/sql/backup/stream.h 2010-04-08 10:50:40 +0000
@@ -6,6 +6,7 @@
#include <backup/api_types.h> // for Buffer definition
#include <backup/image_info.h>
#include <backup/logger.h>
+#include "sql_base.h" /* close_thread_tables */
#ifdef HAVE_COMPRESS
#include <zlib.h>
#endif
=== modified file 'sql/bml.cc'
--- a/sql/bml.cc 2010-01-19 19:37:36 +0000
+++ b/sql/bml.cc 2010-04-08 10:50:40 +0000
@@ -93,6 +93,7 @@
#include "bml.h"
#include "debug_sync.h"
+#include "sql_class.h"
Backup_sx_lock::Backup_sx_lock()
{
=== modified file 'sql/bml.h'
--- a/sql/bml.h 2010-01-19 10:35:38 +0000
+++ b/sql/bml.h 2010-04-08 10:50:40 +0000
@@ -22,7 +22,11 @@
Header file for Backup Metadata Lock.
*/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "my_pthread.h"
+
+class THD;
/**
@class Backup_sx_lock
=== modified file 'sql/debug_sync.cc'
--- a/sql/debug_sync.cc 2010-03-25 09:02:07 +0000
+++ b/sql/debug_sync.cc 2010-04-08 10:50:40 +0000
@@ -316,6 +316,8 @@
*/
#include "debug_sync.h"
+#include "log.h"
+#include "sql_class.h"
#if defined(ENABLED_DEBUG_SYNC)
@@ -326,7 +328,10 @@
declarations from mysql_priv.h (e.g. OPTION_AUTO_IS_NULL).
mysql_priv.h includes almost everything, so is sufficient here.
*/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "sql_string.h"
+#include "mysqld.h"
/*
Action to perform at a synchronization point.
=== modified file 'sql/derror.cc'
--- a/sql/derror.cc 2010-01-07 05:48:46 +0000
+++ b/sql/derror.cc 2010-04-09 08:22:10 +0000
@@ -21,8 +21,14 @@
Read language depeneded messagefile
*/
-#include "mysql_priv.h"
+#include "my_global.h" // WITH_*
+#include "sql_priv.h"
+#include "unireg.h"
+#include "derror.h"
#include "mysys_err.h"
+#include "mysqld.h" // lc_messages_dir
+#include "derror.h" // read_texts
+#include "sql_class.h" // THD
static void init_myfunc_errs(void);
=== added file 'sql/derror.h'
--- a/sql/derror.h 1970-01-01 00:00:00 +0000
+++ b/sql/derror.h 2010-03-31 14:05:33 +0000
@@ -0,0 +1,25 @@
+/* Copyright 2006-2008 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef DERROR_INCLUDED
+#define DERROR_INCLUDED
+
+#include "my_global.h" /* uint */
+
+bool init_errmessage(void);
+bool read_texts(const char *file_name, const char *language,
+ const char ***point, uint error_messages);
+
+#endif /* DERROR_INCLUDED */
=== modified file 'sql/des_key_file.cc'
--- a/sql/des_key_file.cc 2010-01-07 05:48:46 +0000
+++ b/sql/des_key_file.cc 2010-04-08 10:50:40 +0000
@@ -13,7 +13,10 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "mysql_priv.h"
+#include "my_global.h" // HAVE_*
+#include "sql_priv.h"
+#include "des_key_file.h" // st_des_keyschedule, st_des_keyblock
+#include "log.h" // sql_print_error
#include <m_ctype.h>
#ifdef HAVE_OPENSSL
=== added file 'sql/des_key_file.h'
--- a/sql/des_key_file.h 1970-01-01 00:00:00 +0000
+++ b/sql/des_key_file.h 2010-03-31 14:05:33 +0000
@@ -0,0 +1,40 @@
+/* Copyright 2006-2008 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef DES_KEY_FILE_INCLUDED
+#define DES_KEY_FILE_INCLUDED
+
+#ifdef HAVE_OPENSSL
+#include <openssl/des.h>
+
+#include "violite.h" /* DES_cblock, DES_key_schedule */
+
+struct st_des_keyblock
+{
+ DES_cblock key1, key2, key3;
+};
+
+struct st_des_keyschedule
+{
+ DES_key_schedule ks1, ks2, ks3;
+};
+
+extern struct st_des_keyschedule des_keyschedule[10];
+extern uint des_default_key;
+
+bool load_des_key_file(const char *file_name);
+#endif /* HAVE_OPENSSL */
+
+#endif /* DES_KEY_FILE_INCLUDED */
=== modified file 'sql/discover.cc'
--- a/sql/discover.cc 2010-01-07 05:48:46 +0000
+++ b/sql/discover.cc 2010-04-09 08:22:10 +0000
@@ -21,7 +21,10 @@
Functions for discover of frm file from handler
*/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h"
+#include "discover.h"
#include <my_dir.h>
/**
=== added file 'sql/discover.h'
--- a/sql/discover.h 1970-01-01 00:00:00 +0000
+++ b/sql/discover.h 2010-03-31 14:05:33 +0000
@@ -0,0 +1,24 @@
+/* Copyright 2006-2008 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef DISCOVER_INCLUDED
+#define DISCOVER_INCLUDED
+
+#include "my_global.h" /* uchar */
+
+int readfrm(const char *name, uchar **data, size_t *length);
+int writefrm(const char* name, const uchar* data, size_t len);
+
+#endif /* DISCOVER_INCLUDED */
=== modified file 'sql/event_data_objects.cc'
--- a/sql/event_data_objects.cc 2010-02-04 10:55:39 +0000
+++ b/sql/event_data_objects.cc 2010-04-10 09:11:47 +0000
@@ -14,11 +14,23 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#define MYSQL_LEX 1
-#include "mysql_priv.h"
+#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
+#include "sql_priv.h"
+#include "unireg.h"
+#include "sql_parse.h" // parse_sql
+#include "strfunc.h" // find_string_in_array
+#include "sql_db.h" // get_default_db_collation
+#include "sql_time.h" // interval_type_to_name,
+ // date_add_interval,
+ // calc_time_diff
+#include "tztime.h" // my_tz_find, my_tz_OFFSET0, struct Time_zone
+#include "sql_acl.h" // EVENT_ACL, SUPER_ACL
+#include "sp.h" // load_charset, load_collation
#include "events.h"
#include "event_data_objects.h"
#include "event_db_repository.h"
#include "sp_head.h"
+#include "sql_show.h" // append_definer, append_identifier
/**
@addtogroup Event_Scheduler
=== modified file 'sql/event_data_objects.h'
--- a/sql/event_data_objects.h 2008-05-09 07:43:02 +0000
+++ b/sql/event_data_objects.h 2010-03-31 14:05:33 +0000
@@ -23,6 +23,12 @@
*/
#include "event_parse_data.h"
+#include "thr_lock.h" /* thr_lock_type */
+
+class Field;
+class THD;
+class Time_zone;
+struct TABLE;
class Event_queue_element_for_exec
{
=== modified file 'sql/event_db_repository.cc'
--- a/sql/event_db_repository.cc 2010-03-23 09:14:15 +0000
+++ b/sql/event_db_repository.cc 2010-04-09 08:22:10 +0000
@@ -13,12 +13,22 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h"
+#include "sql_base.h" // close_thread_tables
#include "event_db_repository.h"
+#include "key.h" // key_copy
+#include "sql_db.h" // get_default_db_collation
+#include "sql_time.h" // interval_type_to_name
+#include "tztime.h" // struct Time_zone
+#include "sql_acl.h" // SUPER_ACL, MYSQL_DB_FIELD_COUNT, mysql_db_table_fields
+#include "records.h" // init_read_record, end_read_record
#include "sp_head.h"
#include "event_data_objects.h"
#include "events.h"
#include "sql_show.h"
+#include "lock.h" // MYSQL_LOCK_IGNORE_TIMEOUT
/**
@addtogroup Event_Scheduler
=== modified file 'sql/event_parse_data.cc'
--- a/sql/event_parse_data.cc 2009-03-17 20:07:27 +0000
+++ b/sql/event_parse_data.cc 2010-04-09 08:22:10 +0000
@@ -13,9 +13,12 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h"
#include "sp_head.h"
#include "event_parse_data.h"
+#include "sql_time.h" // TIME_to_timestamp
/*
Returns a new instance
=== modified file 'sql/event_parse_data.h'
--- a/sql/event_parse_data.h 2008-11-10 20:21:49 +0000
+++ b/sql/event_parse_data.h 2010-03-31 14:05:33 +0000
@@ -16,6 +16,12 @@
#ifndef _EVENT_PARSE_DATA_H_
#define _EVENT_PARSE_DATA_H_
+#include "sql_list.h" /* Sql_alloc */
+
+class Item;
+class THD;
+class sp_name;
+
#define EVEX_GET_FIELD_FAILED -2
#define EVEX_BAD_PARAMS -5
#define EVEX_MICROSECOND_UNSUP -6
=== modified file 'sql/event_queue.cc'
--- a/sql/event_queue.cc 2010-01-25 15:56:14 +0000
+++ b/sql/event_queue.cc 2010-04-09 08:22:10 +0000
@@ -13,10 +13,15 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h"
#include "event_queue.h"
#include "event_data_objects.h"
#include "sql_audit.h"
+#include "tztime.h" // my_tz_find, my_tz_OFFSET0, struct Time_zone
+#include "log.h" // sql_print_error
+#include "sql_class.h" // struct THD
/**
@addtogroup Event_Scheduler
=== modified file 'sql/event_queue.h'
--- a/sql/event_queue.h 2010-01-07 05:48:46 +0000
+++ b/sql/event_queue.h 2010-04-08 10:50:40 +0000
@@ -30,6 +30,10 @@ extern PSI_mutex_key key_LOCK_event_queu
extern PSI_cond_key key_COND_queue_state;
#endif /* HAVE_PSI_INTERFACE */
+#include "queues.h" // QUEUE
+#include "sql_string.h" /* LEX_STRING */
+#include "my_time.h" /* my_time_t, interval_type */
+
class Event_basic;
class Event_queue_element;
class Event_queue_element_for_exec;
=== modified file 'sql/event_scheduler.cc'
--- a/sql/event_scheduler.cc 2010-02-26 14:25:52 +0000
+++ b/sql/event_scheduler.cc 2010-04-09 08:22:10 +0000
@@ -13,12 +13,16 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "mysql_priv.h"
+#include "my_global.h" // WITH_*
+#include "sql_priv.h"
+#include "unireg.h"
+#include "event_scheduler.h"
#include "events.h"
#include "event_data_objects.h"
-#include "event_scheduler.h"
#include "event_queue.h"
#include "event_db_repository.h"
+#include "sql_connect.h" // init_new_connection_handler_thread
+#include "sql_acl.h" // SUPER_ACL
/**
@addtogroup Event_Scheduler
=== modified file 'sql/event_scheduler.h'
--- a/sql/event_scheduler.h 2010-01-07 05:48:46 +0000
+++ b/sql/event_scheduler.h 2010-04-08 10:50:40 +0000
@@ -34,7 +34,9 @@
class Event_queue;
class Event_job_data;
class Event_db_repository;
+class Event_queue_element_for_exec;
class Events;
+class THD;
void
pre_init_event_thread(THD* thd);
=== modified file 'sql/events.cc'
--- a/sql/events.cc 2010-03-23 09:14:15 +0000
+++ b/sql/events.cc 2010-04-09 08:22:10 +0000
@@ -13,8 +13,18 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h"
+#include "sql_parse.h" // check_access
+#include "sql_base.h" // close_thread_tables
+#include "sql_show.h" // append_definer
#include "events.h"
+#include "sql_db.h" // check_db_dir_existence
+#include "sql_table.h" // write_bin_log
+#include "tztime.h" // struct Time_zone
+#include "sql_acl.h" // EVENT_ACL
+#include "records.h" // init_read_record, end_read_record
#include "event_data_objects.h"
#include "event_db_repository.h"
#include "event_queue.h"
=== modified file 'sql/events.h'
--- a/sql/events.h 2010-03-15 17:05:57 +0000
+++ b/sql/events.h 2010-04-12 13:18:53 +0000
@@ -32,10 +32,17 @@ extern PSI_cond_key key_event_scheduler_
extern PSI_thread_key key_thread_event_scheduler, key_thread_event_worker;
#endif /* HAVE_PSI_INTERFACE */
-class Event_parse_data;
+#include "sql_string.h" /* LEX_STRING */
+#include "my_time.h" /* interval_type */
+
class Event_db_repository;
+class Event_parse_data;
class Event_queue;
class Event_scheduler;
+struct TABLE_LIST;
+class THD;
+typedef class Item COND;
+typedef struct charset_info_st CHARSET_INFO;
/* Return codes */
enum enum_events_error_code
=== modified file 'sql/field.cc'
--- a/sql/field.cc 2010-03-25 09:02:07 +0000
+++ b/sql/field.cc 2010-04-09 08:22:10 +0000
@@ -25,10 +25,20 @@
#pragma implementation // gcc: Class implementation
#endif
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#include "sql_select.h"
#include "rpl_rli.h" // Pull in Relay_log_info
#include "slave.h" // Pull in rpl_master_has_bug()
+#include "strfunc.h" // find_type2, find_set
+#include "sql_time.h" // str_to_datetime_with_warn,
+ // str_to_time_with_warn,
+ // TIME_to_timestamp,
+ // make_time, make_date,
+ // make_truncated_value_warning
+#include "tztime.h" // struct Time_zone
+#include "filesort.h" // change_double_for_sort
+#include "log_event.h" // class Table_map_log_event
#include <m_ctype.h>
#include <errno.h>
=== modified file 'sql/field.h'
--- a/sql/field.h 2010-03-25 09:02:07 +0000
+++ b/sql/field.h 2010-04-08 10:50:40 +0000
@@ -25,6 +25,12 @@
#pragma interface /* gcc class implementation */
#endif
+#include "mysqld.h" /* system_charset_info */
+#include "table.h" /* TABLE */
+#include "sql_string.h" /* String */
+#include "my_decimal.h" /* my_decimal */
+#include "sql_error.h" /* MYSQL_ERROR */
+
#define DATETIME_DEC 6
const uint32 max_field_size= (uint32) 4294967295U;
@@ -32,6 +38,33 @@ class Send_field;
class Protocol;
class Create_field;
class Relay_log_info;
+class Field;
+
+enum enum_check_fields
+{
+ CHECK_FIELD_IGNORE,
+ CHECK_FIELD_WARN,
+ CHECK_FIELD_ERROR_FOR_NULL
+};
+
+
+enum Derivation
+{
+ DERIVATION_IGNORABLE= 6,
+ DERIVATION_NUMERIC= 5,
+ DERIVATION_COERCIBLE= 4,
+ DERIVATION_SYSCONST= 3,
+ DERIVATION_IMPLICIT= 2,
+ DERIVATION_NONE= 1,
+ DERIVATION_EXPLICIT= 0
+};
+
+#define STORAGE_TYPE_MASK 7
+#define COLUMN_FORMAT_MASK 7
+#define COLUMN_FORMAT_SHIFT 3
+
+#define my_charset_numeric my_charset_latin1
+#define MY_REPERTOIRE_NUMERIC MY_REPERTOIRE_ASCII
struct st_cache_field;
int field_conv(Field *to,Field *from);
=== modified file 'sql/field_conv.cc'
--- a/sql/field_conv.cc 2010-02-22 17:18:12 +0000
+++ b/sql/field_conv.cc 2010-04-09 08:22:10 +0000
@@ -24,7 +24,9 @@
gives much more speed.
*/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "sql_class.h" // THD
#include <m_ctype.h>
static void do_field_eq(Copy_field *copy)
=== modified file 'sql/filesort.cc'
--- a/sql/filesort.cc 2010-02-05 12:22:23 +0000
+++ b/sql/filesort.cc 2010-04-09 08:22:10 +0000
@@ -21,13 +21,18 @@
Sorts a database
*/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "filesort.h"
+#include "unireg.h" // REQUIRED by other includes
#ifdef HAVE_STDDEF_H
#include <stddef.h> /* for macro offsetof */
#endif
#include <m_ctype.h>
#include "sql_sort.h"
#include "probes_mysql.h"
+#include "sql_test.h" // TEST_filesort
+#include "opt_range.h" // SQL_SELECT
#ifndef THREAD
#define SKIP_DBUG_IN_FILESORT
=== added file 'sql/filesort.h'
--- a/sql/filesort.h 1970-01-01 00:00:00 +0000
+++ b/sql/filesort.h 2010-03-31 14:05:33 +0000
@@ -0,0 +1,36 @@
+/* Copyright 2006-2008 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef FILESORT_INCLUDED
+#define FILESORT_INCLUDED
+
+class SQL_SELECT;
+
+#include "my_global.h" /* uint, uchar */
+#include "my_base.h" /* ha_rows */
+
+class SQL_SELECT;
+class THD;
+struct TABLE;
+typedef struct st_sort_field SORT_FIELD;
+
+ha_rows filesort(THD *thd, TABLE *table, st_sort_field *sortorder,
+ uint s_length, SQL_SELECT *select,
+ ha_rows max_rows, bool sort_positions,
+ ha_rows *examined_rows);
+void filesort_free_buffers(TABLE *table, bool full);
+void change_double_for_sort(double nr,uchar *to);
+
+#endif /* FILESORT_INCLUDED */
=== modified file 'sql/frm_crypt.cc'
--- a/sql/frm_crypt.cc 2006-12-31 00:02:27 +0000
+++ b/sql/frm_crypt.cc 2010-04-09 08:22:10 +0000
@@ -21,7 +21,9 @@
** mysql binary.
*/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "frm_crypt.h"
#ifdef HAVE_CRYPTED_FRM
=== added file 'sql/frm_crypt.h'
--- a/sql/frm_crypt.h 1970-01-01 00:00:00 +0000
+++ b/sql/frm_crypt.h 2010-03-31 14:05:33 +0000
@@ -0,0 +1,23 @@
+/* Copyright 2006-2008 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef FRM_CRYPT_INCLUDED
+#define FRM_CRYPT_INCLUDED
+
+class SQL_CRYPT;
+
+SQL_CRYPT *get_crypt_for_frm(void);
+
+#endif /* FRM_CRYPT_INCLUDED */
=== modified file 'sql/gstream.cc'
--- a/sql/gstream.cc 2009-06-09 16:44:26 +0000
+++ b/sql/gstream.cc 2010-04-09 08:22:10 +0000
@@ -18,7 +18,10 @@
NOTE: These functions assumes that the string is end \0 terminated!
*/
-#include "mysql_priv.h"
+#include "my_global.h" // HAVE_*
+#include "sql_priv.h"
+#include "gstream.h"
+#include "m_string.h" // LEX_STRING
enum Gis_read_stream::enum_tok_types Gis_read_stream::get_next_toc_type()
{
=== modified file 'sql/gstream.h'
--- a/sql/gstream.h 2009-10-26 14:02:26 +0000
+++ b/sql/gstream.h 2010-04-08 10:50:40 +0000
@@ -17,6 +17,13 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include "my_global.h" /* NULL, NullS */
+#include "my_sys.h" /* MY_ALLOW_ZERO_PTR */
+#include "m_ctype.h" /* my_charset_latin1, my_charset_bin */
+
+typedef struct charset_info_st CHARSET_INFO;
+typedef struct st_mysql_lex_string LEX_STRING;
+
class Gis_read_stream
{
public:
=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc 2010-02-26 14:25:52 +0000
+++ b/sql/ha_ndbcluster.cc 2010-04-09 08:22:10 +0000
@@ -26,7 +26,16 @@
#pragma implementation // gcc: Class implementation
#endif
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h" // REQUIRED: for other includes
+#include "sql_table.h" // build_table_filename,
+ // tablename_to_filename,
+ // filename_to_tablename
+#include "sql_partition.h" // HA_CAN_*, partition_info, part_id_range
+#include "sql_base.h" // close_cached_tables
+#include "discover.h" // readfrm
+#include "sql_acl.h" // wild_case_compare
#include "rpl_mi.h"
/*
@@ -49,8 +58,11 @@ int ha_ndb_dummy;
#include "ha_ndbcluster_tables.h"
#include "ha_ndbcluster_connection.h"
-#include <mysql/plugin.h>
+#include "sql_plugin.h"
#include "probes_mysql.h"
+#include "sql_show.h" // init_fill_schema_files_row,
+ // schema_table_store_record
+#include "sql_test.h" // print_where
#ifdef ndb_dynamite
#undef assert
=== modified file 'sql/ha_ndbcluster.h'
--- a/sql/ha_ndbcluster.h 2010-01-07 05:48:46 +0000
+++ b/sql/ha_ndbcluster.h 2010-04-08 10:50:40 +0000
@@ -52,6 +52,8 @@ class NdbEventOperation;
class ha_ndbcluster_cond;
class Ndb_event_data;
+#include "sql_partition.h" /* part_id_range */
+
// connectstring to cluster if given by mysqld
extern const char *ndbcluster_connectstring;
=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc 2010-03-16 13:50:50 +0000
+++ b/sql/ha_ndbcluster_binlog.cc 2010-04-09 08:22:10 +0000
@@ -14,7 +14,9 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h" // REQUIRED: for other includes
#include "sql_show.h"
#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
#include "ha_ndbcluster.h"
@@ -31,6 +33,14 @@
#include <util/NdbAutoPtr.hpp>
#include <portlib/NdbTick.h>
+#include "sql_base.h" // close_thread_tables
+#include "sql_table.h" // build_table_filename
+#include "table.h" // open_table_from_share
+#include "discover.h" // readfrm, writefrm
+#include "lock.h" // MYSQL_LOCK_IGNORE_FLUSH,
+ // mysql_unlock_tables
+#include "sql_parse.h" // mysql_parse
+
#ifdef ndb_dynamite
#undef assert
#define assert(x) do { if(x) break; ::printf("%s %d: assert failed: %s\n", __FILE__, __LINE__, #x); ::fflush(stdout); ::signal(SIGABRT,SIG_DFL); ::abort(); ::kill(::getpid(),6); ::kill(::getpid(),9); } while (0)
=== modified file 'sql/ha_ndbcluster_binlog.h'
--- a/sql/ha_ndbcluster_binlog.h 2010-01-07 05:48:46 +0000
+++ b/sql/ha_ndbcluster_binlog.h 2010-04-08 10:50:40 +0000
@@ -17,6 +17,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include "sql_class.h" /* THD */
+
// Typedefs for long names
typedef NdbDictionary::Object NDBOBJ;
typedef NdbDictionary::Column NDBCOL;
=== modified file 'sql/ha_ndbcluster_cond.cc'
--- a/sql/ha_ndbcluster_cond.cc 2008-08-18 05:43:50 +0000
+++ b/sql/ha_ndbcluster_cond.cc 2010-04-09 08:22:10 +0000
@@ -22,7 +22,10 @@
#pragma implementation // gcc: Class implementation
#endif
-#include "mysql_priv.h"
+#include "my_global.h" // WITH_*
+#include "sql_priv.h"
+#include "sql_class.h" // set_var.h: THD
+#include "log.h" // sql_print_error
#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
#include <ndbapi/NdbApi.hpp>
=== modified file 'sql/ha_ndbcluster_cond.h'
--- a/sql/ha_ndbcluster_cond.h 2009-10-26 14:02:26 +0000
+++ b/sql/ha_ndbcluster_cond.h 2010-04-08 10:50:40 +0000
@@ -25,6 +25,13 @@
#pragma interface /* gcc class implementation */
#endif
+/*
+ It is necessary to include set_var.h instead of item.h because there
+ are dependencies on include order for set_var.h and item.h. This
+ will be resolved later.
+*/
+#include "set_var.h" /* Item, Item_field */
+
#define round_up_byte(size) ((size + 7) >> 3) << 3
typedef enum ndb_item_type {
=== modified file 'sql/ha_ndbcluster_connection.cc'
--- a/sql/ha_ndbcluster_connection.cc 2009-12-24 16:38:19 +0000
+++ b/sql/ha_ndbcluster_connection.cc 2010-04-09 08:22:10 +0000
@@ -18,7 +18,8 @@
#pragma implementation // gcc: Class implementation
#endif
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
#include <ndbapi/NdbApi.hpp>
=== modified file 'sql/ha_partition.cc'
--- a/sql/ha_partition.cc 2010-03-25 09:02:07 +0000
+++ b/sql/ha_partition.cc 2010-04-09 08:22:10 +0000
@@ -51,12 +51,15 @@
#pragma implementation // gcc: Class implementation
#endif
-#include "mysql_priv.h"
+#include "my_global.h" // WITH_*
+#include "sql_priv.h"
+#include "sql_parse.h" // append_file_to_dir
#ifdef WITH_PARTITION_STORAGE_ENGINE
#include "ha_partition.h"
-
-#include <mysql/plugin.h>
+#include "sql_table.h" // tablename_to_filename
+#include "key.h"
+#include "sql_plugin.h"
static const char *ha_par_ext= ".par";
#ifdef NOT_USED
=== modified file 'sql/ha_partition.h'
--- a/sql/ha_partition.h 2010-03-23 09:14:15 +0000
+++ b/sql/ha_partition.h 2010-04-08 10:50:40 +0000
@@ -20,6 +20,10 @@
#pragma interface /* gcc class implementation */
#endif
+#include "sql_partition.h" /* part_id_range, partition_element */
+#include "queues.h" /* QUEUE */
+#include "item.h"
+
enum partition_keywords
{
PKW_HASH= 0, PKW_RANGE, PKW_LIST, PKW_KEY, PKW_MAXVALUE, PKW_LINEAR,
=== modified file 'sql/handler.cc'
--- a/sql/handler.cc 2010-03-16 17:54:01 +0000
+++ b/sql/handler.cc 2010-04-08 10:50:40 +0000
@@ -23,8 +23,21 @@
#pragma implementation // gcc: Class implementation
#endif
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h"
#include "debug_sync.h"
+#include "rpl_handler.h"
+#include "sql_cache.h" // query_cache, query_cache_*
+#include "key.h" // key_copy, key_unpack, key_cmp_if_same, key_cmp
+#include "sql_table.h" // build_table_filename
+#include "lock.h" // wait_if_global_read_lock,
+ // start_waiting_global_read_lock
+#include "sql_parse.h" // check_stack_overrun
+#include "sql_acl.h" // SUPER_ACL
+#include "sql_base.h" // free_io_cache
+#include "discover.h" // writefrm
+#include "log_event.h" // *_rows_log_event
#include "rpl_filter.h"
#include <myisampack.h>
#include "myisam.h"
=== modified file 'sql/handler.h'
--- a/sql/handler.h 2010-02-21 18:25:29 +0000
+++ b/sql/handler.h 2010-04-08 10:50:40 +0000
@@ -23,6 +23,13 @@
#endif
#include <my_global.h>
+#include "sql_const.h"
+#include "mysqld.h" /* server_id */
+#include "sql_plugin.h" /* plugin_ref, st_plugin_int, plugin */
+#include "thr_lock.h" /* thr_lock_type, THR_LOCK_DATA */
+#include "sql_cache.h"
+#include "structs.h" /* SHOW_COMP_OPTION */
+
#include <my_handler.h>
#include <ft_global.h>
#include <keycache.h>
@@ -2712,4 +2719,15 @@ public:
int lock(int no_queue= 0) { return 0; }
};
#endif
+
+const char *get_canonical_filename(handler *file, const char *path,
+ char *tmp_path);
+bool mysql_xa_recover(THD *thd);
+
+
+inline const char *table_case_name(HA_CREATE_INFO *info, const char *name)
+{
+ return ((lower_case_table_names == 2 && info->alias) ? info->alias : name);
+}
+
#endif /* HANDLER_INCLUDED */
=== modified file 'sql/hash_filo.cc'
--- a/sql/hash_filo.cc 2006-12-31 00:02:27 +0000
+++ b/sql/hash_filo.cc 2010-04-09 08:22:10 +0000
@@ -23,5 +23,6 @@
#pragma implementation // gcc: Class implementation
#endif
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#include "hash_filo.h"
=== modified file 'sql/hash_filo.h'
--- a/sql/hash_filo.h 2010-01-07 05:48:46 +0000
+++ b/sql/hash_filo.h 2010-04-08 10:50:40 +0000
@@ -26,6 +26,10 @@
#pragma interface /* gcc class interface */
#endif
+#include "hash.h" /* my_hash_get_key, my_hash_free_key, HASH */
+#include "m_string.h" /* bzero */
+#include "mysqld.h" /* key_hash_filo_lock */
+
class hash_filo_element
{
hash_filo_element *next_used,*prev_used;
=== modified file 'sql/hostname.cc'
--- a/sql/hostname.cc 2010-01-07 05:48:46 +0000
+++ b/sql/hostname.cc 2010-04-09 08:22:10 +0000
@@ -24,9 +24,18 @@
doesn't resemble an IP address.
*/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "hostname.h"
+#ifndef __WIN__
+#include <netdb.h> // getservbyname, servent
+#endif
#include "hash_filo.h"
#include <m_ctype.h>
+#include "log.h" // sql_print_warning,
+ // sql_print_information
+#include "violite.h" // vio_getnameinfo,
+ // vio_get_normalized_ip_string
#ifdef __cplusplus
extern "C" { // Because of SCO 3.2V4.2
#endif
=== added file 'sql/hostname.h'
--- a/sql/hostname.h 1970-01-01 00:00:00 +0000
+++ b/sql/hostname.h 2010-03-31 14:05:33 +0000
@@ -0,0 +1,30 @@
+/* Copyright 2006-2008 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef HOSTNAME_INCLUDED
+#define HOSTNAME_INCLUDED
+
+#include "my_global.h" /* uint */
+
+bool ip_to_hostname(struct sockaddr_storage *ip_storage,
+ const char *ip_string,
+ char **hostname, uint *connect_errors);
+void inc_host_errors(const char *ip_string);
+void reset_host_errors(const char *ip_string);
+bool hostname_cache_init();
+void hostname_cache_free();
+void hostname_cache_refresh(void);
+
+#endif /* HOSTNAME_INCLUDED */
=== modified file 'sql/init.cc'
--- a/sql/init.cc 2009-11-24 19:46:33 +0000
+++ b/sql/init.cc 2010-04-09 08:22:10 +0000
@@ -21,7 +21,13 @@
Init and dummy functions for interface with unireg
*/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "init.h"
+#include "my_sys.h"
+#include "mysqld.h" // abort_loop, ...
+#include "my_time.h" // my_init_time
+#include "unireg.h" // SPECIAL_SAME_DB_NAME
#include <m_ctype.h>
void unireg_init(ulong options)
=== added file 'sql/init.h'
--- a/sql/init.h 1970-01-01 00:00:00 +0000
+++ b/sql/init.h 2010-03-31 14:05:33 +0000
@@ -0,0 +1,24 @@
+/* Copyright 2006-2008 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef INIT_INCLUDED
+#define INIT_INCLUDED
+
+#include "my_global.h" /* ulong */
+
+void unireg_init(ulong options);
+void unireg_end(void) __attribute__((noreturn));
+
+#endif /* INIT_INCLUDED */
=== modified file 'sql/item.cc'
--- a/sql/item.cc 2010-03-25 09:02:07 +0000
+++ b/sql/item.cc 2010-04-10 09:11:47 +0000
@@ -17,7 +17,9 @@
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
-#include "mysql_priv.h"
+#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
+#include "sql_priv.h"
+#include "unireg.h" // REQUIRED: for other includes
#include <mysql.h>
#include <m_ctype.h>
#include "my_dir.h"
@@ -25,6 +27,20 @@
#include "sp_head.h"
#include "sql_trigger.h"
#include "sql_select.h"
+#include "sql_show.h" // append_identifier
+#include "sql_view.h" // VIEW_ANY_SQL
+#include "sql_time.h" // str_to_datetime_with_warn,
+ // make_truncated_value_warning
+#include "sql_acl.h" // get_column_grant,
+ // SELECT_ACL, UPDATE_ACL,
+ // INSERT_ACL,
+ // check_grant_column
+#include "sql_base.h" // enum_resolution_type,
+ // REPORT_EXCEPT_NOT_FOUND,
+ // find_item_in_list,
+ // RESOLVED_AGAINST_ALIAS, ...
+#include "log_event.h" // append_query_string
+#include "sql_test.h"
const String my_null_string("NULL", 4, default_charset_info);
=== modified file 'sql/item.h'
--- a/sql/item.h 2010-03-25 09:02:07 +0000
+++ b/sql/item.h 2010-04-09 08:22:10 +0000
@@ -21,10 +21,19 @@
#pragma interface /* gcc class implementation */
#endif
+#include "my_global.h" // WITH_*
+#include "sql_priv.h" /* STRING_BUFFER_USUAL_SIZE */
+#include "unireg.h"
+#include "sql_const.h" /* RAND_TABLE_BIT, MAX_FIELD_NAME */
+#include "unireg.h" // REQUIRED: for other includes
+#include "thr_malloc.h" /* sql_calloc */
+#include "field.h" /* Derivation */
+
class Protocol;
struct TABLE_LIST;
void item_init(void); /* Init item functions */
class Item_field;
+class user_var_entry;
/*
"Declared Type Collation"
@@ -2757,6 +2766,7 @@ public:
#include "item_timefunc.h"
#include "item_subselect.h"
#include "item_xmlfunc.h"
+#include "item_create.h"
#endif
/**
@@ -3104,18 +3114,6 @@ public:
};
-/*
- 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, TRG_ACTION_MAX
-};
-
class Table_triggers_list;
/*
@@ -3504,4 +3502,6 @@ extern Item_result item_cmp_type(Item_re
extern void resolve_const_item(THD *thd, Item **ref, Item *cmp_item);
extern int stored_field_cmp_to_item(THD *thd, Field *field, Item *item);
+extern const String my_null_string;
+
#endif /* ITEM_INCLUDED */
=== modified file 'sql/item_buff.cc'
--- a/sql/item_buff.cc 2007-12-18 16:49:14 +0000
+++ b/sql/item_buff.cc 2010-04-09 08:22:10 +0000
@@ -21,7 +21,15 @@
Buffers to save and compare item values
*/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+/*
+ It is necessary to include set_var.h instead of item.h because there
+ are dependencies on include order for set_var.h and item.h. This
+ will be resolved later.
+*/
+#include "sql_class.h" // THD
+#include "set_var.h" // Cached_item, Cached_item_field, ...
/**
Create right type of Cached_item for an item.
=== modified file 'sql/item_cmpfunc.cc'
--- a/sql/item_cmpfunc.cc 2010-03-25 09:02:07 +0000
+++ b/sql/item_cmpfunc.cc 2010-04-09 08:22:10 +0000
@@ -25,9 +25,12 @@
#pragma implementation // gcc: Class implementation
#endif
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#include <m_ctype.h>
#include "sql_select.h"
+#include "sql_parse.h" // check_stack_overrun
+#include "sql_time.h" // make_truncated_value_warning
static bool convert_constant_item(THD *, Item_field *, Item **);
static longlong
=== modified file 'sql/item_cmpfunc.h'
--- a/sql/item_cmpfunc.h 2010-03-25 09:02:07 +0000
+++ b/sql/item_cmpfunc.h 2010-04-08 10:50:40 +0000
@@ -23,6 +23,9 @@
#pragma interface /* gcc class implementation */
#endif
+#include "thr_malloc.h" /* sql_calloc */
+#include "item_func.h" /* Item_int_func, Item_bool_func */
+
extern Item_result item_cmp_type(Item_result a,Item_result b);
class Item_bool_func2;
class Arg_comparator;
@@ -1798,9 +1801,26 @@ inline Item *and_conds(Item *a, Item *b)
return new Item_cond_and(a, b);
}
+
Item *and_expressions(Item *a, Item *b, Item **org_item);
+longlong get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg,
+ Item *warn_item, bool *is_null);
+
+
bool get_mysql_time_from_str(THD *thd, String *str, timestamp_type warn_type,
const char *warn_name, MYSQL_TIME *l_time);
+/*
+ These need definitions from this file but the variables are defined
+ in mysqld.h. The variables really belong in this component, but for
+ the time being we leave them in mysqld.cc to avoid merge problems.
+*/
+extern Eq_creator eq_creator;
+extern Ne_creator ne_creator;
+extern Gt_creator gt_creator;
+extern Lt_creator lt_creator;
+extern Ge_creator ge_creator;
+extern Le_creator le_creator;
+
#endif /* ITEM_CMPFUNC_INCLUDED */
=== modified file 'sql/item_create.cc'
--- a/sql/item_create.cc 2010-03-25 09:02:07 +0000
+++ b/sql/item_create.cc 2010-04-09 08:22:10 +0000
@@ -20,8 +20,15 @@
Functions to create an item. Used by sql_yac.yy
*/
-#include "mysql_priv.h"
-#include "item_create.h"
+#include "my_global.h"
+#include "sql_priv.h"
+/*
+ It is necessary to include set_var.h instead of item.h because there
+ are dependencies on include order for set_var.h and item.h. This
+ will be resolved later.
+*/
+#include "sql_class.h" // set_var.h: THD
+#include "set_var.h"
#include "sp_head.h"
#include "sp.h"
=== modified file 'sql/item_create.h'
--- a/sql/item_create.h 2010-03-14 16:19:24 +0000
+++ b/sql/item_create.h 2010-04-08 10:50:40 +0000
@@ -18,6 +18,8 @@
#ifndef ITEM_CREATE_H
#define ITEM_CREATE_H
+typedef struct st_udf_func udf_func;
+
/**
Public function builder interface.
The parser (sql/sql_yacc.yy) uses a factory / builder pattern to
@@ -166,5 +168,9 @@ Item *
create_func_cast(THD *thd, Item *a, Cast_target cast_type,
const char *len, const char *dec,
CHARSET_INFO *cs);
+
+int item_create_init();
+void item_create_cleanup();
+
#endif
=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc 2010-03-25 09:02:07 +0000
+++ b/sql/item_func.cc 2010-04-10 09:11:47 +0000
@@ -25,8 +25,21 @@
#pragma implementation // gcc: Class implementation
#endif
-#include "mysql_priv.h"
+#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
+#include "sql_priv.h"
+/*
+ It is necessary to include set_var.h instead of item.h because there
+ are dependencies on include order for set_var.h and item.h. This
+ will be resolved later.
+*/
+#include "sql_class.h" // set_var.h: THD
+#include "set_var.h"
#include "slave.h" // for wait_for_master_pos
+#include "sql_show.h" // append_identifier
+#include "strfunc.h" // find_type
+#include "sql_parse.h" // is_update_query
+#include "sql_acl.h" // EXECUTE_ACL
+#include "mysqld.h" // LOCK_uuid_generator
#include "rpl_mi.h"
#include <m_ctype.h>
#include <hash.h>
=== modified file 'sql/item_func.h'
--- a/sql/item_func.h 2010-03-23 09:14:15 +0000
+++ b/sql/item_func.h 2010-04-08 10:50:40 +0000
@@ -1797,4 +1797,14 @@ public:
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
+Item *get_system_var(THD *thd, enum_var_type var_type, LEX_STRING name,
+ LEX_STRING component);
+extern bool check_reserved_words(LEX_STRING *name);
+extern enum_field_types agg_field_type(Item **items, uint nitems);
+double my_double_round(double value, longlong dec, bool dec_unsigned,
+ bool truncate);
+bool eval_const_cond(COND *cond);
+
+extern bool volatile mqh_used;
+
#endif /* ITEM_FUNC_INCLUDED */
=== modified file 'sql/item_geofunc.cc'
--- a/sql/item_geofunc.cc 2010-03-01 19:02:51 +0000
+++ b/sql/item_geofunc.cc 2010-04-09 08:22:10 +0000
@@ -25,7 +25,15 @@
#pragma implementation // gcc: Class implementation
#endif
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+/*
+ It is necessary to include set_var.h instead of item.h because there
+ are dependencies on include order for set_var.h and item.h. This
+ will be resolved later.
+*/
+#include "sql_class.h" // THD, set_var.h: THD
+#include "set_var.h"
#ifdef HAVE_SPATIAL
#include <m_ctype.h>
=== modified file 'sql/item_row.cc'
--- a/sql/item_row.cc 2010-03-19 07:05:41 +0000
+++ b/sql/item_row.cc 2010-04-09 08:22:10 +0000
@@ -13,7 +13,15 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+/*
+ It is necessary to include set_var.h instead of item.h because there
+ are dependencies on include order for set_var.h and item.h. This
+ will be resolved later.
+*/
+#include "sql_class.h" // THD, set_var.h: THD
+#include "set_var.h"
/**
Row items used for comparing rows and IN operations on rows:
=== modified file 'sql/item_strfunc.cc'
--- a/sql/item_strfunc.cc 2010-02-27 09:25:56 +0000
+++ b/sql/item_strfunc.cc 2010-04-09 08:22:10 +0000
@@ -29,8 +29,20 @@
#pragma implementation // gcc: Class implementation
#endif
-
-#include "mysql_priv.h"
+#include "my_global.h" // HAVE_*
+#include "sql_priv.h"
+/*
+ It is necessary to include set_var.h instead of item.h because there
+ are dependencies on include order for set_var.h and item.h. This
+ will be resolved later.
+*/
+#include "sql_class.h" // set_var.h: THD
+#include "set_var.h"
+#include "mysqld.h" // LOCK_uuid_generator
+#include "sql_acl.h" // SUPER_ACL
+#include "des_key_file.h" // st_des_keyschedule, st_des_keyblock
+#include "password.h" // my_make_scrambled_password,
+ // my_make_scrambled_password_323
#include <m_ctype.h>
#include "my_md5.h"
#include "sha1.h"
=== modified file 'sql/item_strfunc.h'
--- a/sql/item_strfunc.h 2010-03-23 09:14:15 +0000
+++ b/sql/item_strfunc.h 2010-04-08 10:50:40 +0000
@@ -23,6 +23,8 @@
#pragma interface /* gcc class implementation */
#endif
+class MY_LOCALE;
+
class Item_str_func :public Item_func
{
public:
@@ -911,4 +913,6 @@ public:
String *val_str(String *);
};
+extern String my_empty_string;
+
#endif /* ITEM_STRFUNC_INCLUDED */
=== modified file 'sql/item_subselect.cc'
--- a/sql/item_subselect.cc 2010-03-25 09:02:07 +0000
+++ b/sql/item_subselect.cc 2010-04-09 08:22:10 +0000
@@ -28,8 +28,17 @@
#pragma implementation // gcc: Class implementation
#endif
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+/*
+ It is necessary to include set_var.h instead of item.h because there
+ are dependencies on include order for set_var.h and item.h. This
+ will be resolved later.
+*/
+#include "sql_class.h" // set_var.h: THD
+#include "set_var.h"
#include "sql_select.h"
+#include "sql_parse.h" // check_stack_overrun
inline Item * and_items(Item* cond, Item *item)
{
=== modified file 'sql/item_subselect.h'
--- a/sql/item_subselect.h 2010-03-15 07:52:25 +0000
+++ b/sql/item_subselect.h 2010-04-08 10:50:40 +0000
@@ -30,6 +30,15 @@ class subselect_engine;
class subselect_hash_sj_engine;
class Item_bool_func2;
class Cached_item;
+class Comp_creator;
+
+typedef class st_select_lex SELECT_LEX;
+
+/**
+ Convenience typedef used in this file, and further used by any files
+ including this file.
+*/
+typedef Comp_creator* (*chooser_compare_func_creator)(bool invert);
/* base class for subselects */
@@ -657,6 +666,15 @@ public:
virtual enum_engine_type engine_type() { return INDEXSUBQUERY_ENGINE; }
};
+/*
+ This function is actually defined in sql_parse.cc, but it depends on
+ chooser_compare_func_creator defined in this file.
+ */
+Item * all_any_subquery_creator(Item *left_expr,
+ chooser_compare_func_creator cmp,
+ bool all,
+ SELECT_LEX *select_lex);
+
inline bool Item_subselect::is_evaluated() const
{
=== modified file 'sql/item_sum.cc'
--- a/sql/item_sum.cc 2010-03-25 09:02:07 +0000
+++ b/sql/item_sum.cc 2010-04-09 08:22:10 +0000
@@ -25,7 +25,8 @@
#pragma implementation // gcc: Class implementation
#endif
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#include "sql_select.h"
/**
=== modified file 'sql/item_sum.h'
--- a/sql/item_sum.h 2010-03-25 09:02:07 +0000
+++ b/sql/item_sum.h 2010-04-08 10:50:40 +0000
@@ -24,6 +24,7 @@
#endif
#include <my_tree.h>
+#include "sql_udf.h" /* udf_handler */
class Item_sum;
class Aggregator_distinct;
=== modified file 'sql/item_timefunc.cc'
--- a/sql/item_timefunc.cc 2010-03-01 19:02:51 +0000
+++ b/sql/item_timefunc.cc 2010-04-09 08:22:10 +0000
@@ -28,7 +28,29 @@
#pragma implementation // gcc: Class implementation
#endif
-#include "mysql_priv.h"
+#include "my_global.h" // WITH_*
+#include "sql_priv.h"
+/*
+ It is necessary to include set_var.h instead of item.h because there
+ are dependencies on include order for set_var.h and item.h. This
+ will be resolved later.
+*/
+#include "sql_class.h" // set_var.h: THD
+#include "set_var.h"
+#include "sql_locale.h" // MY_LOCALE my_locale_en_US
+#include "strfunc.h" // check_word
+#include "sql_time.h" // make_truncated_value_warning,
+ // make_time, get_date_from_daynr,
+ // calc_weekday, calc_week,
+ // convert_month_to_period,
+ // convert_period_to_month,
+ // TIME_to_timestamp, make_date,
+ // calc_time_diff,
+ // calc_time_from_sec,
+ // known_date_time_format,
+ // get_date_time_format_str
+#include "tztime.h" // struct Time_zone
+#include "sql_class.h" // THD
#include <m_ctype.h>
#include <time.h>
=== modified file 'sql/item_timefunc.h'
--- a/sql/item_timefunc.h 2010-03-23 09:14:15 +0000
+++ b/sql/item_timefunc.h 2010-04-08 10:50:40 +0000
@@ -23,6 +23,8 @@
#pragma interface /* gcc class implementation */
#endif
+class MY_LOCALE;
+
enum date_time_format_types
{
TIME_ONLY= 0, TIME_MICROSECOND, DATE_ONLY, DATE_TIME, DATE_TIME_MICROSECOND
@@ -1066,4 +1068,10 @@ public:
}
};
+
+/* Function prototypes */
+
+bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time,
+ timestamp_type type, String *str);
+
#endif /* ITEM_TIMEFUNC_INCLUDED */
=== modified file 'sql/item_xmlfunc.cc'
--- a/sql/item_xmlfunc.cc 2010-02-15 08:09:44 +0000
+++ b/sql/item_xmlfunc.cc 2010-04-09 08:22:10 +0000
@@ -17,9 +17,18 @@
#pragma implementation
#endif
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+/*
+ It is necessary to include set_var.h instead of item.h because there
+ are dependencies on include order for set_var.h and item.h. This
+ will be resolved later.
+*/
+#include "sql_class.h" // set_var.h: THD
+#include "set_var.h"
#include "my_xml.h"
#include "sp_pcontext.h"
+#include "sql_class.h" // THD
/*
TODO: future development directions:
=== modified file 'sql/key.cc'
--- a/sql/key.cc 2009-10-15 12:27:13 +0000
+++ b/sql/key.cc 2010-04-09 08:22:10 +0000
@@ -16,7 +16,11 @@
/* Functions to handle keys and fields in forms */
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h" // REQUIRED: by includes later
+#include "key.h" // key_rec_cmp
+#include "field.h" // Field
/*
Search after a key that starts with 'field'
=== added file 'sql/key.h'
--- a/sql/key.h 1970-01-01 00:00:00 +0000
+++ b/sql/key.h 2010-04-08 10:50:40 +0000
@@ -0,0 +1,40 @@
+/* Copyright 2006-2008 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef KEY_INCLUDED
+#define KEY_INCLUDED
+
+#include "my_global.h" /* uchar */
+
+class Field;
+class String;
+struct TABLE;
+typedef struct st_bitmap MY_BITMAP;
+typedef struct st_key KEY;
+typedef struct st_key_part_info KEY_PART_INFO;
+
+int find_ref_key(KEY *key, uint key_count, uchar *record, Field *field,
+ uint *key_length, uint *keypart);
+void key_copy(uchar *to_key, uchar *from_record, KEY *key_info, uint key_length);
+void key_restore(uchar *to_record, uchar *from_key, KEY *key_info,
+ uint key_length);
+void key_zero_nulls(uchar *tuple, KEY *key_info);
+bool key_cmp_if_same(TABLE *form,const uchar *key,uint index,uint key_length);
+void key_unpack(String *to,TABLE *form,uint index);
+bool is_key_used(TABLE *table, uint idx, const MY_BITMAP *fields);
+int key_cmp(KEY_PART_INFO *key_part, const uchar *key, uint key_length);
+extern "C" int key_rec_cmp(void *key_info, uchar *a, uchar *b);
+
+#endif /* KEY_INCLUDED */
=== modified file 'sql/keycaches.h'
--- a/sql/keycaches.h 2009-12-22 09:35:56 +0000
+++ b/sql/keycaches.h 2010-03-31 14:05:33 +0000
@@ -1,3 +1,6 @@
+#ifndef KEYCACHES_INCLUDED
+#define KEYCACHES_INCLUDED
+
/* Copyright (C) 2002-2006 MySQL AB, 2009 Sun Microsystems, Inc.
This program is free software; you can redistribute it and/or modify
@@ -39,3 +42,4 @@ KEY_CACHE *get_or_create_key_cache(const
void free_key_cache(const char *name, KEY_CACHE *key_cache);
bool process_key_caches(process_key_cache_t func);
+#endif /* KEYCACHES_INCLUDED */
=== modified file 'sql/lock.cc'
--- a/sql/lock.cc 2010-03-16 13:50:50 +0000
+++ b/sql/lock.cc 2010-04-09 08:22:10 +0000
@@ -73,9 +73,15 @@
we are forced to use mysql_lock_merge.
*/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#include "transaction.h"
#include "debug_sync.h"
+#include "unireg.h" // REQUIRED: for other includes
+#include "lock.h"
+#include "sql_base.h" // close_tables_for_reopen
+#include "sql_parse.h" // is_log_table_write_query
+#include "sql_acl.h" // SUPER_ACL
#include <hash.h>
#include <assert.h>
=== added file 'sql/lock.h'
--- a/sql/lock.h 1970-01-01 00:00:00 +0000
+++ b/sql/lock.h 2010-04-12 13:18:53 +0000
@@ -0,0 +1,108 @@
+#ifndef LOCK_INCLUDED
+#define LOCK_INCLUDED
+
+#include "thr_lock.h" /* thr_lock_type */
+
+// Forward declarations
+struct TABLE;
+struct TABLE_LIST;
+class THD;
+typedef struct st_mysql_lock MYSQL_LOCK;
+
+/* mysql_lock_tables() and open_table() flags bits */
+#define MYSQL_OPEN_IGNORE_GLOBAL_READ_LOCK 0x0001
+#define MYSQL_OPEN_IGNORE_FLUSH 0x0002
+#define MYSQL_OPEN_TEMPORARY_ONLY 0x0004
+#define MYSQL_LOCK_IGNORE_GLOBAL_READ_ONLY 0x0008
+#define MYSQL_LOCK_LOG_TABLE 0x0010
+#define MYSQL_OPEN_TAKE_UPGRADABLE_MDL 0x0020
+/**
+ Do not try to acquire a metadata lock on the table: we
+ already have one.
+*/
+#define MYSQL_OPEN_HAS_MDL_LOCK 0x0040
+/**
+ If in locked tables mode, ignore the locked tables and get
+ a new instance of the table.
+*/
+#define MYSQL_OPEN_GET_NEW_TABLE 0x0080
+/** Don't look up the table in the list of temporary tables. */
+#define MYSQL_OPEN_SKIP_TEMPORARY 0x0100
+/** Fail instead of waiting when conficting metadata lock is discovered. */
+#define MYSQL_OPEN_FAIL_ON_MDL_CONFLICT 0x0200
+/** Open tables using MDL_SHARED lock instead of one specified in parser. */
+#define MYSQL_OPEN_FORCE_SHARED_MDL 0x0400
+/**
+ Open tables using MDL_SHARED_HIGH_PRIO lock instead of one specified
+ in parser.
+*/
+#define MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL 0x0800
+/**
+ When opening or locking the table, use the maximum timeout
+ (LONG_TIMEOUT = 1 year) rather than the user-supplied timeout value.
+*/
+#define MYSQL_LOCK_IGNORE_TIMEOUT 0x1000
+
+/** Please refer to the internals manual. */
+#define MYSQL_OPEN_REOPEN (MYSQL_OPEN_IGNORE_FLUSH |\
+ MYSQL_OPEN_IGNORE_GLOBAL_READ_LOCK |\
+ MYSQL_LOCK_IGNORE_GLOBAL_READ_ONLY |\
+ MYSQL_LOCK_IGNORE_TIMEOUT |\
+ MYSQL_OPEN_GET_NEW_TABLE |\
+ MYSQL_OPEN_SKIP_TEMPORARY |\
+ MYSQL_OPEN_HAS_MDL_LOCK)
+
+
+#include "thr_lock.h" /* thr_lock_type */
+
+struct TABLE_LIST;
+class THD;
+struct TABLE;
+typedef struct st_mysql_lock MYSQL_LOCK;
+
+MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **table, uint count, uint flags);
+void mysql_unlock_tables(THD *thd, MYSQL_LOCK *sql_lock);
+void mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock);
+void mysql_unlock_some_tables(THD *thd, TABLE **table,uint count);
+void mysql_lock_remove(THD *thd, MYSQL_LOCK *locked,TABLE *table);
+void mysql_lock_abort(THD *thd, TABLE *table, bool upgrade_lock);
+void mysql_lock_downgrade_write(THD *thd, TABLE *table,
+ thr_lock_type new_lock_type);
+bool mysql_lock_abort_for_thread(THD *thd, TABLE *table);
+MYSQL_LOCK *mysql_lock_merge(MYSQL_LOCK *a,MYSQL_LOCK *b);
+TABLE_LIST *mysql_lock_have_duplicate(THD *thd, TABLE_LIST *needle,
+ TABLE_LIST *haystack);
+bool lock_global_read_lock(THD *thd);
+void unlock_global_read_lock(THD *thd);
+bool wait_if_global_read_lock(THD *thd, bool abort_on_refresh,
+ bool is_not_commit);
+void start_waiting_global_read_lock(THD *thd);
+bool make_global_read_lock_block_commit(THD *thd);
+bool set_protect_against_global_read_lock(void);
+void unset_protect_against_global_read_lock(void);
+/* Lock based on stored routine name */
+bool lock_routine_name(THD *thd, bool is_function, const char *db,
+ const char *name);
+void broadcast_refresh(void);
+int try_transactional_lock(THD *thd, TABLE_LIST *table_list);
+int check_transactional_lock(THD *thd, TABLE_LIST *table_list);
+int set_handler_table_locks(THD *thd, TABLE_LIST *table_list,
+ bool transactional);
+
+/* Lock based on name */
+int lock_and_wait_for_table_name(THD *thd, TABLE_LIST *table_list);
+int lock_table_name(THD *thd, TABLE_LIST *table_list, bool check_in_use);
+void unlock_table_name(THD *thd, TABLE_LIST *table_list);
+bool wait_for_locked_table_names(THD *thd, TABLE_LIST *table_list);
+bool lock_table_names(THD *thd, TABLE_LIST *table_list);
+void unlock_table_names(THD *thd);
+bool lock_table_names_exclusively(THD *thd, TABLE_LIST *table_list);
+bool is_table_name_exclusively_locked_by_this_thread(THD *thd,
+ TABLE_LIST *table_list);
+bool is_table_name_exclusively_locked_by_this_thread(THD *thd, uchar *key,
+ int key_length);
+void broadcast_refresh(void);
+
+
+
+#endif /* LOCK_INCLUDED */
=== modified file 'sql/log.cc'
--- a/sql/log.cc 2010-03-25 09:02:07 +0000
+++ b/sql/log.cc 2010-04-10 09:11:47 +0000
@@ -24,8 +24,17 @@
Abort logging when we get an error in reading or writing log files
*/
-#include "mysql_priv.h"
+#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
+#include "sql_priv.h"
+#include "log.h"
+#include "sql_base.h" // close_thread_tables
#include "sql_repl.h"
+#include "sql_delete.h" // mysql_truncate
+#include "sql_parse.h" // command_name
+#include "sql_time.h" // calc_time_from_sec, my_time_compare
+#include "tztime.h" // my_tz_OFFSET0, struct Time_zone
+#include "sql_acl.h" // SUPER_ACL
+#include "log_event.h" // Query_log_event
#include "rpl_filter.h"
#include "rpl_rli.h"
#include "sql_audit.h"
@@ -39,7 +48,7 @@
#include "message.h"
#endif
-#include <mysql/plugin.h>
+#include "sql_plugin.h"
#include "rpl_handler.h"
#include "si_logs.h"
=== modified file 'sql/log.h'
--- a/sql/log.h 2010-03-23 09:14:15 +0000
+++ b/sql/log.h 2010-04-08 10:50:40 +0000
@@ -16,6 +16,9 @@
#ifndef LOG_H
#define LOG_H
+#include "unireg.h" // REQUIRED: for other includes
+#include "handler.h" /* my_xid */
+
struct st_backup_history;
/**
@@ -851,4 +854,36 @@ extern TYPELIB binlog_format_typelib;
uint purge_log_get_error_code(int res);
int query_error_code(THD *thd, bool not_killed);
+int vprint_msg_to_log(enum loglevel level, const char *format, va_list args);
+void sql_print_error(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
+void sql_print_warning(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
+void sql_print_information(const char *format, ...)
+ ATTRIBUTE_FORMAT(printf, 1, 2);
+typedef void (*sql_print_message_func)(const char *format, ...)
+ ATTRIBUTE_FORMAT(printf, 1, 2);
+extern sql_print_message_func sql_print_message_handlers[];
+
+int error_log_print(enum loglevel level, const char *format,
+ va_list args);
+
+bool slow_log_print(THD *thd, const char *query, uint query_length,
+ ulonglong current_utime);
+
+bool general_log_print(THD *thd, enum enum_server_command command,
+ const char *format,...);
+
+bool general_log_write(THD *thd, enum enum_server_command command,
+ const char *query, uint query_length);
+
+void sql_perror(const char *message);
+bool flush_error_log();
+
+File open_binlog(IO_CACHE *log, const char *log_file_name,
+ const char **errmsg);
+
+char *make_log_name(char *buff, const char *name, const char* log_ext);
+
+extern MYSQL_PLUGIN_IMPORT MYSQL_BIN_LOG mysql_bin_log;
+extern LOGGER logger;
+
#endif /* LOG_H */
=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc 2010-03-25 09:02:07 +0000
+++ b/sql/log_event.cc 2010-04-09 08:22:10 +0000
@@ -16,7 +16,8 @@
#ifdef MYSQL_CLIENT
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#else
@@ -24,7 +25,20 @@
#pragma implementation // gcc: Class implementation
#endif
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h"
+#include "my_global.h" // REQUIRED by log_event.h > m_string.h > my_bitmap.h
+#include "log_event.h"
+#include "sql_base.h" // close_thread_tables
+#include "sql_cache.h" // QUERY_CACHE_FLAGS_SIZE
+#include "sql_locale.h" // MY_LOCALE, my_locale_by_number, my_locale_en_US
+#include "key.h" // key_copy
+#include "lock.h" // mysql_unlock_tables
+#include "sql_parse.h" // mysql_test_parse_for_slave
+#include "tztime.h" // struct Time_zone
+#include "sql_load.h" // mysql_load
+#include "sql_db.h" // load_db_opt_by_name
#include "slave.h"
#include "rpl_rli.h"
#include "rpl_mi.h"
=== modified file 'sql/log_event.h'
--- a/sql/log_event.h 2010-03-25 09:02:07 +0000
+++ b/sql/log_event.h 2010-04-08 10:50:40 +0000
@@ -28,7 +28,7 @@
#ifndef _log_event_h
#define _log_event_h
-#if defined(USE_PRAGMA_INTERFACE) && !defined(MYSQL_CLIENT)
+#if defined(USE_PRAGMA_INTERFACE) && defined(MYSQL_SERVER)
#pragma interface /* gcc class implementation */
#endif
@@ -36,17 +36,22 @@
#include "rpl_constants.h"
#ifdef MYSQL_CLIENT
+#include "sql_const.h"
#include "rpl_utility.h"
#include "hash.h"
#include "rpl_tblmap.h"
#include "rpl_tblmap.cc"
#endif
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
#include "rpl_record.h"
#include "rpl_reporting.h"
+#include "sql_class.h" /* THD */
#endif
+/* Forward declarations */
+class String;
+
#define PREFIX_SQL_LOAD "SQL_LOAD-"
/**
@@ -607,7 +612,7 @@ enum Int_event_type
};
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
class String;
class MYSQL_BIN_LOG;
class THD;
@@ -685,11 +690,9 @@ typedef struct st_print_event_info
uint8 common_header_len;
char delimiter[16];
-#ifdef MYSQL_CLIENT
uint verbose;
table_mapping m_table_map;
table_mapping m_table_map_ignored;
-#endif
/*
These two caches are used by the row-based replication events to
@@ -963,7 +966,7 @@ public:
*/
ulong slave_exec_mode;
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
THD* thd;
Log_event();
@@ -1035,7 +1038,7 @@ public:
static void *operator new(size_t, void* ptr) { return ptr; }
static void operator delete(void*, void*) { }
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
bool write_header(IO_CACHE* file, ulong data_length);
virtual bool write(IO_CACHE* file)
{
@@ -1109,7 +1112,7 @@ public:
/* Return start of query time or current time */
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
+#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
public:
/**
@@ -1413,7 +1416,7 @@ protected:
<td>Q_SQL_MODE_CODE == 1</td>
<td>8 byte bitfield</td>
<td>The @c sql_mode variable. See the section "SQL Modes" in the
- MySQL manual, and see mysql_priv.h for a list of the possible
+ MySQL manual, and see sql_priv.h for a list of the possible
flags. Currently (2007-10-04), the following flags are available:
<pre>
MODE_REAL_AS_FLOAT==0x1
@@ -1697,7 +1700,7 @@ public:
*/
uint32 master_data_written;
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
Query_log_event(THD* thd_arg, const char* query_arg, ulong query_length,
bool using_trans, bool direct, bool suppress_use, int error);
@@ -1720,7 +1723,7 @@ public:
my_free((uchar*) data_buf, MYF(0));
}
Log_event_type get_type_code() { return QUERY_EVENT; }
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
bool write(IO_CACHE* file);
virtual bool write_post_header_for_derived(IO_CACHE* file) { return FALSE; }
#endif
@@ -1734,7 +1737,7 @@ public:
/* Writes derived event-specific part of post header. */
public: /* !!! Public in this patch to allow old usage */
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
+#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
virtual int do_apply_event(Relay_log_info const *rli);
virtual int do_update_pos(Relay_log_info *rli);
@@ -1809,7 +1812,7 @@ public:
int master_log_len;
uint16 master_port;
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
Slave_log_event(THD* thd_arg, Relay_log_info* rli);
void pack_info(Protocol* protocol);
#else
@@ -1821,12 +1824,12 @@ public:
int get_data_size();
bool is_valid() const { return master_host != 0; }
Log_event_type get_type_code() { return SLAVE_EVENT; }
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
bool write(IO_CACHE* file);
#endif
private:
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
+#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
virtual int do_apply_event(Relay_log_info const* rli);
#endif
};
@@ -2080,7 +2083,7 @@ public:
return local_fname;
}
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
String field_lens_buf;
String fields_buf;
@@ -2113,7 +2116,7 @@ public:
{
return sql_ex.new_format() ? NEW_LOAD_EVENT: LOAD_EVENT;
}
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
bool write_data_header(IO_CACHE* file);
bool write_data_body(IO_CACHE* file);
#endif
@@ -2126,7 +2129,7 @@ public:
}
public: /* !!! Public in this patch to allow old usage */
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
+#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
virtual int do_apply_event(Relay_log_info const* rli)
{
return do_apply_event(thd->slave_net,rli,0);
@@ -2188,7 +2191,7 @@ public:
*/
bool dont_set_created;
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
Start_log_event_v3();
#ifdef HAVE_REPLICATION
void pack_info(Protocol* protocol);
@@ -2202,7 +2205,7 @@ public:
const Format_description_log_event* description_event);
~Start_log_event_v3() {}
Log_event_type get_type_code() { return START_EVENT_V3;}
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
bool write(IO_CACHE* file);
#endif
bool is_valid() const { return 1; }
@@ -2212,7 +2215,7 @@ public:
}
protected:
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
+#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
virtual int do_apply_event(Relay_log_info const *rli);
virtual enum_skip_reason do_shall_skip(Relay_log_info*)
{
@@ -2264,7 +2267,7 @@ public:
my_free((uchar*)post_header_len, MYF(MY_ALLOW_ZERO_PTR));
}
Log_event_type get_type_code() { return FORMAT_DESCRIPTION_EVENT;}
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
bool write(IO_CACHE* file);
#endif
bool is_valid() const
@@ -2286,7 +2289,7 @@ public:
void calc_server_version_split();
protected:
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
+#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
virtual int do_apply_event(Relay_log_info const *rli);
virtual int do_update_pos(Relay_log_info *rli);
virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
@@ -2338,7 +2341,7 @@ public:
ulonglong val;
uchar type;
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
Intvar_log_event(THD* thd_arg,uchar type_arg, ulonglong val_arg)
:Log_event(thd_arg,0,0),val(val_arg),type(type_arg)
{}
@@ -2355,13 +2358,13 @@ public:
Log_event_type get_type_code() { return INTVAR_EVENT;}
const char* get_var_type_name();
int get_data_size() { return 9; /* sizeof(type) + sizeof(val) */;}
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
bool write(IO_CACHE* file);
#endif
bool is_valid() const { return 1; }
private:
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
+#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
virtual int do_apply_event(Relay_log_info const *rli);
virtual int do_update_pos(Relay_log_info *rli);
virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
@@ -2414,7 +2417,7 @@ class Rand_log_event: public Log_event
ulonglong seed1;
ulonglong seed2;
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
Rand_log_event(THD* thd_arg, ulonglong seed1_arg, ulonglong seed2_arg)
:Log_event(thd_arg,0,0),seed1(seed1_arg),seed2(seed2_arg)
{}
@@ -2430,13 +2433,13 @@ class Rand_log_event: public Log_event
~Rand_log_event() {}
Log_event_type get_type_code() { return RAND_EVENT;}
int get_data_size() { return 16; /* sizeof(ulonglong) * 2*/ }
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
bool write(IO_CACHE* file);
#endif
bool is_valid() const { return 1; }
private:
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
+#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
virtual int do_apply_event(Relay_log_info const *rli);
virtual int do_update_pos(Relay_log_info *rli);
virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
@@ -2460,7 +2463,7 @@ class Xid_log_event: public Log_event
public:
my_xid xid;
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
Xid_log_event(THD* thd_arg, my_xid x): Log_event(thd_arg,0,0), xid(x) {}
#ifdef HAVE_REPLICATION
void pack_info(Protocol* protocol);
@@ -2474,13 +2477,13 @@ class Xid_log_event: public Log_event
~Xid_log_event() {}
Log_event_type get_type_code() { return XID_EVENT;}
int get_data_size() { return sizeof(xid); }
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
bool write(IO_CACHE* file);
#endif
bool is_valid() const { return 1; }
private:
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
+#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
virtual int do_apply_event(Relay_log_info const *rli);
enum_skip_reason do_shall_skip(Relay_log_info *rli);
#endif
@@ -2510,7 +2513,7 @@ public:
uint charset_number;
bool is_null;
uchar flags;
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
User_var_log_event(THD* thd_arg, char *name_arg, uint name_len_arg,
char *val_arg, ulong val_len_arg, Item_result type_arg,
uint charset_number_arg, uchar flags_arg)
@@ -2527,13 +2530,13 @@ public:
const Format_description_log_event *description_event);
~User_var_log_event() {}
Log_event_type get_type_code() { return USER_VAR_EVENT;}
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
bool write(IO_CACHE* file);
#endif
bool is_valid() const { return 1; }
private:
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
+#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
virtual int do_apply_event(Relay_log_info const *rli);
virtual int do_update_pos(Relay_log_info *rli);
virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
@@ -2552,7 +2555,7 @@ private:
class Stop_log_event: public Log_event
{
public:
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
Stop_log_event() :Log_event()
{}
#else
@@ -2568,7 +2571,7 @@ public:
bool is_valid() const { return 1; }
private:
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
+#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
virtual int do_update_pos(Relay_log_info *rli);
virtual enum_skip_reason do_shall_skip(Relay_log_info *rli)
{
@@ -2644,7 +2647,7 @@ public:
ulonglong pos;
uint ident_len;
uint flags;
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
Rotate_log_event(const char* new_log_ident_arg,
uint ident_len_arg,
ulonglong pos_arg, uint flags);
@@ -2665,12 +2668,12 @@ public:
Log_event_type get_type_code() { return ROTATE_EVENT;}
int get_data_size() { return ident_len + ROTATE_HEADER_LEN;}
bool is_valid() const { return new_log_ident != 0; }
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
bool write(IO_CACHE* file);
#endif
private:
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
+#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
virtual int do_update_pos(Relay_log_info *rli);
virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
#endif
@@ -2701,7 +2704,7 @@ public:
uint file_id;
bool inited_from_old;
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
Create_file_log_event(THD* thd, sql_exchange* ex, const char* db_arg,
const char* table_name_arg,
List<Item>& fields_arg,
@@ -2735,7 +2738,7 @@ public:
4 + 1 + block_len);
}
bool is_valid() const { return inited_from_old || block != 0; }
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
bool write_data_header(IO_CACHE* file);
bool write_data_body(IO_CACHE* file);
/*
@@ -2746,7 +2749,7 @@ public:
#endif
private:
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
+#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
virtual int do_apply_event(Relay_log_info const *rli);
#endif
};
@@ -2777,7 +2780,7 @@ public:
*/
const char* db;
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
Append_block_log_event(THD* thd, const char* db_arg, uchar* block_arg,
uint block_len_arg, bool using_trans);
#ifdef HAVE_REPLICATION
@@ -2795,13 +2798,13 @@ public:
Log_event_type get_type_code() { return APPEND_BLOCK_EVENT;}
int get_data_size() { return block_len + APPEND_BLOCK_HEADER_LEN ;}
bool is_valid() const { return block != 0; }
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
bool write(IO_CACHE* file);
const char* get_db() { return db; }
#endif
private:
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
+#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
virtual int do_apply_event(Relay_log_info const *rli);
#endif
};
@@ -2819,7 +2822,7 @@ public:
uint file_id;
const char* db; /* see comment in Append_block_log_event */
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
Delete_file_log_event(THD* thd, const char* db_arg, bool using_trans);
#ifdef HAVE_REPLICATION
void pack_info(Protocol* protocol);
@@ -2836,13 +2839,13 @@ public:
Log_event_type get_type_code() { return DELETE_FILE_EVENT;}
int get_data_size() { return DELETE_FILE_HEADER_LEN ;}
bool is_valid() const { return file_id != 0; }
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
bool write(IO_CACHE* file);
const char* get_db() { return db; }
#endif
private:
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
+#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
virtual int do_apply_event(Relay_log_info const *rli);
#endif
};
@@ -2860,7 +2863,7 @@ public:
uint file_id;
const char* db; /* see comment in Append_block_log_event */
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
Execute_load_log_event(THD* thd, const char* db_arg, bool using_trans);
#ifdef HAVE_REPLICATION
void pack_info(Protocol* protocol);
@@ -2876,13 +2879,13 @@ public:
Log_event_type get_type_code() { return EXEC_LOAD_EVENT;}
int get_data_size() { return EXEC_LOAD_HEADER_LEN ;}
bool is_valid() const { return file_id != 0; }
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
bool write(IO_CACHE* file);
const char* get_db() { return db; }
#endif
private:
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
+#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
virtual int do_apply_event(Relay_log_info const *rli);
#endif
};
@@ -2900,7 +2903,7 @@ private:
class Begin_load_query_log_event: public Append_block_log_event
{
public:
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
Begin_load_query_log_event(THD* thd_arg, const char *db_arg,
uchar* block_arg, uint block_len_arg,
bool using_trans);
@@ -2915,7 +2918,7 @@ public:
~Begin_load_query_log_event() {}
Log_event_type get_type_code() { return BEGIN_LOAD_QUERY_EVENT; }
private:
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
+#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
#endif
};
@@ -2951,7 +2954,7 @@ public:
*/
enum_load_dup_handling dup_handling;
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
Execute_load_query_log_event(THD* thd, const char* query_arg,
ulong query_length, uint fn_pos_start_arg,
uint fn_pos_end_arg,
@@ -2976,12 +2979,12 @@ public:
bool is_valid() const { return Query_log_event::is_valid() && file_id != 0; }
ulong get_post_header_size_for_derived();
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
bool write_post_header_for_derived(IO_CACHE* file);
#endif
private:
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
+#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
virtual int do_apply_event(Relay_log_info const *rli);
#endif
};
@@ -3371,7 +3374,7 @@ public:
flag_set get_flags(flag_set flag) const { return m_flags & flag; }
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
Table_map_log_event(THD *thd, TABLE *tbl, ulong tid, bool is_transactional);
#endif
#ifdef HAVE_REPLICATION
@@ -3396,14 +3399,14 @@ public:
virtual bool is_valid() const { return m_memory != NULL; /* we check malloc */ }
virtual int get_data_size() { return m_data_size; }
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
virtual int save_field_metadata();
virtual bool write_data_header(IO_CACHE *file);
virtual bool write_data_body(IO_CACHE *file);
virtual const char *get_db() { return m_dbnam; }
#endif
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
+#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
virtual void pack_info(Protocol *protocol);
#endif
@@ -3413,13 +3416,13 @@ public:
private:
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
+#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
virtual int do_apply_event(Relay_log_info const *rli);
virtual int do_update_pos(Relay_log_info *rli);
virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
#endif
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
TABLE *m_table;
#endif
char const *m_dbnam;
@@ -3515,7 +3518,7 @@ public:
void clear_flags(flag_set flags_arg) { m_flags &= ~flags_arg; }
flag_set get_flags(flag_set flags_arg) const { return m_flags & flags_arg; }
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
+#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
virtual void pack_info(Protocol *protocol);
#endif
@@ -3530,7 +3533,7 @@ public:
const uchar *ptr, const uchar *prefix);
#endif
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
int add_row_data(uchar *data, size_t length)
{
return do_add_row_data(data,length);
@@ -3544,7 +3547,7 @@ public:
size_t get_width() const { return m_width; }
ulong get_table_id() const { return m_table_id; }
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
virtual bool write_data_header(IO_CACHE *file);
virtual bool write_data_body(IO_CACHE *file);
virtual const char *get_db() { return m_table->s->db.str; }
@@ -3567,7 +3570,7 @@ protected:
The constructors are protected since you're supposed to inherit
this class, not create instances of this class.
*/
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
Rows_log_event(THD*, TABLE*, ulong table_id,
MY_BITMAP const *cols, bool is_transactional);
#endif
@@ -3579,11 +3582,11 @@ protected:
void print_helper(FILE *, PRINT_EVENT_INFO *, char const *const name);
#endif
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
virtual int do_add_row_data(uchar *data, size_t length);
#endif
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
TABLE *m_table; /* The table the rows belong to */
#endif
ulong m_table_id; /* Table ID */
@@ -3612,7 +3615,7 @@ protected:
/* helper functions */
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
+#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
const uchar *m_curr_row; /* Start of the row being processed */
const uchar *m_curr_row_end; /* One-after the end of the current row */
uchar *m_key; /* Buffer to keep key value during searches */
@@ -3641,7 +3644,7 @@ protected:
private:
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
+#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
virtual int do_apply_event(Relay_log_info const *rli);
virtual int do_update_pos(Relay_log_info *rli);
virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
@@ -3696,7 +3699,7 @@ private:
*/
virtual int do_exec_row(const Relay_log_info *const rli) = 0;
-#endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */
+#endif /* defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) */
friend class Old_rows_log_event;
};
@@ -3719,7 +3722,7 @@ public:
TYPE_CODE = WRITE_ROWS_EVENT
};
-#if !defined(MYSQL_CLIENT)
+#if defined(MYSQL_SERVER)
Write_rows_log_event(THD*, TABLE*, ulong table_id,
bool is_transactional);
#endif
@@ -3727,7 +3730,7 @@ public:
Write_rows_log_event(const char *buf, uint event_len,
const Format_description_log_event *description_event);
#endif
-#if !defined(MYSQL_CLIENT)
+#if defined(MYSQL_SERVER)
static bool binlog_row_logging_function(THD *thd, TABLE *table,
bool is_transactional,
const uchar *before_record
@@ -3745,7 +3748,7 @@ private:
void print(FILE *file, PRINT_EVENT_INFO *print_event_info);
#endif
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
+#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
virtual int do_before_row_operations(const Slave_reporting_capability *const);
virtual int do_after_row_operations(const Slave_reporting_capability *const,int);
virtual int do_exec_row(const Relay_log_info *const);
@@ -3774,7 +3777,7 @@ public:
TYPE_CODE = UPDATE_ROWS_EVENT
};
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
Update_rows_log_event(THD*, TABLE*, ulong table_id,
bool is_transactional);
@@ -3788,7 +3791,7 @@ public:
const Format_description_log_event *description_event);
#endif
-#if !defined(MYSQL_CLIENT)
+#ifdef MYSQL_SERVER
static bool binlog_row_logging_function(THD *thd, TABLE *table,
bool is_transactional,
const uchar *before_record,
@@ -3811,11 +3814,11 @@ protected:
void print(FILE *file, PRINT_EVENT_INFO *print_event_info);
#endif
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
+#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
virtual int do_before_row_operations(const Slave_reporting_capability *const);
virtual int do_after_row_operations(const Slave_reporting_capability *const,int);
virtual int do_exec_row(const Relay_log_info *const);
-#endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */
+#endif /* defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) */
};
/**
@@ -3847,7 +3850,7 @@ public:
TYPE_CODE = DELETE_ROWS_EVENT
};
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
Delete_rows_log_event(THD*, TABLE*, ulong,
bool is_transactional);
#endif
@@ -3855,7 +3858,7 @@ public:
Delete_rows_log_event(const char *buf, uint event_len,
const Format_description_log_event *description_event);
#endif
-#if !defined(MYSQL_CLIENT)
+#ifdef MYSQL_SERVER
static bool binlog_row_logging_function(THD *thd, TABLE *table,
bool is_transactional,
const uchar *before_record,
@@ -3873,7 +3876,7 @@ protected:
void print(FILE *file, PRINT_EVENT_INFO *print_event_info);
#endif
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
+#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
virtual int do_before_row_operations(const Slave_reporting_capability *const);
virtual int do_after_row_operations(const Slave_reporting_capability *const,int);
virtual int do_exec_row(const Relay_log_info *const);
@@ -3921,7 +3924,7 @@ protected:
*/
class Incident_log_event : public Log_event {
public:
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
Incident_log_event(THD *thd_arg, Incident incident)
: Log_event(thd_arg, 0, FALSE), m_incident(incident)
{
@@ -3944,7 +3947,7 @@ public:
}
#endif
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
void pack_info(Protocol*);
#endif
@@ -3957,7 +3960,7 @@ public:
virtual void print(FILE *file, PRINT_EVENT_INFO *print_event_info);
#endif
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
+#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
virtual int do_apply_event(Relay_log_info const *rli);
#endif
@@ -3989,7 +3992,7 @@ static inline bool copy_event_cache_to_f
reinit_io_cache(cache, WRITE_CACHE, 0, FALSE, TRUE);
}
-#ifndef MYSQL_CLIENT
+#ifdef MYSQL_SERVER
/*****************************************************************************
Heartbeat Log Event class
@@ -4025,6 +4028,9 @@ private:
};
#endif
+int append_query_string(CHARSET_INFO *csinfo,
+ String const *from, String *to);
+
/**
@} (end of group Replication)
*/
=== modified file 'sql/log_event_old.cc'
--- a/sql/log_event_old.cc 2010-03-25 09:02:07 +0000
+++ b/sql/log_event_old.cc 2010-04-09 08:22:10 +0000
@@ -1,6 +1,17 @@
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#ifndef MYSQL_CLIENT
+#include "unireg.h"
+#endif
+#include "my_global.h" // REQUIRED by log_event.h > m_string.h > my_bitmap.h
+#include "log_event.h"
+#ifndef MYSQL_CLIENT
+#include "sql_cache.h" // QUERY_CACHE_FLAGS_SIZE
+#include "sql_base.h" // close_tables_for_reopen
+#include "key.h" // key_copy
+#include "lock.h" // mysql_unlock_tables
+#include "sql_parse.h" // mysql_reset_thd_for_next_command
#include "rpl_rli.h"
#include "rpl_utility.h"
#endif
=== modified file 'sql/mf_iocache.cc'
--- a/sql/mf_iocache.cc 2007-10-11 17:29:09 +0000
+++ b/sql/mf_iocache.cc 2010-04-09 08:22:10 +0000
@@ -32,7 +32,9 @@
flush_io_cache().
*/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "sql_class.h" // THD
#ifdef HAVE_REPLICATION
extern "C" {
=== modified file 'sql/my_decimal.cc'
--- a/sql/my_decimal.cc 2010-02-15 08:09:44 +0000
+++ b/sql/my_decimal.cc 2010-04-09 08:22:10 +0000
@@ -13,9 +13,13 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#include <time.h>
+#ifndef MYSQL_CLIENT
+#include "sql_class.h" // THD
+#endif
#ifndef MYSQL_CLIENT
/**
=== modified file 'sql/my_decimal.h'
--- a/sql/my_decimal.h 2009-12-08 09:26:11 +0000
+++ b/sql/my_decimal.h 2010-03-31 14:05:33 +0000
@@ -28,10 +28,17 @@
#ifndef my_decimal_h
#define my_decimal_h
+#if defined(MYSQL_SERVER) || defined(EMBEDDED_LIBRARY)
+#include "sql_string.h" /* String */
+#endif
+
C_MODE_START
#include <decimal.h>
C_MODE_END
+class String;
+typedef struct st_mysql_time MYSQL_TIME;
+
#define DECIMAL_LONGLONG_DIGITS 22
#define DECIMAL_LONG_DIGITS 10
#define DECIMAL_LONG3_DIGITS 8
@@ -133,6 +140,12 @@ const char *dbug_decimal_as_string(char
#define dbug_decimal_as_string(A) NULL
#endif
+bool str_set_decimal(uint mask, const my_decimal *val, uint fixed_prec,
+ uint fixed_dec, char filler, String *str,
+ CHARSET_INFO *cs);
+
+extern my_decimal decimal_zero;
+
#ifndef MYSQL_CLIENT
int decimal_operation_results(int result);
#else
@@ -289,7 +302,14 @@ int my_decimal_ceiling(uint mask, const
}
+inline bool str_set_decimal(const my_decimal *val, String *str,
+ CHARSET_INFO *cs)
+{
+ return str_set_decimal(E_DEC_FATAL_ERROR, val, 0, 0, 0, str, cs);
+}
+
#ifndef MYSQL_CLIENT
+class String;
int my_decimal2string(uint mask, const my_decimal *d, uint fixed_prec,
uint fixed_dec, char filler, String *str);
#endif
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2010-03-25 09:02:07 +0000
+++ b/sql/mysqld.cc 2010-04-10 09:11:47 +0000
@@ -13,7 +13,44 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "mysql_priv.h"
+#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
+#include "sql_priv.h"
+#include "unireg.h"
+#include "mysqld.h"
+#include <signal.h>
+#ifndef __WIN__
+#include <netdb.h> // getservbyname, servent
+#endif
+#include "sql_parse.h" // test_if_data_home_dir
+#include "sql_cache.h" // query_cache, query_cache_*
+#include "sql_locale.h" // MY_LOCALES, my_locales, my_locale_by_name
+#include "sql_show.h" // free_status_vars, add_status_vars,
+ // reset_status_vars
+#include "strfunc.h" // find_set_from_flags
+#include "parse_file.h" // File_parser_dummy_hook
+#include "sql_db.h" // my_database_names_free,
+ // my_database_names_init
+#include "sql_table.h" // release_ddl_log, execute_ddl_log_recovery
+#include "sql_connect.h" // free_max_user_conn, init_max_user_conn,
+ // handle_one_connection
+#include "sql_time.h" // known_date_time_formats,
+ // get_date_time_format_str,
+ // date_time_format_make
+#include "tztime.h" // my_tz_free, my_tz_init, my_tz_SYSTEM
+#include "hostname.h" // hostname_cache_free, hostname_cache_init
+#include "sql_acl.h" // acl_free, grant_free, acl_init,
+ // grant_init
+#include "sql_base.h" // table_def_free, table_def_init,
+ // cached_open_tables,
+ // cached_table_definitions
+#include "sql_test.h" // mysql_print_status
+#include "item_create.h" // item_create_cleanup, item_create_init
+#include "sql_servers.h" // servers_free, servers_init
+#include "init.h" // unireg_init
+#include "derror.h" // init_errmessage
+#include "derror.h" // init_errmessage
+#include "des_key_file.h" // load_des_key_file
+#include "sql_manager.h" // stop_handle_manager, start_handle_manager
#include <m_ctype.h>
#include <my_dir.h>
#include <my_bit.h>
=== added file 'sql/mysqld.h'
--- a/sql/mysqld.h 1970-01-01 00:00:00 +0000
+++ b/sql/mysqld.h 2010-04-12 13:36:36 +0000
@@ -0,0 +1,510 @@
+/* Copyright 2006-2008 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MYSQLD_INCLUDED
+#define MYSQLD_INCLUDED
+
+#include "my_global.h" /* MYSQL_PLUGIN_IMPORT, FN_REFLEN, FN_EXTLEN */
+#include "sql_bitmap.h" /* Bitmap */
+#include "my_decimal.h" /* my_decimal */
+#include "mysql_com.h" /* SERVER_VERSION_LENGTH */
+#include "my_atomic.h" /* my_atomic_rwlock_t */
+#include "mysql/psi/mysql_file.h" /* MYSQL_FILE */
+#include "sql_list.h" /* I_List */
+
+class THD;
+struct handlerton;
+class Time_zone;
+
+class scheduler_functions;
+
+typedef struct st_mysql_const_lex_string LEX_CSTRING;
+typedef struct st_mysql_show_var SHOW_VAR;
+
+/*
+ This forward declaration is used from C files where the real
+ definition is included before. Since C does not allow repeated
+ typedef declarations, even when identical, the definition may not be
+ repeated.
+*/
+#ifndef CHARSET_INFO_DEFINED
+typedef struct charset_info_st CHARSET_INFO;
+#endif /* CHARSET_INFO_DEFINED */
+
+#if MAX_INDEXES <= 64
+typedef Bitmap<64> key_map; /* Used for finding keys */
+#else
+typedef Bitmap<((MAX_INDEXES+7)/8*8)> key_map; /* Used for finding keys */
+#endif
+
+ /* Bits from testflag */
+#define TEST_PRINT_CACHED_TABLES 1
+#define TEST_NO_KEY_GROUP 2
+#define TEST_MIT_THREAD 4
+#define TEST_BLOCKING 8
+#define TEST_KEEP_TMP_TABLES 16
+#define TEST_READCHECK 64 /**< Force use of readcheck */
+#define TEST_NO_EXTRA 128
+#define TEST_CORE_ON_SIGNAL 256 /**< Give core if signal */
+#define TEST_NO_STACKTRACE 512
+#define TEST_SIGINT 1024 /**< Allow sigint on threads */
+#define TEST_SYNCHRONIZATION 2048 /**< get server to do sleep in
+ some places */
+/* Function prototypes */
+void kill_mysql(void);
+void close_connection(THD *thd, uint errcode, bool lock);
+void handle_connection_in_main_thread(THD *thd);
+void create_thread_to_handle_connection(THD *thd);
+void unlink_thd(THD *thd);
+bool one_thread_per_connection_end(THD *thd, bool put_in_cache);
+void flush_thread_cache();
+void refresh_status(THD *thd);
+bool is_usable_directory(THD *thd, const char *varname,
+ const char *path, const char *prefix);
+
+extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *system_charset_info;
+extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *files_charset_info ;
+extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *national_charset_info;
+extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *table_alias_charset;
+
+extern TYPELIB log_output_typelib;
+extern const char *log_output_names[];
+
+/**
+ Character set of the buildin error messages loaded from errmsg.sys.
+*/
+extern CHARSET_INFO *error_message_charset_info;
+
+extern CHARSET_INFO *character_set_filesystem;
+
+extern MY_BITMAP temp_pool;
+extern bool opt_large_files, server_id_supplied;
+extern bool opt_update_log, opt_bin_log, opt_error_log;
+extern my_bool opt_log, opt_slow_log;
+extern my_bool opt_backup_history_log;
+extern my_bool opt_backup_progress_log;
+extern my_bool opt_mysql_backup;
+extern ulonglong log_output_options;
+extern ulonglong log_backup_output_options;
+extern my_bool opt_log_queries_not_using_indexes;
+extern bool opt_disable_networking, opt_skip_show_db;
+extern bool opt_ignore_builtin_innodb;
+extern my_bool opt_character_set_client_handshake;
+extern bool volatile abort_loop;
+extern bool in_bootstrap;
+extern uint volatile thread_count, global_read_lock;
+extern uint connection_count;
+extern my_bool opt_sql_bin_update, opt_safe_user_create, opt_no_mix_types;
+extern my_bool opt_safe_show_db, opt_local_infile, opt_myisam_use_mmap;
+extern my_bool opt_slave_compressed_protocol, use_temp_pool;
+extern uint slave_exec_mode_options;
+extern ulonglong slave_type_conversions_options;
+extern my_bool opt_readonly, lower_case_file_system;
+extern my_bool opt_enable_named_pipe, opt_sync_frm, opt_allow_suspicious_udfs;
+extern my_bool opt_secure_auth;
+extern char* opt_secure_file_priv;
+extern char* opt_secure_backup_file_priv;
+extern size_t opt_secure_backup_file_priv_len;
+extern my_bool opt_log_slow_admin_statements, opt_log_slow_slave_statements;
+extern my_bool sp_automatic_privileges, opt_noacl;
+extern my_bool disable_slaves;
+extern my_bool opt_old_style_user_limits, trust_function_creators;
+extern uint opt_crash_binlog_innodb;
+extern char *shared_memory_base_name, *mysqld_unix_port;
+extern my_bool opt_enable_shared_memory;
+extern char *default_tz_name;
+extern Time_zone *default_tz;
+extern char *default_storage_engine;
+extern bool opt_endinfo, using_udf_functions;
+extern my_bool locked_in_memory;
+extern bool opt_using_transactions;
+extern ulong current_pid;
+extern ulong expire_logs_days;
+extern my_bool relay_log_recovery;
+extern uint sync_binlog_period, sync_relaylog_period,
+ sync_relayloginfo_period, sync_masterinfo_period;
+extern ulong opt_tc_log_size, tc_log_max_pages_used, tc_log_page_size;
+extern ulong tc_log_page_waits;
+extern my_bool relay_log_purge, opt_innodb_safe_binlog, opt_innodb;
+extern my_bool relay_log_recovery;
+extern uint test_flags,select_errors,ha_open_options;
+extern uint protocol_version, mysqld_port, dropping_tables;
+extern uint delay_key_write_options;
+extern char *opt_logname, *opt_slow_logname;
+extern char *opt_backup_history_logname, *opt_backup_progress_logname,
+ *opt_backup_settings_name, *opt_backupdir;
+extern const char *log_output_str;
+extern const char *log_backup_output_str;
+extern char *mysql_home_ptr, *pidfile_name_ptr;
+extern char glob_hostname[FN_REFLEN], mysql_home[FN_REFLEN];
+extern char pidfile_name[FN_REFLEN], system_time_zone[30], *opt_init_file;
+extern char default_logfile_name[FN_REFLEN];
+extern char log_error_file[FN_REFLEN], *opt_tc_log_file;
+extern const double log_10[309];
+extern ulonglong keybuff_size;
+extern ulonglong thd_startup_options;
+extern ulong thread_id;
+extern ulong binlog_cache_use, binlog_cache_disk_use;
+extern ulong aborted_threads,aborted_connects;
+extern ulong delayed_insert_timeout;
+extern ulong delayed_insert_limit, delayed_queue_size;
+extern ulong delayed_insert_threads, delayed_insert_writes;
+extern ulong delayed_rows_in_use,delayed_insert_errors;
+extern ulong slave_open_temp_tables;
+extern ulong query_cache_size, query_cache_min_res_unit;
+extern ulong slow_launch_threads, slow_launch_time;
+extern ulong table_cache_size, table_def_size;
+extern MYSQL_PLUGIN_IMPORT ulong max_connections;
+extern ulong max_connect_errors, connect_timeout;
+extern my_bool slave_allow_batching;
+extern my_bool allow_slave_start;
+extern LEX_CSTRING reason_slave_blocked;
+extern ulong slave_trans_retries;
+extern uint slave_net_timeout;
+extern uint max_user_connections;
+extern ulong what_to_log,flush_time;
+extern ulong query_buff_size;
+extern ulong max_prepared_stmt_count, prepared_stmt_count;
+extern ulong binlog_cache_size, open_files_limit;
+extern ulonglong max_binlog_cache_size;
+extern ulong max_binlog_size, max_relay_log_size;
+extern ulong opt_binlog_rows_event_max_size;
+extern ulong rpl_recovery_rank, thread_cache_size, thread_pool_size;
+extern ulong back_log;
+extern char language[FN_REFLEN];
+extern ulong server_id, concurrency;
+extern time_t server_start_time, flush_status_time;
+extern char *opt_mysql_tmpdir, mysql_charsets_dir[];
+extern int mysql_unpacked_real_data_home_len;
+extern MYSQL_PLUGIN_IMPORT MY_TMPDIR mysql_tmpdir_list;
+extern const char *first_keyword, *delayed_user, *binary_keyword;
+extern MYSQL_PLUGIN_IMPORT const char *my_localhost;
+extern MYSQL_PLUGIN_IMPORT const char **errmesg; /* Error messages */
+extern const char *myisam_recover_options_str;
+extern const char *in_left_expr_name, *in_additional_cond, *in_having_cond;
+extern SHOW_VAR status_vars[];
+extern struct system_variables max_system_variables;
+extern struct system_status_var global_status_var;
+extern struct my_rnd_struct sql_rand;
+extern const char *opt_date_time_formats[];
+extern handlerton *partition_hton;
+extern handlerton *myisam_hton;
+extern handlerton *heap_hton;
+extern const char *load_default_groups[];
+extern struct my_option my_long_options[];
+extern int mysqld_server_started;
+extern int orig_argc;
+extern char **orig_argv;
+extern pthread_attr_t connection_attrib;
+extern MYSQL_FILE *bootstrap_file;
+extern my_bool old_mode;
+extern LEX_STRING opt_init_connect, opt_init_slave;
+extern int bootstrap_error;
+extern FILE *stderror_file;
+extern I_List<THD> threads;
+extern char err_shared_dir[];
+extern scheduler_functions thread_scheduler;
+extern TYPELIB thread_handling_typelib;
+extern my_decimal decimal_zero;
+
+extern pthread_key(MEM_ROOT**,THR_MALLOC);
+
+#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_MMAP
+extern PSI_mutex_key key_PAGE_lock, key_LOCK_sync, key_LOCK_active,
+ key_LOCK_pool;
+#endif /* HAVE_MMAP */
+
+#ifdef HAVE_OPENSSL
+extern PSI_mutex_key key_LOCK_des_key_file;
+#endif
+
+extern PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_prep_xids,
+ key_delayed_insert_mutex, key_hash_filo_lock, key_LOCK_active_mi,
+ 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_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,
+ key_LOCK_user_conn, key_LOCK_uuid_short, key_LOG_LOCK_log,
+ key_mutex_rpl_info_data_lock, key_mutex_rpl_info_run_lock,
+ key_mutex_slave_reporting_capability_err_lock, key_relay_log_info_data_lock,
+ key_relay_log_info_log_space_lock, key_relay_log_info_run_lock,
+ key_structure_guard_mutex, key_TABLE_SHARE_LOCK_ha_data,
+ key_LOCK_error_messages, key_HA_DATA_PARTITION_mutex,
+ key_LOCK_thread_count;
+
+extern PSI_rwlock_key key_rwlock_LOCK_grant, key_rwlock_LOCK_logger,
+ key_rwlock_LOCK_sys_init_connect, key_rwlock_LOCK_sys_init_slave,
+ key_rwlock_LOCK_system_variables_hash, key_rwlock_query_cache_query_lock;
+
+#ifdef HAVE_MMAP
+extern PSI_cond_key key_PAGE_cond, key_COND_active, key_COND_pool;
+#endif /* HAVE_MMAP */
+
+extern PSI_cond_key key_BINLOG_COND_prep_xids, key_BINLOG_update_cond,
+ key_COND_cache_status_changed, key_COND_global_read_lock, key_COND_manager,
+ key_COND_refresh, key_COND_rpl_status, key_COND_server_started,
+ key_delayed_insert_cond, key_delayed_insert_cond_client,
+ key_item_func_sleep_cond, key_cond_rpl_info_data_cond,
+ key_cond_rpl_info_start_cond, key_cond_rpl_info_stop_cond,
+ key_relay_log_info_data_cond, key_relay_log_info_log_space_cond,
+ key_relay_log_info_start_cond, key_relay_log_info_stop_cond,
+ key_user_level_lock_cond,
+ key_COND_thread_count, key_COND_thread_cache, key_COND_flush_thread_cache;
+
+extern PSI_thread_key key_thread_bootstrap, key_thread_delayed_insert,
+ key_thread_handle_manager, key_thread_kill_server, key_thread_main,
+ key_thread_one_connection, key_thread_signal_hand;
+
+#ifdef HAVE_MMAP
+extern PSI_file_key key_file_map;
+#endif /* HAVE_MMAP */
+
+extern PSI_file_key key_file_binlog, key_file_binlog_index, key_file_casetest,
+ key_file_dbopt, key_file_des_key_file, key_file_ERRMSG, key_select_to_file,
+ key_file_fileparser, key_file_frm, key_file_global_ddl_log, key_file_load,
+ key_file_loadfile, key_file_log_event_data, key_file_log_event_info,
+ key_file_master_info, key_file_misc, key_file_MYSQL_LOG, key_file_partition,
+ key_file_pid, key_file_relay_log_info, key_file_send_file, key_file_tclog,
+ key_file_trg, key_file_trn, key_file_init;
+
+void init_server_psi_keys();
+#endif /* HAVE_PSI_INTERFACE */
+
+#ifndef __WIN__
+extern pthread_t signal_thread;
+#endif
+
+#ifdef HAVE_OPENSSL
+extern struct st_VioSSLFd * ssl_acceptor_fd;
+#endif /* HAVE_OPENSSL */
+
+/*
+ The following variables were under INNODB_COMPABILITY_HOOKS
+ */
+extern my_bool opt_large_pages;
+extern uint opt_large_page_size;
+extern char lc_messages_dir[FN_REFLEN];
+extern char *lc_messages_dir_ptr, *log_error_file_ptr;
+extern MYSQL_PLUGIN_IMPORT char reg_ext[FN_EXTLEN];
+extern MYSQL_PLUGIN_IMPORT uint reg_ext_length;
+extern MYSQL_PLUGIN_IMPORT uint lower_case_table_names;
+extern MYSQL_PLUGIN_IMPORT bool mysqld_embedded;
+extern ulong specialflag;
+extern uint mysql_data_home_len;
+extern uint mysql_real_data_home_len;
+extern const char *mysql_real_data_home_ptr;
+extern uint thread_handling;
+extern MYSQL_PLUGIN_IMPORT char *mysql_data_home;
+extern char server_version[SERVER_VERSION_LENGTH];
+extern MYSQL_PLUGIN_IMPORT char mysql_real_data_home[];
+extern char mysql_unpacked_real_data_home[];
+extern MYSQL_PLUGIN_IMPORT struct system_variables global_system_variables;
+extern char default_logfile_name[FN_REFLEN];
+extern char err_shared_dir[];
+
+#define mysql_tmpdir (my_tmpdir(&mysql_tmpdir_list))
+
+extern MYSQL_PLUGIN_IMPORT const key_map key_map_empty;
+extern MYSQL_PLUGIN_IMPORT key_map key_map_full; /* Should be threaded as const */
+
+/*
+ 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_error_log, LOCK_delayed_insert, LOCK_uuid_short,
+ LOCK_delayed_status, LOCK_delayed_create, LOCK_crypt, LOCK_timezone,
+ LOCK_slave_list, LOCK_active_mi, LOCK_manager, LOCK_global_read_lock,
+ LOCK_global_system_variables, LOCK_user_conn, LOCK_slave_start,
+ LOCK_prepared_stmt_count, LOCK_error_messages, LOCK_connection_count;
+extern MYSQL_PLUGIN_IMPORT mysql_mutex_t LOCK_thread_count;
+#ifdef HAVE_OPENSSL
+extern mysql_mutex_t LOCK_des_key_file;
+#endif
+extern mysql_mutex_t LOCK_server_started;
+extern mysql_cond_t COND_server_started;
+extern mysql_rwlock_t LOCK_grant, LOCK_sys_init_connect, LOCK_sys_init_slave;
+extern mysql_rwlock_t LOCK_system_variables_hash;
+extern mysql_cond_t COND_thread_count;
+extern mysql_cond_t COND_refresh, COND_manager;
+extern mysql_cond_t COND_global_read_lock;
+extern int32 thread_running;
+extern my_atomic_rwlock_t thread_running_lock;
+
+extern char *opt_ssl_ca, *opt_ssl_capath, *opt_ssl_cert, *opt_ssl_cipher,
+ *opt_ssl_key;
+
+extern MYSQL_PLUGIN_IMPORT pthread_key(THD*, THR_THD);
+
+/**
+ only options that need special treatment in get_one_option() deserve
+ to be listed below
+*/
+enum options_mysqld
+{
+ OPT_to_set_the_start_number=256,
+ OPT_BIND_ADDRESS,
+ OPT_BINLOG_DO_DB,
+ OPT_BINLOG_FORMAT,
+ OPT_BINLOG_IGNORE_DB,
+ OPT_BIN_LOG,
+ OPT_BOOTSTRAP,
+ OPT_CONSOLE,
+ OPT_DEBUG_SYNC_TIMEOUT,
+ OPT_DELAY_KEY_WRITE_ALL,
+ OPT_ISAM_LOG,
+ OPT_KEY_BUFFER_SIZE,
+ OPT_KEY_CACHE_AGE_THRESHOLD,
+ OPT_KEY_CACHE_BLOCK_SIZE,
+ OPT_KEY_CACHE_DIVISION_LIMIT,
+ OPT_LOWER_CASE_TABLE_NAMES,
+ OPT_ONE_THREAD,
+ OPT_POOL_OF_THREADS,
+ OPT_REPLICATE_DO_DB,
+ OPT_REPLICATE_DO_TABLE,
+ OPT_REPLICATE_IGNORE_DB,
+ OPT_REPLICATE_IGNORE_TABLE,
+ OPT_REPLICATE_REWRITE_DB,
+ OPT_REPLICATE_WILD_DO_TABLE,
+ OPT_REPLICATE_WILD_IGNORE_TABLE,
+ OPT_SAFE,
+ OPT_SERVER_ID,
+ OPT_SKIP_HOST_CACHE,
+ OPT_SKIP_LOCK,
+ OPT_SKIP_NEW,
+ OPT_SKIP_PRIOR,
+ OPT_SKIP_RESOLVE,
+ OPT_SKIP_STACK_TRACE,
+ OPT_SKIP_SYMLINKS,
+ OPT_SLOW_QUERY_LOG,
+ OPT_SSL_CA,
+ OPT_SSL_CAPATH,
+ OPT_SSL_CERT,
+ OPT_SSL_CIPHER,
+ OPT_SSL_KEY,
+ OPT_UPDATE_LOG,
+ OPT_WANT_CORE,
+ OPT_ENGINE_CONDITION_PUSHDOWN,
+ OPT_LOG_ERROR
+};
+
+
+/**
+ Query type constants.
+
+ QT_ORDINARY -- ordinary SQL query.
+ QT_IS -- SQL query to be shown in INFORMATION_SCHEMA (in utf8 and without
+ character set introducers).
+*/
+enum enum_query_type
+{
+ QT_ORDINARY,
+ QT_IS
+};
+
+/* query_id */
+typedef int64 query_id_t;
+extern query_id_t global_query_id;
+extern my_atomic_rwlock_t global_query_id_lock;
+
+void unireg_end(void) __attribute__((noreturn));
+
+/* increment query_id and return it. */
+inline query_id_t next_query_id()
+{
+ query_id_t id;
+ my_atomic_rwlock_wrlock(&global_query_id_lock);
+ id= my_atomic_add64(&global_query_id, 1);
+ my_atomic_rwlock_wrunlock(&global_query_id_lock);
+ return (id+1);
+}
+
+inline query_id_t get_query_id()
+{
+ query_id_t id;
+ my_atomic_rwlock_wrlock(&global_query_id_lock);
+ id= my_atomic_load64(&global_query_id);
+ my_atomic_rwlock_wrunlock(&global_query_id_lock);
+ return id;
+}
+
+
+/*
+ TODO: Replace this with an inline function.
+ */
+#ifndef EMBEDDED_LIBRARY
+extern "C" void unireg_abort(int exit_code) __attribute__((noreturn));
+#else
+extern "C" void unireg_clear(int exit_code);
+#define unireg_abort(exit_code) do { unireg_clear(exit_code); DBUG_RETURN(exit_code); } while(0)
+#endif
+
+inline void table_case_convert(char * name, uint length)
+{
+ if (lower_case_table_names)
+ files_charset_info->cset->casedn(files_charset_info,
+ name, length, name, length);
+}
+
+inline ulong sql_rnd_with_mutex()
+{
+ mysql_mutex_lock(&LOCK_thread_count);
+ ulong tmp=(ulong) (my_rnd(&sql_rand) * 0xffffffff); /* make all bits random */
+ mysql_mutex_unlock(&LOCK_thread_count);
+ return tmp;
+}
+
+inline int32
+inc_thread_running()
+{
+ int32 num_thread_running;
+ my_atomic_rwlock_wrlock(&thread_running_lock);
+ num_thread_running= my_atomic_add32(&thread_running, 1);
+ my_atomic_rwlock_wrunlock(&thread_running_lock);
+ return (num_thread_running+1);
+}
+
+inline int32
+dec_thread_running()
+{
+ int32 num_thread_running;
+ my_atomic_rwlock_wrlock(&thread_running_lock);
+ num_thread_running= my_atomic_add32(&thread_running, -1);
+ my_atomic_rwlock_wrunlock(&thread_running_lock);
+ return (num_thread_running-1);
+}
+
+inline int32
+get_thread_running()
+{
+ int32 num_thread_running;
+ my_atomic_rwlock_wrlock(&thread_running_lock);
+ num_thread_running= my_atomic_load32(&thread_running);
+ my_atomic_rwlock_wrunlock(&thread_running_lock);
+ return num_thread_running;
+}
+
+inline THD *_current_thd(void)
+{
+ return my_pthread_getspecific_ptr(THD*,THR_THD);
+}
+
+#define current_thd _current_thd()
+
+#endif /* MYSQLD_INCLUDED */
=== modified file 'sql/net_serv.cc'
--- a/sql/net_serv.cc 2010-03-03 19:24:50 +0000
+++ b/sql/net_serv.cc 2010-04-08 10:50:40 +0000
@@ -39,7 +39,6 @@
*/
#include <my_global.h>
#include <mysql.h>
-#include <mysql_embed.h>
#include <mysql_com.h>
#include <mysqld_error.h>
#include <my_sys.h>
@@ -87,7 +86,7 @@ void sql_print_error(const char *format,
#ifdef MYSQL_SERVER
/*
The following variables/functions should really not be declared
- extern, but as it's hard to include mysql_priv.h here, we have to
+ extern, but as it's hard to include sql_priv.h here, we have to
live with this for a while.
*/
extern uint test_flags;
=== modified file 'sql/opt_range.cc'
--- a/sql/opt_range.cc 2010-03-01 10:04:07 +0000
+++ b/sql/opt_range.cc 2010-04-09 08:22:10 +0000
@@ -107,7 +107,14 @@
#pragma implementation // gcc: Class implementation
#endif
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "key.h" // is_key_used, key_copy, key_cmp, key_restore
+#include "sql_parse.h" // check_stack_overrun
+#include "sql_partition.h" // get_part_id_func, PARTITION_ITERATOR,
+ // struct partition_info
+#include "sql_base.h" // free_io_cache
+#include "records.h" // init_read_record, end_read_record
#include <m_ctype.h>
#include "sql_select.h"
=== modified file 'sql/opt_range.h'
--- a/sql/opt_range.h 2010-01-26 06:30:16 +0000
+++ b/sql/opt_range.h 2010-04-08 10:50:40 +0000
@@ -23,6 +23,20 @@
#pragma interface /* gcc class implementation */
#endif
+#include "thr_malloc.h" /* sql_memdup */
+#include "records.h" /* READ_RECORD */
+#include "queues.h" /* QUEUE */
+/*
+ It is necessary to include set_var.h instead of item.h because there
+ are dependencies on include order for set_var.h and item.h. This
+ will be resolved later.
+*/
+#include "sql_class.h" // set_var.h: THD
+#include "set_var.h" /* Item */
+
+class JOIN;
+class Item_sum;
+
typedef struct st_key_part {
uint16 key,part;
/* See KEY_PART_INFO for meaning of the next two: */
@@ -785,10 +799,15 @@ QUICK_RANGE_SELECT *get_quick_select_for
struct st_table_ref *ref,
ha_rows records);
uint get_index_for_order(TABLE *table, ORDER *order, ha_rows limit);
+SQL_SELECT *make_select(TABLE *head, table_map const_tables,
+ table_map read_tables, COND *conds,
+ bool allow_null_cond, int *error);
#ifdef WITH_PARTITION_STORAGE_ENGINE
bool prune_partitions(THD *thd, TABLE *table, Item *pprune_cond);
void store_key_image_to_rec(Field *field, uchar *ptr, uint len);
#endif
+extern String null_string;
+
#endif
=== modified file 'sql/opt_sum.cc'
--- a/sql/opt_sum.cc 2010-03-25 09:02:07 +0000
+++ b/sql/opt_sum.cc 2010-04-09 08:22:10 +0000
@@ -47,7 +47,9 @@
(assuming a index for column d of table t2 is defined)
*/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "key.h" // key_cmp_if_same
#include "sql_select.h"
static bool find_key_for_maxmin(bool max_fl, TABLE_REF *ref, Field* field,
=== modified file 'sql/parse_file.cc'
--- a/sql/parse_file.cc 2010-01-07 05:48:46 +0000
+++ b/sql/parse_file.cc 2010-04-09 08:22:10 +0000
@@ -20,7 +20,11 @@
Text .frm files management routines
*/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "parse_file.h"
+#include "unireg.h" // CREATE_MODE
+#include "sql_table.h" // build_table_filename
#include <errno.h>
#include <m_ctype.h>
#include <my_sys.h>
=== modified file 'sql/parse_file.h'
--- a/sql/parse_file.h 2009-05-15 12:57:51 +0000
+++ b/sql/parse_file.h 2010-03-31 14:05:33 +0000
@@ -17,6 +17,14 @@
#ifndef _PARSE_FILE_H_
#define _PARSE_FILE_H_
+#include "my_global.h" // uchar
+#include "sql_string.h" // LEX_STRING
+#include "sql_list.h" // Sql_alloc
+
+class THD;
+
+typedef struct st_mem_root MEM_ROOT;
+
#define PARSE_FILE_TIMESTAMPLENGTH 19
enum file_opt_type {
=== modified file 'sql/partition_element.h'
--- a/sql/partition_element.h 2009-10-30 16:34:50 +0000
+++ b/sql/partition_element.h 2010-04-08 10:50:40 +0000
@@ -16,6 +16,9 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+#include "my_base.h" /* ha_rows */
+#include "handler.h" /* UNDEF_NODEGROUP */
+
/**
* An enum and a struct to handle partitioning and subpartitioning.
*/
=== modified file 'sql/partition_info.cc'
--- a/sql/partition_info.cc 2010-03-14 16:19:24 +0000
+++ b/sql/partition_info.cc 2010-04-09 08:22:10 +0000
@@ -19,7 +19,14 @@
#pragma implementation
#endif
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+// Required to get server definitions for mysql/plugin.h right
+#include "sql_plugin.h"
+#include "sql_partition.h" /* partition_info.h: LIST_PART_ENTRY */
+#include "partition_info.h"
+#include "sql_parse.h" // test_if_data_home_dir
+#include "sql_acl.h" // *_ACL
#ifdef WITH_PARTITION_STORAGE_ENGINE
#include "ha_partition.h"
=== modified file 'sql/password.c'
--- a/sql/password.c 2009-06-01 12:40:05 +0000
+++ b/sql/password.c 2010-04-08 10:50:40 +0000
@@ -58,6 +58,7 @@
*****************************************************************************/
+#include <password.h>
#include <my_global.h>
#include <my_sys.h>
#include <m_string.h>
=== modified file 'sql/procedure.cc'
--- a/sql/procedure.cc 2007-10-11 18:37:45 +0000
+++ b/sql/procedure.cc 2010-04-09 08:22:10 +0000
@@ -20,7 +20,8 @@
#pragma implementation // gcc: Class implementation
#endif
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#include "procedure.h"
#include "sql_analyse.h" // Includes procedure
#ifdef USE_PROC_RANGE
=== modified file 'sql/procedure.h'
--- a/sql/procedure.h 2009-11-02 15:16:58 +0000
+++ b/sql/procedure.h 2010-04-08 10:50:40 +0000
@@ -23,6 +23,14 @@
#pragma interface /* gcc class implementation */
#endif
+/*
+ It is necessary to include set_var.h instead of item.h because there
+ are dependencies on include order for set_var.h and item.h. This
+ will be resolved later.
+*/
+#include "sql_class.h" /* select_result, set_var.h: THD */
+#include "set_var.h" /* Item */
+
#define PROC_NO_SORT 1 /**< Bits in flags */
#define PROC_GROUP 2 /**< proc must have group */
=== modified file 'sql/protocol.cc'
--- a/sql/protocol.cc 2010-03-25 09:02:07 +0000
+++ b/sql/protocol.cc 2010-04-09 08:22:10 +0000
@@ -24,7 +24,11 @@
#pragma implementation // gcc: Class implementation
#endif
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h" // REQUIRED: for other includes
+#include "protocol.h"
+#include "sql_class.h" // THD
#include <stdarg.h>
static const unsigned int PACKET_BUFFER_EXTRA_ALLOC= 1024;
=== modified file 'sql/protocol.h'
--- a/sql/protocol.h 2009-12-02 14:52:07 +0000
+++ b/sql/protocol.h 2010-04-08 10:50:40 +0000
@@ -21,8 +21,10 @@
#endif
#include "sql_error.h"
+#include "my_decimal.h" /* my_decimal */
class i_string;
+class Field;
class THD;
class Item_param;
typedef struct st_mysql_field MYSQL_FIELD;
=== modified file 'sql/records.cc'
--- a/sql/records.cc 2010-03-01 10:04:07 +0000
+++ b/sql/records.cc 2010-04-09 08:22:10 +0000
@@ -24,8 +24,13 @@
Functions for easy reading of records, possible through a cache
*/
+#include "my_global.h"
#include "records.h"
-#include "mysql_priv.h"
+#include "sql_priv.h"
+#include "records.h"
+#include "filesort.h" // filesort_free_buffers
+#include "opt_range.h" // SQL_SELECT
+#include "sql_class.h" // THD
static int rr_quick(READ_RECORD *info);
=== modified file 'sql/repl_failsafe.cc'
--- a/sql/repl_failsafe.cc 2010-03-23 09:14:15 +0000
+++ b/sql/repl_failsafe.cc 2010-04-09 08:22:10 +0000
@@ -23,15 +23,19 @@
functions like register_slave()) are working.
*/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "sql_parse.h" // check_access
#ifdef HAVE_REPLICATION
#include "repl_failsafe.h"
+#include "sql_acl.h" // REPL_SLAVE_ACL
#include "sql_repl.h"
#include "slave.h"
#include "rpl_mi.h"
#include "rpl_filter.h"
#include "log_event.h"
+#include "sql_db.h" // mysql_create_db
#include <mysql.h>
#define SLAVE_LIST_CHUNK 128
=== modified file 'sql/rpl_filter.cc'
--- a/sql/rpl_filter.cc 2009-10-23 06:47:02 +0000
+++ b/sql/rpl_filter.cc 2010-04-09 08:22:10 +0000
@@ -13,8 +13,12 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h" // REQUIRED by other includes
#include "rpl_filter.h"
+#include "hash.h" // my_hash_free
+#include "table.h" // TABLE_LIST
#define TABLE_RULE_HASH_SIZE 16
#define TABLE_RULE_ARR_SIZE 16
=== modified file 'sql/rpl_filter.h'
--- a/sql/rpl_filter.h 2007-05-10 09:59:39 +0000
+++ b/sql/rpl_filter.h 2010-04-12 13:17:37 +0000
@@ -17,6 +17,12 @@
#define RPL_FILTER_H
#include "mysql.h"
+#include "sql_list.h" /* I_List */
+#include "hash.h" /* HASH */
+
+class String;
+struct TABLE_LIST;
+typedef struct st_dynamic_array DYNAMIC_ARRAY;
typedef struct st_table_rule_ent
{
=== modified file 'sql/rpl_handler.cc'
--- a/sql/rpl_handler.cc 2010-02-24 16:27:03 +0000
+++ b/sql/rpl_handler.cc 2010-04-08 10:50:40 +0000
@@ -13,7 +13,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#include "rpl_mi.h"
#include "sql_repl.h"
=== modified file 'sql/rpl_handler.h'
--- a/sql/rpl_handler.h 2008-09-23 15:06:18 +0000
+++ b/sql/rpl_handler.h 2010-04-08 10:50:40 +0000
@@ -16,7 +16,8 @@
#ifndef RPL_HANDLER_H
#define RPL_HANDLER_H
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#include "rpl_mi.h"
#include "rpl_rli.h"
#include "sql_plugin.h"
=== modified file 'sql/rpl_info.cc'
--- a/sql/rpl_info.cc 2010-01-07 05:43:05 +0000
+++ b/sql/rpl_info.cc 2010-04-08 10:50:40 +0000
@@ -14,8 +14,9 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <my_global.h>
-#include "mysql_priv.h"
+#include "sql_priv.h"
#include "rpl_info.h"
+#include "mysqld.h"
#ifdef HAVE_REPLICATION
=== modified file 'sql/rpl_info.h'
--- a/sql/rpl_info.h 2010-01-07 05:43:05 +0000
+++ b/sql/rpl_info.h 2010-04-08 10:50:40 +0000
@@ -18,6 +18,9 @@
#include "rpl_reporting.h"
+// Forward declarations
+class THD;
+
class Rpl_info : public Slave_reporting_capability
{
public:
=== modified file 'sql/rpl_injector.cc'
--- a/sql/rpl_injector.cc 2010-03-23 09:14:15 +0000
+++ b/sql/rpl_injector.cc 2010-04-09 08:22:10 +0000
@@ -13,9 +13,14 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h" // REQUIRED by later includes
#include "rpl_injector.h"
#include "transaction.h"
+#include "sql_parse.h" // begin_trans, end_trans, COMMIT
+#include "sql_base.h" // close_thread_tables
+#include "log_event.h" // Incident_log_event
/*
injector::transaction - member definitions
=== modified file 'sql/rpl_injector.h'
--- a/sql/rpl_injector.h 2009-10-23 06:47:02 +0000
+++ b/sql/rpl_injector.h 2010-04-08 10:50:40 +0000
@@ -21,6 +21,7 @@
#include <my_bitmap.h>
#include "rpl_constants.h"
+#include "table.h" /* TABLE */
/* Forward declarations */
class handler;
=== modified file 'sql/rpl_mi.cc'
--- a/sql/rpl_mi.cc 2010-02-04 01:04:55 +0000
+++ b/sql/rpl_mi.cc 2010-04-08 10:50:40 +0000
@@ -14,10 +14,11 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <my_global.h> // For HAVE_REPLICATION
-#include "mysql_priv.h"
+#include "sql_priv.h"
#include <my_dir.h>
-
+#include "unireg.h" // REQUIRED by other includes
#include "rpl_mi.h"
+#include "slave.h" // SLAVE_MAX_HEARTBEAT_PERIOD
#ifdef HAVE_REPLICATION
=== modified file 'sql/rpl_mi.h'
--- a/sql/rpl_mi.h 2010-02-04 01:04:55 +0000
+++ b/sql/rpl_mi.h 2010-04-08 10:50:40 +0000
@@ -23,8 +23,9 @@
#define DEFAULT_CONNECT_RETRY 60
-/*****************************************************************************
+typedef struct st_mysql MYSQL;
+/*****************************************************************************
Replication IO Thread
Master_info contains:
=== modified file 'sql/rpl_mi_file.cc'
--- a/sql/rpl_mi_file.cc 2009-04-02 16:14:14 +0000
+++ b/sql/rpl_mi_file.cc 2010-04-08 10:50:40 +0000
@@ -14,7 +14,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <my_global.h> // For HAVE_REPLICATION
-#include "mysql_priv.h"
+#include "sql_priv.h"
#include <my_dir.h>
#include <rpl_mi_file.h>
=== modified file 'sql/rpl_record.cc'
--- a/sql/rpl_record.cc 2010-03-23 09:14:15 +0000
+++ b/sql/rpl_record.cc 2010-04-09 08:22:10 +0000
@@ -13,7 +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 */
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h"
#include "rpl_rli.h"
#include "rpl_record.h"
#include "slave.h" // Need to pull in slave_print_msg
=== modified file 'sql/rpl_record.h'
--- a/sql/rpl_record.h 2010-01-13 06:34:01 +0000
+++ b/sql/rpl_record.h 2010-04-08 10:50:40 +0000
@@ -17,6 +17,11 @@
#define RPL_RECORD_H
#include <rpl_reporting.h>
+#include "my_global.h" /* uchar */
+
+class Relay_log_info;
+struct TABLE;
+typedef struct st_bitmap MY_BITMAP;
#if !defined(MYSQL_CLIENT)
size_t pack_row(TABLE* table, MY_BITMAP const* cols,
=== modified file 'sql/rpl_record_old.cc'
--- a/sql/rpl_record_old.cc 2007-08-16 05:37:50 +0000
+++ b/sql/rpl_record_old.cc 2010-04-09 08:22:10 +0000
@@ -1,7 +1,10 @@
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h" // REQUIRED by other includes
#include "rpl_rli.h"
#include "rpl_record_old.h"
+#include "log_event.h" // Log_event_type
size_t
pack_row_old(TABLE *table, MY_BITMAP const* cols,
=== modified file 'sql/rpl_record_old.h'
--- a/sql/rpl_record_old.h 2007-08-16 05:37:50 +0000
+++ b/sql/rpl_record_old.h 2010-03-31 14:05:33 +0000
@@ -16,6 +16,8 @@
#ifndef RPL_RECORD_OLD_H
#define RPL_RECORD_OLD_H
+#include "log_event.h" /* Log_event_type */
+
#ifndef MYSQL_CLIENT
size_t pack_row_old(TABLE *table, MY_BITMAP const* cols,
uchar *row_data, const uchar *record);
=== modified file 'sql/rpl_reporting.cc'
--- a/sql/rpl_reporting.cc 2010-01-07 05:48:46 +0000
+++ b/sql/rpl_reporting.cc 2010-04-09 08:22:10 +0000
@@ -13,8 +13,11 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#include "rpl_reporting.h"
+#include "log.h" // sql_print_error, sql_print_warning,
+ // sql_print_information
Slave_reporting_capability::Slave_reporting_capability(char const *thread_name)
: m_thread_name(thread_name)
=== modified file 'sql/rpl_reporting.h'
--- a/sql/rpl_reporting.h 2010-01-07 05:48:46 +0000
+++ b/sql/rpl_reporting.h 2010-04-08 10:50:40 +0000
@@ -1,6 +1,3 @@
-#ifndef RPL_REPORTING_H
-#define RPL_REPORTING_H
-
/* Copyright (C) 2008-2009 Sun Microsystems, Inc.
This program is free software; you can redistribute it and/or modify
@@ -14,7 +11,12 @@
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 */
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef RPL_REPORTING_H
+#define RPL_REPORTING_H
+
+#include "my_sys.h" /* loglevel */
/**
Maximum size of an error message from a slave thread.
=== modified file 'sql/rpl_rli.cc'
--- a/sql/rpl_rli.cc 2010-03-25 07:20:34 +0000
+++ b/sql/rpl_rli.cc 2010-04-09 08:22:10 +0000
@@ -13,14 +13,20 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "mysql_priv.h"
-
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h" // HAVE_*
#include "rpl_mi.h"
#include "rpl_rli.h"
+#include "sql_base.h" // close_thread_tables
#include <my_dir.h> // For MY_STAT
#include "sql_repl.h" // For check_binlog_magic
+#include "log_event.h" // Format_description_log_event, Log_event,
+ // FORMAT_DESCRIPTION_LOG_EVENT, ROTATE_EVENT,
+ // PREFIX_SQL_LOAD
#include "rpl_utility.h"
#include "transaction.h"
+#include "sql_parse.h" // end_trans, ROLLBACK
Relay_log_info::Relay_log_info(bool is_slave_recovery)
:Rpl_info("SQL"),
=== modified file 'sql/rpl_rli.h'
--- a/sql/rpl_rli.h 2010-03-23 09:14:15 +0000
+++ b/sql/rpl_rli.h 2010-04-08 10:50:40 +0000
@@ -19,6 +19,8 @@
#include "rpl_tblmap.h"
#include "rpl_info.h"
#include "rpl_utility.h"
+#include "log.h" /* LOG_INFO, MYSQL_BIN_LOG */
+#include "sql_class.h" /* THD */
struct RPL_TABLE_LIST;
class Master_info;
=== modified file 'sql/rpl_rli_file.cc'
--- a/sql/rpl_rli_file.cc 2009-10-02 09:33:37 +0000
+++ b/sql/rpl_rli_file.cc 2010-04-08 10:50:40 +0000
@@ -13,7 +13,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#include "rpl_mi.h"
#include "rpl_rli.h"
=== modified file 'sql/rpl_tblmap.cc'
--- a/sql/rpl_tblmap.cc 2009-12-15 06:57:50 +0000
+++ b/sql/rpl_tblmap.cc 2010-04-09 08:22:10 +0000
@@ -13,11 +13,15 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "mysql_priv.h"
+#include "my_global.h" // HAVE_REPLICATION
+#include "sql_priv.h"
#ifdef HAVE_REPLICATION
#include "rpl_tblmap.h"
+#ifndef MYSQL_CLIENT
+#include "table.h"
+#endif
#ifdef MYSQL_CLIENT
#define MAYBE_TABLE_NAME(T) ("")
=== modified file 'sql/rpl_tblmap.h'
--- a/sql/rpl_tblmap.h 2009-10-23 06:47:02 +0000
+++ b/sql/rpl_tblmap.h 2010-04-08 10:50:40 +0000
@@ -52,6 +52,8 @@ void free_table_map_log_event(TABLE *tab
A dedicated MEM_ROOT needs to be used, see below.
*/
+#include "hash.h" /* HASH */
+
class table_mapping {
private:
=== modified file 'sql/rpl_utility.cc'
--- a/sql/rpl_utility.cc 2010-03-25 09:02:07 +0000
+++ b/sql/rpl_utility.cc 2010-04-08 10:50:40 +0000
@@ -16,7 +16,9 @@
#include "rpl_utility.h"
#ifndef MYSQL_CLIENT
+#include "unireg.h" // REQUIRED by later includes
#include "rpl_rli.h"
+#include "sql_select.h"
/**
Function to compare two size_t integers for their relative
=== modified file 'sql/rpl_utility.h'
--- a/sql/rpl_utility.h 2010-03-25 09:02:07 +0000
+++ b/sql/rpl_utility.h 2010-04-09 08:22:10 +0000
@@ -20,7 +20,12 @@
#error "Don't include this C++ header file from a non-C++ file!"
#endif
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "m_string.h" /* bzero, memcpy */
+#ifdef MYSQL_SERVER
+#include "table.h" /* TABLE_LIST */
+#endif
#include "mysql_com.h"
class Relay_log_info;
=== modified file 'sql/scheduler.cc'
--- a/sql/scheduler.cc 2010-01-12 02:13:40 +0000
+++ b/sql/scheduler.cc 2010-04-09 08:22:10 +0000
@@ -21,9 +21,12 @@
#pragma implementation
#endif
-#include <mysql_priv.h>
+#include "my_global.h"
+#include <sql_priv.h>
+#include "unireg.h" // REQUIRED: for other includes
#include "sql_audit.h"
-
+#include "scheduler.h"
+#include "sql_connect.h" // init_new_connection_handler_thread
/*
'Dummy' functions to be used when we don't need any handling for a scheduler
=== modified file 'sql/set_var.cc'
--- a/sql/set_var.cc 2010-03-25 09:02:07 +0000
+++ b/sql/set_var.cc 2010-04-10 09:11:47 +0000
@@ -19,9 +19,31 @@
/* variable declarations are in sys_vars.cc now !!! */
-#include "mysql_priv.h"
+#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
+#include "sql_class.h" // set_var.h: session_var_ptr
+#include "set_var.h"
+#include "sql_priv.h"
+#include "unireg.h"
+#include "mysqld.h" // lc_messages_dir
#include "sys_vars_shared.h"
#include "transaction.h"
+#include "sql_base.h" // close_thread_tables
+#include "sql_locale.h" // my_locale_by_number,
+ // my_locale_by_name
+#include "strfunc.h" // find_set_from_flags, find_set
+#include "sql_parse.h" // check_global_access
+#include "sql_table.h" // reassign_keycache_tables
+#include "sql_time.h" // date_time_format_copy,
+ // date_time_format_make
+#include "derror.h"
+#include "tztime.h" // my_tz_find, my_tz_SYSTEM, struct Time_zone
+#include "sql_acl.h" // SUPER_ACL
+#include "sql_select.h" // free_underlaid_joins
+#include "sql_show.h" // make_default_log_name
+#include "sql_view.h" // updatable_views_with_limit_typelib
+#include "lock.h" // lock_global_read_lock,
+ // make_global_read_lock_block_commit,
+ // unlock_global_read_lock
static HASH system_variable_hash;
static PolyLock_mutex PLock_global_system_variables(&LOCK_global_system_variables);
=== modified file 'sql/set_var.h'
--- a/sql/set_var.h 2010-03-23 09:14:15 +0000
+++ b/sql/set_var.h 2010-04-08 10:50:40 +0000
@@ -30,6 +30,10 @@ class sys_var;
class set_var;
class sys_var_pluginvar;
class PolyLock;
+class Item_func_set_user_var;
+
+// This include needs to be here since item.h requires enum_var_type :-P
+#include "item.h" /* Item */
extern TYPELIB bool_typelib;
@@ -165,6 +169,9 @@ protected:
{ return ((uchar*)&global_system_variables) + offset; }
};
+#include "log.h" /* binlog_format_typelib */
+#include "sql_plugin.h" /* SHOW_HA_ROWS, SHOW_MY_BOOL */
+
/****************************************************************************
Classes for parsing of the SET command
****************************************************************************/
@@ -277,6 +284,18 @@ public:
int update(THD *thd);
};
+
+/* optional things, have_* variables */
+extern SHOW_COMP_OPTION have_csv, have_innodb;
+extern SHOW_COMP_OPTION have_ndbcluster, have_partitioning;
+extern SHOW_COMP_OPTION have_profiling;
+
+extern SHOW_COMP_OPTION have_ssl, have_symlink, have_dlopen;
+extern SHOW_COMP_OPTION have_query_cache;
+extern SHOW_COMP_OPTION have_geometry, have_rtree_keys;
+extern SHOW_COMP_OPTION have_crypt;
+extern SHOW_COMP_OPTION have_compress;
+
/*
Prototypes for helper functions
*/
=== modified file 'sql/si_logs.cc'
--- a/sql/si_logs.cc 2009-11-17 20:18:50 +0000
+++ b/sql/si_logs.cc 2010-04-08 10:50:40 +0000
@@ -8,9 +8,11 @@
and permitting an isolation layer for the client (caller).
*/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#include "si_logs.h"
#include "log.h"
+#include "sql_class.h"
/**
Initialize the class for logging backup or restore operation.
=== modified file 'sql/si_logs.h'
--- a/sql/si_logs.h 2009-11-17 20:18:50 +0000
+++ b/sql/si_logs.h 2010-04-08 10:50:40 +0000
@@ -8,6 +8,8 @@
- table|file|both logging services for backup
*/
+#include "sql_string.h"
+
/**
List of operations for backup history log.
=== modified file 'sql/si_objects.cc'
--- a/sql/si_objects.cc 2010-02-10 16:51:22 +0000
+++ b/sql/si_objects.cc 2010-04-08 10:50:40 +0000
@@ -15,8 +15,12 @@
/** @file Server Service Interface for Backup: the implementation. */
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#include "sql_prepare.h"
+#include "sql_table.h"
+#include "sql_base.h"
+#include "sql_acl.h"
#include "si_objects.h"
#include "bml.h"
@@ -25,6 +29,10 @@
#include "sp.h"
#include "sp_head.h" // for sp_add_to_query_tables().
#include "rpl_mi.h"
+#include "lock.h"
+#include "slave.h"
+#include "rpl_constants.h"
+#include "log_event.h"
#ifdef HAVE_EVENT_SCHEDULER
#include "events.h"
=== modified file 'sql/si_objects.h'
--- a/sql/si_objects.h 2010-01-05 06:54:19 +0000
+++ b/sql/si_objects.h 2010-04-08 10:50:40 +0000
@@ -36,6 +36,13 @@
called Backup Metadata Lock.
*/
+#include "sql_string.h"
+#include "sql_list.h"
+#include "thr_lock.h"
+
+// Forward declarations
+struct TABLE_LIST;
+
namespace obs {
///////////////////////////////////////////////////////////////////////////
=== modified file 'sql/slave.cc'
--- a/sql/slave.cc 2010-03-25 09:02:07 +0000
+++ b/sql/slave.cc 2010-04-09 08:22:10 +0000
@@ -24,11 +24,11 @@
replication slave.
*/
-#include "mysql_priv.h"
-
-#include <mysql.h>
-#include <myisam.h>
+#include "my_global.h"
+#include "sql_priv.h"
#include "slave.h"
+#include "sql_parse.h" // execute_init_command
+#include "sql_table.h" // mysql_rm_table
#include "rpl_mi.h"
#include "rpl_mi_file.h"
#include "rpl_rli.h"
@@ -44,6 +44,15 @@
#include <mysqld_error.h>
#include <mysys_err.h>
#include "rpl_handler.h"
+#include <signal.h>
+#include <mysql.h>
+#include <myisam.h>
+
+#include "sql_base.h" // close_thread_tables
+#include "tztime.h" // struct Time_zone
+#include "log_event.h" // Rotate_log_event,
+ // Create_file_log_event,
+ // Format_description_log_event
#ifdef HAVE_REPLICATION
=== modified file 'sql/slave.h'
--- a/sql/slave.h 2010-03-23 09:14:15 +0000
+++ b/sql/slave.h 2010-04-08 10:50:40 +0000
@@ -211,6 +211,8 @@ int apply_event_and_update_pos(Log_event
pthread_handler_t handle_slave_io(void *arg);
pthread_handler_t handle_slave_sql(void *arg);
+bool net_request_file(NET* net, const char* fname);
+
extern bool volatile abort_loop;
extern Master_info *active_mi; /* active_mi for multi-master */
extern LIST master_list;
=== modified file 'sql/sp.cc'
--- a/sql/sp.cc 2010-03-23 09:14:15 +0000
+++ b/sql/sp.cc 2010-04-09 08:22:10 +0000
@@ -13,10 +13,22 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h"
#include "sp.h"
+#include "sql_base.h" // close_thread_tables
+#include "sql_parse.h" // parse_sql
+#include "key.h" // key_copy
+#include "sql_show.h" // append_definer, append_identifier
+#include "sql_db.h" // get_default_db_collation, mysql_opt_change_db,
+ // mysql_change_db, check_db_dir_existence,
+ // load_db_opt_by_name
+#include "sql_table.h" // write_bin_log
+#include "sql_acl.h" // SUPER_ACL
#include "sp_head.h"
#include "sp_cache.h"
+#include "lock.h" // lock_routine_name
#include <my_user.h>
=== modified file 'sql/sp.h'
--- a/sql/sp.h 2010-02-10 21:11:06 +0000
+++ b/sql/sp.h 2010-04-12 13:18:53 +0000
@@ -17,6 +17,25 @@
#ifndef _SP_H_
#define _SP_H_
+#include "sql_string.h" // LEX_STRING
+
+class Field;
+class Open_tables_backup;
+class Open_tables_state;
+class Query_arena;
+class Query_tables_list;
+class Sroutine_hash_entry;
+class THD;
+class sp_cache;
+class sp_head;
+class sp_name;
+struct st_sp_chistics;
+struct LEX;
+struct TABLE;
+struct TABLE_LIST;
+typedef struct st_hash HASH;
+typedef struct st_sql_list SQL_LIST;
+
/* Tells what SP_DEFAULT_ACCESS should be mapped to */
#define SP_DEFAULT_ACCESS_MAPPING SP_CONTAINS_SQL
@@ -164,4 +183,14 @@ sp_load_for_information_schema(THD *thd,
String *name, ulong sql_mode, int type,
const char *returns, const char *params,
bool *free_sp_head);
+bool load_charset(MEM_ROOT *mem_root,
+ Field *field,
+ CHARSET_INFO *dflt_cs,
+ CHARSET_INFO **cs);
+
+bool load_collation(MEM_ROOT *mem_root,
+ Field *field,
+ CHARSET_INFO *dflt_cl,
+ CHARSET_INFO **cl);
+
#endif /* _SP_H_ */
=== modified file 'sql/sp_cache.cc'
--- a/sql/sp_cache.cc 2010-02-25 13:55:28 +0000
+++ b/sql/sp_cache.cc 2010-04-09 08:22:10 +0000
@@ -13,7 +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 */
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h"
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation
#endif
=== modified file 'sql/sp_cache.h'
--- a/sql/sp_cache.h 2009-12-30 20:22:24 +0000
+++ b/sql/sp_cache.h 2010-04-08 10:50:40 +0000
@@ -21,6 +21,8 @@
#pragma interface /* gcc class implementation */
#endif
+#include "my_global.h" /* ulong */
+
/*
Stored procedures/functions cache. This is used as follows:
* Each thread has its own cache.
@@ -30,6 +32,7 @@
class sp_head;
class sp_cache;
+class sp_name;
/*
Cache usage scenarios:
=== modified file 'sql/sp_head.cc'
--- a/sql/sp_head.cc 2010-03-23 09:14:15 +0000
+++ b/sql/sp_head.cc 2010-04-10 09:11:47 +0000
@@ -13,9 +13,20 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "mysql_priv.h"
+#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
+#include "sql_priv.h"
+#include "unireg.h"
#include "sql_prepare.h"
+#include "sql_cache.h" // query_cache_*
#include "probes_mysql.h"
+#include "sql_show.h" // append_identifier
+#include "sql_db.h" // mysql_opt_change_db, mysql_change_db
+#include "sql_table.h" // sp_prepare_create_field,
+ // prepare_create_field
+#include "sql_acl.h" // *_ACL
+#include "sql_array.h" // Dynamic_array
+#include "log_event.h" // append_query_string, Query_log_event
+
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation
#endif
@@ -25,6 +36,8 @@
#include "sp_rcontext.h"
#include "sp_cache.h"
#include "set_var.h"
+#include "sql_parse.h" // cleanup_items
+#include "sql_base.h" // close_thread_tables
/*
Sufficient max length of printed destinations and frame offsets (all uints).
=== modified file 'sql/sp_head.h'
--- a/sql/sp_head.h 2010-02-10 21:11:06 +0000
+++ b/sql/sp_head.h 2010-04-10 09:11:47 +0000
@@ -21,6 +21,15 @@
#pragma interface /* gcc class implementation */
#endif
+/*
+ It is necessary to include set_var.h instead of item.h because there
+ are dependencies on include order for set_var.h and item.h. This
+ will be resolved later.
+*/
+#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
+#include "sql_class.h" // THD, set_var.h: THD
+#include "set_var.h" // Item
+
#include <stddef.h>
/**
=== modified file 'sql/sp_pcontext.cc'
--- a/sql/sp_pcontext.cc 2009-11-24 19:46:33 +0000
+++ b/sql/sp_pcontext.cc 2010-04-09 08:22:10 +0000
@@ -13,7 +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 */
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h"
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation
#endif
=== modified file 'sql/sp_pcontext.h'
--- a/sql/sp_pcontext.h 2010-02-04 10:55:39 +0000
+++ b/sql/sp_pcontext.h 2010-04-08 10:50:40 +0000
@@ -21,6 +21,12 @@
#pragma interface /* gcc class implementation */
#endif
+#include "sql_string.h" // LEX_STRING
+#include "mysql_com.h" // enum_field_types
+#include "field.h" // Create_field
+
+class sp_pcontext;
+
typedef enum
{
sp_param_in,
=== modified file 'sql/sp_rcontext.cc'
--- a/sql/sp_rcontext.cc 2009-12-15 06:57:50 +0000
+++ b/sql/sp_rcontext.cc 2010-04-09 08:22:10 +0000
@@ -13,7 +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 */
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h"
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation
#endif
@@ -27,7 +29,7 @@
#include "sql_cursor.h"
#include "sp_rcontext.h"
#include "sp_pcontext.h"
-
+#include "sql_select.h" // create_virtual_tmp_table
sp_rcontext::sp_rcontext(sp_pcontext *root_parsing_ctx,
Field *return_value_fld,
=== modified file 'sql/sp_rcontext.h'
--- a/sql/sp_rcontext.h 2009-09-25 14:15:30 +0000
+++ b/sql/sp_rcontext.h 2010-04-08 10:50:40 +0000
@@ -21,11 +21,19 @@
#pragma interface /* gcc class implementation */
#endif
+#include "sql_class.h" // select_result_interceptor
+
struct sp_cond_type;
class sp_cursor;
struct sp_variable;
class sp_lex_keeper;
class sp_instr_cpush;
+class Query_arena;
+class sp_head;
+class sp_pcontext;
+class Item_cache;
+typedef class st_select_lex_unit SELECT_LEX_UNIT;
+class Server_side_cursor;
#define SP_HANDLER_NONE 0
#define SP_HANDLER_EXIT 1
=== modified file 'sql/spatial.cc'
--- a/sql/spatial.cc 2010-02-17 10:28:57 +0000
+++ b/sql/spatial.cc 2010-04-09 08:22:10 +0000
@@ -13,7 +13,11 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "mysql_priv.h"
+#include "my_global.h" // REQUIRED for HAVE_* below
+#include "sql_priv.h"
+#include "spatial.h"
+#include "gstream.h" // Gis_read_stream
+#include "sql_string.h" // String
#ifdef HAVE_SPATIAL
=== modified file 'sql/spatial.h'
--- a/sql/spatial.h 2009-06-17 15:26:50 +0000
+++ b/sql/spatial.h 2010-04-08 10:50:40 +0000
@@ -16,8 +16,12 @@
#ifndef _spatial_h
#define _spatial_h
+#include "sql_string.h" /* String, LEX_STRING */
+
#ifdef HAVE_SPATIAL
+class Gis_read_stream;
+
const uint SRID_SIZE= 4;
const uint SIZEOF_STORED_DOUBLE= 8;
const uint POINT_DATA_SIZE= SIZEOF_STORED_DOUBLE*2;
=== modified file 'sql/sql_acl.cc'
--- a/sql/sql_acl.cc 2010-03-23 09:14:15 +0000
+++ b/sql/sql_acl.cc 2010-04-10 09:11:47 +0000
@@ -24,13 +24,26 @@
in the relevant fields. Empty strings comes last.
*/
-#include "mysql_priv.h"
+#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
+#include "sql_priv.h"
+#include "sql_acl.h" // MYSQL_DB_FIELD_COUNT, ACL_ACCESS
+#include "sql_base.h" // close_thread_tables
+#include "key.h" // key_copy, key_cmp_if_same, key_restore
+#include "sql_show.h" // append_identifier
+#include "sql_table.h" // build_table_filename
#include "hash_filo.h"
+#include "sql_parse.h" // check_access
+#include "sql_view.h" // VIEW_ANY_ACL
+#include "records.h" // READ_RECORD, read_record_info,
+ // init_read_record, end_read_record
+#include "rpl_filter.h" // rpl_filter
#include <m_ctype.h>
#include <stdarg.h>
#include "sp_head.h"
#include "sp.h"
#include "transaction.h"
+#include "lock.h" // MYSQL_LOCK_IGNORE_TIMEOUT
+#include "records.h" // init_read_record, end_read_record
bool mysql_user_table_is_in_short_password_format= false;
=== modified file 'sql/sql_acl.h'
--- a/sql/sql_acl.h 2010-01-13 14:34:46 +0000
+++ b/sql/sql_acl.h 2010-04-10 09:11:47 +0000
@@ -16,7 +16,9 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "slave.h" // for tables_ok(), rpl_filter
+#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
+#include "violite.h" /* SSL_type */
+#include "sql_class.h" /* LEX_COLUMN */
#define SELECT_ACL (1L << 0)
#define INSERT_ACL (1L << 1)
@@ -287,6 +289,11 @@ bool sp_grant_privileges(THD *thd, const
bool check_routine_level_acl(THD *thd, const char *db, const char *name,
bool is_proc);
bool is_acl_user(const char *host, const char *user);
+int fill_schema_user_privileges(THD *thd, TABLE_LIST *tables, COND *cond);
+int fill_schema_schema_privileges(THD *thd, TABLE_LIST *tables, COND *cond);
+int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond);
+int fill_schema_column_privileges(THD *thd, TABLE_LIST *tables, COND *cond);
+int wild_case_compare(CHARSET_INFO *cs, const char *str,const char *wildstr);
#ifdef NO_EMBEDDED_ACCESS_CHECKS
#define check_grant(A,B,C,D,E,F) 0
=== modified file 'sql/sql_analyse.cc'
--- a/sql/sql_analyse.cc 2009-06-17 15:26:50 +0000
+++ b/sql/sql_analyse.cc 2010-04-09 08:22:10 +0000
@@ -28,7 +28,8 @@
#define MYSQL_LEX 1
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#include "procedure.h"
#include "sql_analyse.h"
#include <m_ctype.h>
=== modified file 'sql/sql_analyse.h'
--- a/sql/sql_analyse.h 2009-10-26 14:02:26 +0000
+++ b/sql/sql_analyse.h 2010-04-08 10:50:40 +0000
@@ -23,6 +23,8 @@
#pragma interface /* gcc class implementation */
#endif
+#include "procedure.h" /* Procedure */
+
#define my_thd_charset default_charset_info
#define DEC_IN_AVG 4
@@ -359,4 +361,6 @@ public:
List<Item> &field_list);
};
+bool append_escaped(String *to_str, String *from_str);
+
#endif /* SQL_ANALYSE_INCLUDED */
=== modified file 'sql/sql_audit.cc'
--- a/sql/sql_audit.cc 2010-01-07 05:43:05 +0000
+++ b/sql/sql_audit.cc 2010-04-08 10:50:40 +0000
@@ -13,7 +13,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#include "sql_audit.h"
extern int initialize_audit_plugin(st_plugin_int *plugin);
=== modified file 'sql/sql_audit.h'
--- a/sql/sql_audit.h 2009-10-23 06:24:37 +0000
+++ b/sql/sql_audit.h 2010-04-08 10:50:40 +0000
@@ -18,6 +18,7 @@
#include <mysql/plugin_audit.h>
+#include "sql_class.h"
extern unsigned long mysql_global_audit_mask[];
=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc 2010-03-25 09:02:07 +0000
+++ b/sql/sql_base.cc 2010-04-10 09:11:47 +0000
@@ -16,8 +16,31 @@
/* Basic functions needed by many modules */
-#include "mysql_priv.h"
+#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
+#include "sql_priv.h"
+#include "unireg.h"
#include "debug_sync.h"
+#include "sql_base.h" // setup_table_map
+#include "sql_parse.h"
+#include "lock.h" // broadcast_refresh, mysql_lock_remove,
+ // mysql_unlock_tables,
+ // mysql_lock_have_duplicate
+#include "sql_show.h" // append_identifier
+#include "strfunc.h" // find_type
+#include "parse_file.h" // sql_parse_prepare, File_parser
+#include "sql_view.h" // mysql_frm_type, mysql_make_view, VIEW_ANY_ACL
+#include "sql_parse.h" // check_table_access
+#include "sql_insert.h" // kill_delayed_threads
+#include "sql_acl.h" // *_ACL, check_grant_all_columns,
+ // check_column_grant_in_table_ref,
+ // get_column_grant
+#include "sql_partition.h" // ALTER_PARTITION_PARAM_TYPE
+#include "sql_derived.h" // mysql_derived_prepare,
+ // mysql_handle_derived,
+ // mysql_derived_filling
+#include "sql_handler.h" // mysql_ha_flush
+#include "sql_partition.h" // ALTER_PARTITION_PARAM_TYPE
+#include "log_event.h" // Query_log_event
#include "sql_select.h"
#include "sp_head.h"
#include "sp.h"
@@ -29,6 +52,7 @@
#include <my_dir.h>
#include <hash.h>
#include "rpl_filter.h"
+#include "sql_table.h" // build_table_filename
#ifdef __WIN__
#include <io.h>
#endif
=== added file 'sql/sql_base.h'
--- a/sql/sql_base.h 1970-01-01 00:00:00 +0000
+++ b/sql/sql_base.h 2010-04-12 13:18:53 +0000
@@ -0,0 +1,360 @@
+/* Copyright 2006-2008 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef SQL_BASE_INCLUDED
+#define SQL_BASE_INCLUDED
+
+#include "unireg.h" // REQUIRED: for other includes
+#include "table.h" /* open_table_mode */
+#include "sql_trigger.h" /* trg_event_type */
+#include "sql_class.h" /* enum_mark_columns */
+#include "mysqld.h" /* key_map */
+
+class Item_ident;
+struct Name_resolution_context;
+class Open_table_context;
+class Open_tables_state;
+class Prelocking_strategy;
+struct TABLE_LIST;
+class THD;
+struct handlerton;
+struct TABLE;
+
+typedef class st_select_lex SELECT_LEX;
+
+typedef struct st_lock_param_type ALTER_PARTITION_PARAM_TYPE;
+
+/*
+ This enumeration type is used only by the function find_item_in_list
+ to return the info on how an item has been resolved against a list
+ of possibly aliased items.
+ The item can be resolved:
+ - against an alias name of the list's element (RESOLVED_AGAINST_ALIAS)
+ - against non-aliased field name of the list (RESOLVED_WITH_NO_ALIAS)
+ - against an aliased field name of the list (RESOLVED_BEHIND_ALIAS)
+ - ignoring the alias name in cases when SQL requires to ignore aliases
+ (e.g. when the resolved field reference contains a table name or
+ when the resolved item is an expression) (RESOLVED_IGNORING_ALIAS)
+*/
+enum enum_resolution_type {
+ NOT_RESOLVED=0,
+ RESOLVED_IGNORING_ALIAS,
+ RESOLVED_BEHIND_ALIAS,
+ RESOLVED_WITH_NO_ALIAS,
+ RESOLVED_AGAINST_ALIAS
+};
+
+enum enum_open_table_action {OT_NO_ACTION= 0, OT_BACK_OFF_AND_RETRY,
+ OT_DISCOVER, OT_REPAIR};
+
+enum find_item_error_report_type {REPORT_ALL_ERRORS, REPORT_EXCEPT_NOT_FOUND,
+ IGNORE_ERRORS, REPORT_EXCEPT_NON_UNIQUE,
+ IGNORE_EXCEPT_NON_UNIQUE};
+
+enum enum_tdc_remove_table_type {TDC_RT_REMOVE_ALL, TDC_RT_REMOVE_NOT_OWN,
+ TDC_RT_REMOVE_UNUSED};
+
+/* bits for last argument to remove_table_from_cache() */
+#define RTFC_NO_FLAG 0x0000
+#define RTFC_OWNED_BY_THD_FLAG 0x0001
+#define RTFC_WAIT_OTHER_THREAD_FLAG 0x0002
+#define RTFC_CHECK_KILLED_FLAG 0x0004
+
+bool check_dup(const char *db, const char *name, TABLE_LIST *tables);
+bool table_cache_init(void);
+void table_cache_free(void);
+bool table_def_init(void);
+void table_def_free(void);
+void table_def_start_shutdown(void);
+void assign_new_table_id(TABLE_SHARE *share);
+uint cached_open_tables(void);
+uint cached_table_definitions(void);
+uint create_table_def_key(THD *thd, char *key, TABLE_LIST *table_list,
+ bool tmp_table);
+TABLE_SHARE *get_table_share(THD *thd, TABLE_LIST *table_list, char *key,
+ uint key_length, uint db_flags, int *error,
+ my_hash_value_type hash_value);
+void release_table_share(TABLE_SHARE *share);
+TABLE_SHARE *get_cached_table_share(const char *db, const char *table_name);
+
+TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type update,
+ uint lock_flags);
+bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
+ Open_table_context *ot_ctx, uint flags);
+bool name_lock_locked_table(THD *thd, TABLE_LIST *tables);
+bool reopen_name_locked_table(THD* thd, TABLE_LIST* table_list, bool link_in);
+TABLE *table_cache_insert_placeholder(THD *thd, const char *key,
+ uint key_length);
+bool lock_table_name_if_not_cached(THD *thd, const char *db,
+ const char *table_name, TABLE **table);
+void detach_merge_children(TABLE *table, bool clear_refs);
+bool fix_merge_after_open(TABLE_LIST *old_child_list, TABLE_LIST **old_last,
+ TABLE_LIST *new_child_list, TABLE_LIST **new_last);
+bool reopen_table(TABLE *table);
+bool reopen_tables(THD *thd,bool get_locks,bool in_refresh);
+void close_data_files_and_morph_locks(THD *thd, const char *db,
+ const char *table_name);
+void close_handle_and_leave_table_as_lock(TABLE *table);
+bool open_new_frm(THD *thd, TABLE_SHARE *share, const char *alias,
+ uint db_stat, uint prgflag,
+ uint ha_open_flags, TABLE *outparam, TABLE_LIST *table_desc,
+ MEM_ROOT *mem_root);
+bool wait_for_tables(THD *thd);
+bool table_is_used(TABLE *table, bool wait_for_name_lock);
+TABLE *drop_locked_tables(THD *thd,const char *db, const char *table_name);
+void abort_locked_tables(THD *thd,const char *db, const char *table_name);
+
+bool get_key_map_from_key_list(key_map *map, TABLE *table,
+ List<String> *index_list);
+TABLE *open_temporary_table(THD *thd, const char *path, const char *db,
+ const char *table_name, bool link_in_list,
+ open_table_mode open_mode);
+TABLE *find_locked_table(TABLE *list, const char *db, const char *table_name);
+TABLE *find_write_locked_table(TABLE *list, const char *db,
+ const char *table_name);
+thr_lock_type read_lock_type_for_table(THD *thd, TABLE *table);
+
+my_bool mysql_rm_tmp_tables(void);
+bool rm_temporary_table(handlerton *base, char *path, bool frm_only);
+void close_tables_for_reopen(THD *thd, TABLE_LIST **tables,
+ MDL_ticket *start_of_statement_svp);
+TABLE_LIST *find_table_in_list(TABLE_LIST *table,
+ TABLE_LIST *TABLE_LIST::*link,
+ const char *db_name,
+ const char *table_name);
+TABLE *find_temporary_table(THD *thd, const char *db, const char *table_name);
+TABLE *find_temporary_table(THD *thd, TABLE_LIST *table_list);
+void close_thread_tables(THD *thd);
+bool fill_record_n_invoke_before_triggers(THD *thd, List<Item> &fields,
+ List<Item> &values,
+ bool ignore_errors,
+ Table_triggers_list *triggers,
+ enum trg_event_type event);
+bool fill_record_n_invoke_before_triggers(THD *thd, Field **field,
+ List<Item> &values,
+ bool ignore_errors,
+ Table_triggers_list *triggers,
+ enum trg_event_type event);
+bool insert_fields(THD *thd, Name_resolution_context *context,
+ const char *db_name, const char *table_name,
+ List_iterator<Item> *it, bool any_privileges);
+int setup_wild(THD *thd, TABLE_LIST *tables, List<Item> &fields,
+ List<Item> *sum_func_list, uint wild_num);
+bool setup_fields(THD *thd, Item** ref_pointer_array,
+ List<Item> &item, enum_mark_columns mark_used_columns,
+ List<Item> *sum_func_list, bool allow_sum_func);
+bool fill_record(THD *thd, Field **field, List<Item> &values,
+ bool ignore_errors);
+
+Field *
+find_field_in_tables(THD *thd, Item_ident *item,
+ TABLE_LIST *first_table, TABLE_LIST *last_table,
+ Item **ref, find_item_error_report_type report_error,
+ bool check_privileges, bool register_tree_change);
+Field *
+find_field_in_table_ref(THD *thd, TABLE_LIST *table_list,
+ const char *name, uint length,
+ const char *item_name, const char *db_name,
+ const char *table_name, Item **ref,
+ bool check_privileges, bool allow_rowid,
+ uint *cached_field_index_ptr,
+ bool register_tree_change, TABLE_LIST **actual_table);
+Field *
+find_field_in_table(THD *thd, TABLE *table, const char *name, uint length,
+ bool allow_rowid, uint *cached_field_index_ptr);
+Field *
+find_field_in_table_sef(TABLE *table, const char *name);
+Item ** find_item_in_list(Item *item, List<Item> &items, uint *counter,
+ find_item_error_report_type report_error,
+ enum_resolution_type *resolution);
+bool setup_tables(THD *thd, Name_resolution_context *context,
+ List<TABLE_LIST> *from_clause, TABLE_LIST *tables,
+ TABLE_LIST **leaves, bool select_insert);
+bool setup_tables_and_check_access(THD *thd,
+ Name_resolution_context *context,
+ List<TABLE_LIST> *from_clause,
+ TABLE_LIST *tables,
+ TABLE_LIST **leaves,
+ bool select_insert,
+ ulong want_access_first,
+ ulong want_access);
+bool wait_while_table_is_used(THD *thd, TABLE *table,
+ enum ha_extra_function function);
+void unlink_open_table(THD *thd, TABLE *find, bool unlock);
+
+void drop_open_table(THD *thd, TABLE *table, const char *db_name,
+ const char *table_name);
+void close_all_tables_for_name(THD *thd, TABLE_SHARE *share,
+ bool remove_from_locked_tables);
+void update_non_unique_table_error(TABLE_LIST *update,
+ const char *operation,
+ TABLE_LIST *duplicate);
+int setup_conds(THD *thd, TABLE_LIST *tables, TABLE_LIST *leaves,
+ COND **conds);
+int setup_ftfuncs(SELECT_LEX* select);
+int init_ftfuncs(THD *thd, SELECT_LEX* select, bool no_order);
+void wait_for_condition(THD *thd, mysql_mutex_t *mutex,
+ mysql_cond_t *cond);
+bool open_tables(THD *thd, TABLE_LIST **tables, uint *counter, uint flags,
+ Prelocking_strategy *prelocking_strategy);
+/* open_and_lock_tables with optional derived handling */
+bool open_and_lock_tables(THD *thd, TABLE_LIST *tables,
+ bool derived, uint flags,
+ Prelocking_strategy *prelocking_strategy);
+int open_and_lock_tables_derived(THD *thd, TABLE_LIST *tables, bool derived);
+/* simple open_and_lock_tables without derived handling for single table */
+TABLE *open_n_lock_single_table(THD *thd, TABLE_LIST *table_l,
+ thr_lock_type lock_type, uint flags);
+bool open_normal_and_derived_tables(THD *thd, TABLE_LIST *tables, uint flags);
+bool lock_tables(THD *thd, TABLE_LIST *tables, uint counter, uint flags);
+int abort_and_upgrade_lock(ALTER_PARTITION_PARAM_TYPE *lpt);
+int decide_logging_format(THD *thd, TABLE_LIST *tables);
+void free_io_cache(TABLE *entry);
+void intern_close_table(TABLE *entry);
+bool close_thread_table(THD *thd, TABLE **table_ptr);
+void close_temporary_tables(THD *thd);
+TABLE_LIST *unique_table(THD *thd, TABLE_LIST *table, TABLE_LIST *table_list,
+ bool check_alias);
+int drop_temporary_table(THD *thd, TABLE_LIST *table_list);
+void close_temporary_table(THD *thd, TABLE *table, bool free_share,
+ bool delete_table);
+void close_temporary(TABLE *table, bool free_share, bool delete_table);
+bool rename_temporary_table(THD* thd, TABLE *table, const char *new_db,
+ const char *table_name);
+void mysql_wait_completed_table(ALTER_PARTITION_PARAM_TYPE *lpt, TABLE *my_table);
+void remove_db_from_cache(const char *db);
+void flush_tables();
+bool is_equal(const LEX_STRING *a, const LEX_STRING *b);
+
+/* Functions to work with system tables. */
+bool open_system_tables_for_read(THD *thd, TABLE_LIST *table_list,
+ Open_tables_backup *backup);
+void close_system_tables(THD *thd, Open_tables_backup *backup);
+TABLE *open_system_table_for_update(THD *thd, TABLE_LIST *one_table);
+TABLE *open_log_table(THD *thd, TABLE_LIST *one_table, Open_tables_backup *backup);
+void close_log_table(THD *thd, Open_tables_backup *backup);
+
+TABLE *open_performance_schema_table(THD *thd, TABLE_LIST *one_table,
+ Open_tables_state *backup);
+void close_performance_schema_table(THD *thd, Open_tables_state *backup);
+
+bool close_cached_tables(THD *thd, TABLE_LIST *tables, bool have_lock,
+ bool wait_for_refresh);
+bool close_cached_connection_tables(THD *thd, bool wait_for_refresh,
+ LEX_STRING *connect_string,
+ bool have_lock = FALSE);
+void close_all_tables_for_name(THD *thd, TABLE_SHARE *share,
+ bool remove_from_locked_tables);
+OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *db, const char *wild);
+bool remove_table_from_cache(THD *thd, const char *db, const char *table,
+ uint flags);
+void tdc_remove_table(THD *thd, enum_tdc_remove_table_type remove_type,
+ const char *db, const char *table_name);
+bool tdc_open_view(THD *thd, TABLE_LIST *table_list, const char *alias,
+ char *cache_key, uint cache_key_length,
+ MEM_ROOT *mem_root, uint flags);
+TABLE *find_table_for_mdl_upgrade(TABLE *list, const char *db,
+ const char *table_name,
+ bool no_error);
+void mark_tmp_table_for_reuse(TABLE *table);
+
+extern uint table_cache_count;
+extern TABLE *unused_tables;
+extern Item **not_found_item;
+extern Field *not_found_field;
+extern Field *view_ref_found;
+extern HASH open_cache;
+extern HASH table_def_cache;
+
+/**
+ clean/setup table fields and map.
+
+ @param table TABLE structure pointer (which should be setup)
+ @param table_list TABLE_LIST structure pointer (owner of TABLE)
+ @param tablenr table number
+*/
+
+
+inline void setup_table_map(TABLE *table, TABLE_LIST *table_list, uint tablenr)
+{
+ table->used_fields= 0;
+ table->const_table= 0;
+ table->null_row= 0;
+ table->status= STATUS_NO_RECORD;
+ table->maybe_null= table_list->outer_join;
+ TABLE_LIST *embedding= table_list->embedding;
+ while (!table->maybe_null && embedding)
+ {
+ table->maybe_null= embedding->outer_join;
+ embedding= embedding->embedding;
+ }
+ table->tablenr= tablenr;
+ table->map= (table_map) 1 << tablenr;
+ table->force_index= table_list->force_index;
+ table->force_index_order= table->force_index_group= 0;
+ table->covering_keys= table->s->keys_for_keyread;
+ table->merge_keys.clear_all();
+}
+
+inline TABLE_LIST *find_table_in_global_list(TABLE_LIST *table,
+ const char *db_name,
+ const char *table_name)
+{
+ return find_table_in_list(table, &TABLE_LIST::next_global,
+ db_name, table_name);
+}
+
+inline TABLE_LIST *find_table_in_local_list(TABLE_LIST *table,
+ const char *db_name,
+ const char *table_name)
+{
+ return find_table_in_list(table, &TABLE_LIST::next_local,
+ db_name, table_name);
+}
+
+inline bool setup_fields_with_no_wrap(THD *thd, Item **ref_pointer_array,
+ List<Item> &item,
+ enum_mark_columns mark_used_columns,
+ List<Item> *sum_func_list,
+ bool allow_sum_func)
+{
+ bool res;
+ thd->lex->select_lex.no_wrap_view_item= TRUE;
+ res= setup_fields(thd, ref_pointer_array, item, mark_used_columns,
+ sum_func_list, allow_sum_func);
+ thd->lex->select_lex.no_wrap_view_item= FALSE;
+ return res;
+}
+
+inline bool
+open_tables(THD *thd, TABLE_LIST **tables, uint *counter, uint flags)
+{
+ DML_prelocking_strategy prelocking_strategy;
+
+ return open_tables(thd, tables, counter, flags, &prelocking_strategy);
+}
+
+
+/* open_and_lock_tables with derived handling */
+inline bool open_and_lock_tables(THD *thd, TABLE_LIST *tables,
+ bool derived, uint flags)
+{
+ DML_prelocking_strategy prelocking_strategy;
+
+ return open_and_lock_tables(thd, tables, derived, flags,
+ &prelocking_strategy);
+}
+
+#endif /* SQL_BASE_INCLUDED */
=== modified file 'sql/sql_binlog.cc'
--- a/sql/sql_binlog.cc 2009-12-11 15:44:05 +0000
+++ b/sql/sql_binlog.cc 2010-04-09 08:22:10 +0000
@@ -13,10 +13,22 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#include "rpl_rli_file.h"
+#include "sql_binlog.h"
+#include "sql_parse.h" // check_global_access
+#include "sql_acl.h" // *_ACL
+#include "rpl_rli.h"
#include "base64.h"
-
+#include "slave.h" // apply_event_and_update_pos
+#include "log_event.h" // Format_description_log_event,
+ // EVENT_LEN_OFFSET,
+ // EVENT_TYPE_OFFSET,
+ // FORMAT_DESCRIPTION_LOG_EVENT,
+ // START_EVENT_V3,
+ // Log_event_type,
+ // Log_event
/**
Execute a BINLOG statement.
=== added file 'sql/sql_binlog.h'
--- a/sql/sql_binlog.h 1970-01-01 00:00:00 +0000
+++ b/sql/sql_binlog.h 2010-03-31 14:05:33 +0000
@@ -0,0 +1,23 @@
+/* Copyright 2006-2008 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef SQL_BINLOG_INCLUDED
+#define SQL_BINLOG_INCLUDED
+
+class THD;
+
+void mysql_client_binlog_statement(THD *thd);
+
+#endif /* SQL_BINLOG_INCLUDED */
=== modified file 'sql/sql_bitmap.h'
--- a/sql/sql_bitmap.h 2009-05-14 21:49:53 +0000
+++ b/sql/sql_bitmap.h 2010-04-08 10:50:40 +0000
@@ -1,5 +1,3 @@
-#ifndef _SQL_BITMAP_H_
-#define _SQL_BITMAP_H_
/* Copyright (C) 2003 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -21,6 +19,9 @@
also be able to use 32 or 64 bits bitmaps very efficiently
*/
+#ifndef SQL_BITMAP_INCLUDED
+#define SQL_BITMAP_INCLUDED
+
#include <my_bitmap.h>
template <uint default_width> class Bitmap
@@ -232,7 +233,6 @@ public:
};
-
#if 0
void print_bits(table_map bmp)
{
@@ -261,4 +261,4 @@ int main()
}
#endif
-#endif /* _SQL_BITMAP_H_ */
+#endif /* SQL_BITMAP_INCLUDED */
=== modified file 'sql/sql_cache.cc'
--- a/sql/sql_cache.cc 2010-02-10 21:11:06 +0000
+++ b/sql/sql_cache.cc 2010-04-10 09:11:47 +0000
@@ -327,7 +327,13 @@ TODO list:
(This could be done with almost no speed penalty)
*/
-#include "mysql_priv.h"
+#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
+#include "sql_priv.h"
+#include "sql_cache.h"
+#include "sql_parse.h" // check_table_access
+#include "tztime.h" // struct Time_zone
+#include "sql_acl.h" // SELECT_ACL
+#include "sql_base.h" // TMP_TABLE_KEY_EXTRA
#ifdef HAVE_QUERY_CACHE
#include <m_ctype.h>
#include <my_dir.h>
=== modified file 'sql/sql_cache.h'
--- a/sql/sql_cache.h 2010-01-07 05:48:46 +0000
+++ b/sql/sql_cache.h 2010-04-12 13:18:53 +0000
@@ -16,6 +16,16 @@
#ifndef _SQL_CACHE_H
#define _SQL_CACHE_H
+#include "hash.h"
+#include "my_base.h" /* ha_rows */
+
+class MY_LOCALE;
+struct TABLE_LIST;
+class Time_zone;
+struct LEX;
+struct TABLE;
+typedef struct st_changed_table_list CHANGED_TABLE_LIST;
+
/* Query cache */
/*
@@ -66,6 +76,11 @@ struct Query_cache_result;
class Query_cache;
struct Query_cache_tls;
struct LEX;
+class THD;
+
+typedef my_bool (*qc_engine_callback)(THD *thd, char *table_key,
+ uint key_length,
+ ulonglong *engine_data);
/**
This class represents a node in the linked chain of queries
@@ -501,5 +516,68 @@ protected:
void unlock(void);
};
+#ifdef HAVE_QUERY_CACHE
+struct Query_cache_query_flags
+{
+ unsigned int client_long_flag:1;
+ unsigned int client_protocol_41:1;
+ unsigned int protocol_type:2;
+ unsigned int more_results_exists:1;
+ unsigned int in_trans:1;
+ unsigned int autocommit:1;
+ unsigned int pkt_nr;
+ uint character_set_client_num;
+ uint character_set_results_num;
+ uint collation_connection_num;
+ ha_rows limit;
+ Time_zone *time_zone;
+ ulong sql_mode;
+ ulong max_sort_length;
+ ulong group_concat_max_len;
+ ulong default_week_format;
+ ulong div_precision_increment;
+ MY_LOCALE *lc_time_names;
+};
+#define QUERY_CACHE_FLAGS_SIZE sizeof(Query_cache_query_flags)
+#include "sql_cache.h"
+#define query_cache_abort(A) query_cache.abort(A)
+#define query_cache_end_of_result(A) query_cache.end_of_result(A)
+#define query_cache_store_query(A, B) query_cache.store_query(A, B)
+#define query_cache_destroy() query_cache.destroy()
+#define query_cache_result_size_limit(A) query_cache.result_size_limit(A)
+#define query_cache_init() query_cache.init()
+#define query_cache_resize(A) query_cache.resize(A)
+#define query_cache_set_min_res_unit(A) query_cache.set_min_res_unit(A)
+#define query_cache_invalidate3(A, B, C) query_cache.invalidate(A, B, C)
+#define query_cache_invalidate1(A) query_cache.invalidate(A)
+#define query_cache_send_result_to_client(A, B, C) \
+ query_cache.send_result_to_client(A, B, C)
+#define query_cache_invalidate_by_MyISAM_filename_ref \
+ &query_cache_invalidate_by_MyISAM_filename
+/* note the "maybe": it's a read without mutex */
+#define query_cache_maybe_disabled(T) \
+ (T->variables.query_cache_type == 0 || query_cache.query_cache_size == 0)
+#define query_cache_is_cacheable_query(L) \
+ (((L)->sql_command == SQLCOM_SELECT) && (L)->safe_to_cache_query)
+#else
+#define QUERY_CACHE_FLAGS_SIZE 0
+#define query_cache_store_query(A, B)
+#define query_cache_destroy()
+#define query_cache_result_size_limit(A)
+#define query_cache_init()
+#define query_cache_resize(A)
+#define query_cache_set_min_res_unit(A)
+#define query_cache_invalidate3(A, B, C)
+#define query_cache_invalidate1(A)
+#define query_cache_send_result_to_client(A, B, C) 0
+#define query_cache_invalidate_by_MyISAM_filename_ref NULL
+
+#define query_cache_abort(A)
+#define query_cache_end_of_result(A)
+#define query_cache_invalidate_by_MyISAM_filename_ref NULL
+#define query_cache_maybe_disabled(T) 1
+#define query_cache_is_cacheable_query(L) 0
+#endif /*HAVE_QUERY_CACHE*/
+
extern Query_cache query_cache;
#endif
=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc 2010-03-23 09:14:15 +0000
+++ b/sql/sql_class.cc 2010-04-10 09:11:47 +0000
@@ -25,7 +25,18 @@
#pragma implementation // gcc: Class implementation
#endif
-#include "mysql_priv.h"
+#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
+#include "sql_priv.h"
+#include "unireg.h" // REQUIRED: for other includes
+#include "sql_class.h"
+#include "lock.h" // unlock_global_read_lock, mysql_unlock_tables
+#include "sql_cache.h" // query_cache_abort
+#include "sql_base.h" // close_thread_tables
+#include "sql_time.h" // date_time_format_copy
+#include "sql_acl.h" // NO_ACCESS,
+ // acl_getroot_no_password
+#include "sql_base.h" // close_temporary_tables
+#include "sql_handler.h" // mysql_ha_cleanup
#include "rpl_rli.h"
#include "rpl_filter.h"
#include "rpl_record.h"
@@ -46,6 +57,7 @@
#include "sp_cache.h"
#include "transaction.h"
#include "debug_sync.h"
+#include "sql_parse.h" // is_update_query
/*
The following is used to initialise Table_ident with a internal
=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h 2010-03-23 09:14:15 +0000
+++ b/sql/sql_class.h 2010-04-10 09:11:47 +0000
@@ -23,10 +23,22 @@
#pragma interface /* gcc class implementation */
#endif
+#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
+#ifdef MYSQL_SERVER
+#include "unireg.h" // REQUIRED: for other includes
+#endif
+#include "sql_const.h"
#include <mysql/plugin_audit.h>
#include "log.h"
#include "rpl_tblmap.h"
#include "mdl.h"
+#include "sql_locale.h" /* my_locale_st */
+#include "sql_profile.h" /* PROFILING */
+#include "scheduler.h" /* thd_scheduler */
+#include "protocol.h" /* Protocol_text, Protocol_binary */
+#include "violite.h" /* vio_is_connected */
+#include "thr_lock.h" /* thr_lock_type, THR_LOCK_DATA,
+ THR_LOCK_INFO, THR_LOCK_OWNER */
#include <waiting_threads.h>
@@ -42,6 +54,8 @@ class Lex_input_stream;
class Parser_state;
class Rows_log_event;
class Sroutine_hash_entry;
+class User_level_lock;
+class user_var_entry;
enum enum_enable_or_disable { LEAVE_AS_IS, ENABLE, DISABLE };
enum enum_ha_read_modes { RFIRST, RNEXT, RPREV, RLAST, RKEY, RNEXT_SAME };
@@ -57,6 +71,40 @@ enum enum_mark_columns
{ MARK_COLUMNS_NONE, MARK_COLUMNS_READ, MARK_COLUMNS_WRITE};
enum enum_filetype { FILETYPE_CSV, FILETYPE_XML };
+/* Bits for different SQL modes modes (including ANSI mode) */
+#define MODE_REAL_AS_FLOAT 1
+#define MODE_PIPES_AS_CONCAT 2
+#define MODE_ANSI_QUOTES 4
+#define MODE_IGNORE_SPACE 8
+#define MODE_NOT_USED 16
+#define MODE_ONLY_FULL_GROUP_BY 32
+#define MODE_NO_UNSIGNED_SUBTRACTION 64
+#define MODE_NO_DIR_IN_CREATE 128
+#define MODE_POSTGRESQL 256
+#define MODE_ORACLE 512
+#define MODE_MSSQL 1024
+#define MODE_DB2 2048
+#define MODE_MAXDB 4096
+#define MODE_NO_KEY_OPTIONS 8192
+#define MODE_NO_TABLE_OPTIONS 16384
+#define MODE_NO_FIELD_OPTIONS 32768
+#define MODE_MYSQL323 65536L
+#define MODE_MYSQL40 (MODE_MYSQL323*2)
+#define MODE_ANSI (MODE_MYSQL40*2)
+#define MODE_NO_AUTO_VALUE_ON_ZERO (MODE_ANSI*2)
+#define MODE_NO_BACKSLASH_ESCAPES (MODE_NO_AUTO_VALUE_ON_ZERO*2)
+#define MODE_STRICT_TRANS_TABLES (MODE_NO_BACKSLASH_ESCAPES*2)
+#define MODE_STRICT_ALL_TABLES (MODE_STRICT_TRANS_TABLES*2)
+#define MODE_NO_ZERO_IN_DATE (MODE_STRICT_ALL_TABLES*2)
+#define MODE_NO_ZERO_DATE (MODE_NO_ZERO_IN_DATE*2)
+#define MODE_INVALID_DATES (MODE_NO_ZERO_DATE*2)
+#define MODE_ERROR_FOR_DIVISION_BY_ZERO (MODE_INVALID_DATES*2)
+#define MODE_TRADITIONAL (MODE_ERROR_FOR_DIVISION_BY_ZERO*2)
+#define MODE_NO_AUTO_CREATE_USER (MODE_TRADITIONAL*2)
+#define MODE_HIGH_NOT_PRECEDENCE (MODE_NO_AUTO_CREATE_USER*2)
+#define MODE_NO_ENGINE_SUBSTITUTION (MODE_HIGH_NOT_PRECEDENCE*2)
+#define MODE_PAD_CHAR_TO_FULL_LENGTH (1ULL << 31)
+
extern char internal_table_name[2];
extern char empty_c_string[1];
extern MYSQL_PLUGIN_IMPORT const char **errmesg;
@@ -250,6 +298,8 @@ public:
LEX_COLUMN (const String& x,const uint& y ): column (x),rights (y) {}
};
+class MY_LOCALE;
+
/**
Query_cache_tls -- query cache thread local data.
*/
@@ -2818,8 +2868,6 @@ public:
bool escaped_given(void);
};
-#include "log_event.h"
-
/*
This is used to get result from a select
*/
@@ -3612,13 +3660,55 @@ public:
*/
#define CF_SKIP_QUESTIONS (1U << 1)
-/* Functions in sql_class.cc */
-
void add_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var);
void add_diff_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var,
STATUS_VAR *dec_var);
void mark_transaction_to_rollback(THD *thd, bool all);
+/*
+ This prototype is placed here instead of in item_func.h because it
+ depends on the definition of enum_sql_command, which is in this
+ file.
+ */
+int get_var_with_binlog(THD *thd, enum_sql_command sql_command,
+ LEX_STRING &name, user_var_entry **out_entry);
+
+/* Inline functions */
+
+inline bool add_item_to_list(THD *thd, Item *item)
+{
+ return thd->lex->current_select->add_item_to_list(thd, item);
+}
+
+inline bool add_value_to_list(THD *thd, Item *value)
+{
+ return thd->lex->value_list.push_back(value);
+}
+
+inline bool add_order_to_list(THD *thd, Item *item, bool asc)
+{
+ return thd->lex->current_select->add_order_to_list(thd, item, asc);
+}
+
+inline bool add_group_to_list(THD *thd, Item *item, bool asc)
+{
+ return thd->lex->current_select->add_group_to_list(thd, item, asc);
+}
+
#endif /* MYSQL_SERVER */
+
+/**
+ The meat of thd_proc_info(THD*, char*), a macro that packs the last
+ three calling-info parameters.
+*/
+extern "C"
+const char *set_thd_proc_info(THD *thd, const char *info,
+ const char *calling_func,
+ const char *calling_file,
+ const unsigned int calling_line);
+
+#define thd_proc_info(thd, msg) \
+ set_thd_proc_info(thd, msg, __func__, __FILE__, __LINE__)
+
#endif /* SQL_CLASS_INCLUDED */
=== modified file 'sql/sql_client.cc'
--- a/sql/sql_client.cc 2007-05-24 09:21:27 +0000
+++ b/sql/sql_client.cc 2010-04-09 08:22:10 +0000
@@ -17,7 +17,9 @@
This files defines some MySQL C API functions that are server specific
*/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "sql_class.h" // system_variables
/*
Function called by my_net_init() to set some check variables
=== modified file 'sql/sql_connect.cc'
--- a/sql/sql_connect.cc 2010-02-04 10:55:39 +0000
+++ b/sql/sql_connect.cc 2010-04-10 09:11:47 +0000
@@ -18,9 +18,23 @@
Functions to autenticate and handle reqests for a connection
*/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#ifndef __WIN__
+#include <netdb.h> // getservbyname, servent
+#endif
#include "sql_audit.h"
+#include "sql_connect.h"
+#include "my_global.h"
#include "probes_mysql.h"
+#include "unireg.h" // REQUIRED: for other includes
+#include "sql_parse.h" // sql_command_flags,
+ // execute_init_command,
+ // do_command
+#include "sql_db.h" // mysql_change_db
+#include "hostname.h" // inc_host_errors, ip_to_hostname,
+ // reset_host_errors
+#include "sql_acl.h" // acl_getroot, NO_ACCESS, SUPER_ACL
#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
/*
=== added file 'sql/sql_connect.h'
--- a/sql/sql_connect.h 1970-01-01 00:00:00 +0000
+++ b/sql/sql_connect.h 2010-04-08 10:50:40 +0000
@@ -0,0 +1,45 @@
+/* Copyright 2006-2008 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef SQL_CONNECT_INCLUDED
+#define SQL_CONNECT_INCLUDED
+
+#include "my_sys.h" /* pthread_handler_t */
+#include "mysql_com.h" /* enum_server_command */
+
+class THD;
+typedef struct st_lex_user LEX_USER;
+typedef struct user_conn USER_CONN;
+
+void init_max_user_conn(void);
+void free_max_user_conn(void);
+
+pthread_handler_t handle_one_connection(void *arg);
+void do_handle_one_connection(THD *thd_arg);
+bool init_new_connection_handler_thread();
+void reset_mqh(LEX_USER *lu, bool get_them);
+bool check_mqh(THD *thd, uint check_command);
+void time_out_user_resource_limits(THD *thd, USER_CONN *uc);
+void decrease_user_connections(USER_CONN *uc);
+void thd_init_client_charset(THD *thd, uint cs_number);
+bool setup_connection_thread_globals(THD *thd);
+bool login_connection(THD *thd);
+void end_connection(THD *thd);
+
+int check_user(THD *thd, enum enum_server_command command,
+ const char *passwd, uint passwd_len, const char *db,
+ bool check_count);
+
+#endif /* SQL_CONNECT_INCLUDED */
=== added file 'sql/sql_const.h'
--- a/sql/sql_const.h 1970-01-01 00:00:00 +0000
+++ b/sql/sql_const.h 2010-04-08 10:50:40 +0000
@@ -0,0 +1,258 @@
+/* Copyright 2006-2008 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ @file
+ File containing constants that can be used throughout the server.
+
+ @note This file shall not contain any includes of any kinds.
+*/
+
+#ifndef SQL_CONST_INCLUDED
+#define SQL_CONST_INCLUDED
+
+#define LIBLEN FN_REFLEN-FN_LEN /* Max l{ngd p} dev */
+/* extra 4+4 bytes for slave tmp tables */
+#define MAX_DBKEY_LENGTH (NAME_LEN*2+1+1+4+4)
+#define MAX_ALIAS_NAME 256
+#define MAX_FIELD_NAME 34 /* Max colum name length +2 */
+#define MAX_SYS_VAR_LENGTH 32
+#define MAX_KEY MAX_INDEXES /* Max used keys */
+#define MAX_REF_PARTS 16 /* Max parts used as ref */
+#define MAX_KEY_LENGTH 4096 /* max possible key */
+#define MAX_KEY_LENGTH_DECIMAL_WIDTH 4 /* strlen("4096") */
+#if SIZEOF_OFF_T > 4
+#define MAX_REFLENGTH 8 /* Max length for record ref */
+#else
+#define MAX_REFLENGTH 4 /* Max length for record ref */
+#endif
+#define MAX_HOSTNAME 61 /* len+1 in mysql.user */
+
+#define MAX_MBWIDTH 4 /* Max multibyte sequence */
+#define MAX_FIELD_CHARLENGTH 255
+#define MAX_FIELD_VARCHARLENGTH 65535
+#define MAX_FIELD_BLOBLENGTH UINT_MAX32 /* cf field_blob::get_length() */
+#define CONVERT_IF_BIGGER_TO_BLOB 512 /* Used for CREATE ... SELECT */
+
+/* Max column width +1 */
+#define MAX_FIELD_WIDTH (MAX_FIELD_CHARLENGTH*MAX_MBWIDTH+1)
+
+#define MAX_BIT_FIELD_LENGTH 64 /* Max length in bits for bit fields */
+
+#define MAX_DATE_WIDTH 10 /* YYYY-MM-DD */
+#define MAX_TIME_WIDTH 23 /* -DDDDDD HH:MM:SS.###### */
+#define MAX_DATETIME_FULL_WIDTH 29 /* YYYY-MM-DD HH:MM:SS.###### AM */
+#define MAX_DATETIME_WIDTH 19 /* YYYY-MM-DD HH:MM:SS */
+#define MAX_DATETIME_COMPRESSED_WIDTH 14 /* YYYYMMDDHHMMSS */
+
+#define MAX_TABLES (sizeof(table_map)*8-3) /* Max tables in join */
+#define PARAM_TABLE_BIT (((table_map) 1) << (sizeof(table_map)*8-3))
+#define OUTER_REF_TABLE_BIT (((table_map) 1) << (sizeof(table_map)*8-2))
+#define RAND_TABLE_BIT (((table_map) 1) << (sizeof(table_map)*8-1))
+#define PSEUDO_TABLE_BITS (PARAM_TABLE_BIT | OUTER_REF_TABLE_BIT | \
+ RAND_TABLE_BIT)
+#define MAX_FIELDS 4096 /* Limit in the .frm file */
+#define MAX_PARTITIONS 1024
+
+#define MAX_SELECT_NESTING (sizeof(nesting_map)*8-1)
+
+#define MAX_SORT_MEMORY 2048*1024
+#define MIN_SORT_MEMORY 32*1024
+
+/* Some portable defines */
+
+#define portable_sizeof_char_ptr 8
+#define STRING_BUFFER_USUAL_SIZE 80
+
+/* Memory allocated when parsing a statement / saving a statement */
+#define MEM_ROOT_BLOCK_SIZE 8192
+#define MEM_ROOT_PREALLOC 8192
+#define TRANS_MEM_ROOT_BLOCK_SIZE 4096
+#define TRANS_MEM_ROOT_PREALLOC 4096
+
+#define DEFAULT_ERROR_COUNT 64
+#define EXTRA_RECORDS 10 /* Extra records in sort */
+#define SCROLL_EXTRA 5 /* Extra scroll-rows. */
+#define FIELD_NAME_USED ((uint) 32768) /* Bit set if fieldname used */
+#define FORM_NAME_USED ((uint) 16384) /* Bit set if formname used */
+#define FIELD_NR_MASK 16383 /* To get fieldnumber */
+#define FERR -1 /* Error from my_functions */
+#define CREATE_MODE 0 /* Default mode on new files */
+#define NAMES_SEP_CHAR '\377' /* Char to sep. names */
+
+#define READ_RECORD_BUFFER (uint) (IO_SIZE*8) /* Pointer_buffer_size */
+#define DISK_BUFFER_SIZE (uint) (IO_SIZE*16) /* Size of diskbuffer */
+
+#define FRM_VER_TRUE_VARCHAR (FRM_VER+4) /* 10 */
+#define MYSQL_VERSION_TABLESPACE_IN_FRM_CGE 50120
+#define MYSQL_VERSION_TABLESPACE_IN_FRM 50205
+#define MYSQL_VERSION_TABLESPACE_IN_FRM_STR "50205"
+
+/***************************************************************************
+ Configuration parameters
+****************************************************************************/
+
+#define ACL_CACHE_SIZE 256
+#define MAX_PASSWORD_LENGTH 32
+#define HOST_CACHE_SIZE 128
+#define MAX_ACCEPT_RETRY 10 // Test accept this many times
+#define MAX_FIELDS_BEFORE_HASH 32
+#define USER_VARS_HASH_SIZE 16
+#define TABLE_OPEN_CACHE_MIN 400
+#define TABLE_OPEN_CACHE_DEFAULT 400
+#define TABLE_DEF_CACHE_DEFAULT 400
+/**
+ We must have room for at least 400 table definitions in the table
+ cache, since otherwise there is no chance prepared
+ statements that use these many tables can work.
+ Prepared statements use table definition cache ids (table_map_id)
+ as table version identifiers. If the table definition
+ cache size is less than the number of tables used in a statement,
+ the contents of the table definition cache is guaranteed to rotate
+ between a prepare and execute. This leads to stable validation
+ errors. In future we shall use more stable version identifiers,
+ for now the only solution is to ensure that the table definition
+ cache can contain at least all tables of a given statement.
+*/
+#define TABLE_DEF_CACHE_MIN 400
+
+/*
+ Stack reservation.
+ Feel free to raise this by the smallest amount you can to get the
+ "execution_constants" test to pass.
+*/
+#define STACK_MIN_SIZE 16000 // Abort if less stack during eval.
+
+#define STACK_MIN_SIZE_FOR_OPEN 1024*80
+#define STACK_BUFF_ALLOC 352 ///< For stack overrun checks
+#ifndef MYSQLD_NET_RETRY_COUNT
+#define MYSQLD_NET_RETRY_COUNT 10 ///< Abort read after this many int.
+#endif
+
+#define QUERY_ALLOC_BLOCK_SIZE 8192
+#define QUERY_ALLOC_PREALLOC_SIZE 8192
+#define TRANS_ALLOC_BLOCK_SIZE 4096
+#define TRANS_ALLOC_PREALLOC_SIZE 4096
+#define RANGE_ALLOC_BLOCK_SIZE 4096
+#define ACL_ALLOC_BLOCK_SIZE 1024
+#define UDF_ALLOC_BLOCK_SIZE 1024
+#define TABLE_ALLOC_BLOCK_SIZE 1024
+#define WARN_ALLOC_BLOCK_SIZE 2048
+#define WARN_ALLOC_PREALLOC_SIZE 1024
+
+/*
+ The following parameters is to decide when to use an extra cache to
+ optimise seeks when reading a big table in sorted order
+*/
+#define MIN_FILE_LENGTH_TO_USE_ROW_CACHE (10L*1024*1024)
+#define MIN_ROWS_TO_USE_TABLE_CACHE 100
+#define MIN_ROWS_TO_USE_BULK_INSERT 100
+
+/**
+ The following is used to decide if MySQL should use table scanning
+ instead of reading with keys. The number says how many evaluation of the
+ WHERE clause is comparable to reading one extra row from a table.
+*/
+#define TIME_FOR_COMPARE 5 // 5 compares == one read
+
+/**
+ Number of comparisons of table rowids equivalent to reading one row from a
+ table.
+*/
+#define TIME_FOR_COMPARE_ROWID (TIME_FOR_COMPARE*2)
+
+/*
+ For sequential disk seeks the cost formula is:
+ DISK_SEEK_BASE_COST + DISK_SEEK_PROP_COST * #blocks_to_skip
+
+ The cost of average seek
+ DISK_SEEK_BASE_COST + DISK_SEEK_PROP_COST*BLOCKS_IN_AVG_SEEK =1.0.
+*/
+#define DISK_SEEK_BASE_COST ((double)0.9)
+
+#define BLOCKS_IN_AVG_SEEK 128
+
+#define DISK_SEEK_PROP_COST ((double)0.1/BLOCKS_IN_AVG_SEEK)
+
+
+/**
+ Number of rows in a reference table when refereed through a not unique key.
+ This value is only used when we don't know anything about the key
+ distribution.
+*/
+#define MATCHING_ROWS_IN_OTHER_TABLE 10
+
+#define MY_CHARSET_BIN_MB_MAXLEN 1
+
+/*
+ Subquery materialization-related constants
+*/
+#define HEAP_TEMPTABLE_LOOKUP_COST 0.05
+#define DISK_TEMPTABLE_LOOKUP_COST 1.0
+
+/** Don't pack string keys shorter than this (if PACK_KEYS=1 isn't used). */
+#define KEY_DEFAULT_PACK_LENGTH 8
+
+/** Characters shown for the command in 'show processlist'. */
+#define PROCESS_LIST_WIDTH 100
+/* Characters shown for the command in 'information_schema.processlist' */
+#define PROCESS_LIST_INFO_WIDTH 65535
+
+#define PRECISION_FOR_DOUBLE 53
+#define PRECISION_FOR_FLOAT 24
+
+/* -[digits].E+## */
+#define MAX_FLOAT_STR_LENGTH (FLT_DIG + 6)
+/* -[digits].E+### */
+#define MAX_DOUBLE_STR_LENGTH (DBL_DIG + 7)
+
+/*
+ Default time to wait before aborting a new client connection
+ that does not respond to "initial server greeting" timely
+*/
+#define CONNECT_TIMEOUT 10
+
+/* The following can also be changed from the command line */
+#define DEFAULT_CONCURRENCY 10
+#define DELAYED_LIMIT 100 /**< pause after xxx inserts */
+#define DELAYED_QUEUE_SIZE 1000
+#define DELAYED_WAIT_TIMEOUT 5*60 /**< Wait for delayed insert */
+#define FLUSH_TIME 0 /**< Don't flush tables */
+#define MAX_CONNECT_ERRORS 10 ///< errors before disabling host
+
+#define LONG_TIMEOUT ((ulong) 3600L*24L*365L)
+
+/**
+ Maximum length of time zone name that we support (Time zone name is
+ char(64) in db). mysqlbinlog needs it.
+*/
+#define MAX_TIME_ZONE_NAME_LENGTH (NAME_LEN + 1)
+
+#if defined(__WIN__)
+#undef FLUSH_TIME
+#define FLUSH_TIME 1800 /**< Flush every half hour */
+
+#define INTERRUPT_PRIOR -2
+#define CONNECT_PRIOR -1
+#define WAIT_PRIOR 0
+#define QUERY_PRIOR 2
+#else
+#define INTERRUPT_PRIOR 10
+#define CONNECT_PRIOR 9
+#define WAIT_PRIOR 8
+#define QUERY_PRIOR 6
+#endif /* __WIN92__ */
+
+#endif /* SQL_CONST_INCLUDED */
=== modified file 'sql/sql_crypt.cc'
--- a/sql/sql_crypt.cc 2009-12-04 16:36:41 +0000
+++ b/sql/sql_crypt.cc 2010-04-09 08:22:10 +0000
@@ -26,7 +26,10 @@
#pragma implementation // gcc: Class implementation
#endif
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "sql_crypt.h"
+#include "password.h"
void SQL_CRYPT::init(ulong *rand_nr)
{
=== modified file 'sql/sql_crypt.h'
--- a/sql/sql_crypt.h 2010-03-23 09:14:15 +0000
+++ b/sql/sql_crypt.h 2010-04-08 10:50:40 +0000
@@ -21,6 +21,9 @@
#pragma interface /* gcc class implementation */
#endif
+#include "sql_list.h" /* Sql_alloc */
+#include "mysql_com.h" /* rand_struct */
+
class SQL_CRYPT :public Sql_alloc
{
struct my_rnd_struct rand,org_rand;
=== modified file 'sql/sql_cursor.cc'
--- a/sql/sql_cursor.cc 2010-02-10 21:11:06 +0000
+++ b/sql/sql_cursor.cc 2010-04-09 08:22:10 +0000
@@ -16,10 +16,13 @@
#pragma implementation /* gcc class implementation */
#endif
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h"
#include "sql_cursor.h"
#include "sql_select.h"
#include "probes_mysql.h"
+#include "sql_parse.h" // mysql_execute_command
/****************************************************************************
Declarations.
=== modified file 'sql/sql_cursor.h'
--- a/sql/sql_cursor.h 2007-10-16 20:11:50 +0000
+++ b/sql/sql_cursor.h 2010-03-31 14:05:33 +0000
@@ -20,6 +20,10 @@
#pragma interface /* gcc class interface */
#endif
+#include "sql_class.h" /* Query_arena */
+
+class JOIN;
+
/**
@file
=== modified file 'sql/sql_db.cc'
--- a/sql/sql_db.cc 2010-03-23 09:14:15 +0000
+++ b/sql/sql_db.cc 2010-04-10 09:11:47 +0000
@@ -16,7 +16,20 @@
/* create and drop of databases */
-#include "mysql_priv.h"
+#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
+#include "sql_priv.h"
+#include "unireg.h"
+#include "sql_db.h"
+#include "sql_cache.h" // query_cache_*
+#include "lock.h" // wait_if_global_read_lock,
+ // start_waiting_global_read_lock
+#include "sql_table.h" // build_table_filename,
+ // filename_to_tablename
+#include "sql_rename.h" // mysql_rename_tables
+#include "sql_acl.h" // SELECT_ACL, DB_ACLS,
+ // acl_get, check_grant_db
+#include "sql_base.h" // wait_for_condition
+#include "log_event.h" // Query_log_event
#include <mysys_err.h>
#include "sp.h"
#include "events.h"
=== added file 'sql/sql_db.h'
--- a/sql/sql_db.h 1970-01-01 00:00:00 +0000
+++ b/sql/sql_db.h 2010-03-31 14:05:33 +0000
@@ -0,0 +1,53 @@
+/* Copyright 2006-2008 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef SQL_DB_INCLUDED
+#define SQL_DB_INCLUDED
+
+#include "hash.h" /* HASH */
+
+class THD;
+typedef struct charset_info_st CHARSET_INFO;
+typedef struct st_ha_create_information HA_CREATE_INFO;
+typedef struct st_mysql_lex_string LEX_STRING;
+
+int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create, bool silent);
+bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create);
+bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent);
+bool mysql_upgrade_db(THD *thd, LEX_STRING *old_db);
+bool mysql_change_db(THD *thd, const LEX_STRING *new_db_name,
+ bool force_switch);
+
+bool mysql_opt_change_db(THD *thd,
+ const LEX_STRING *new_db_name,
+ LEX_STRING *saved_db_name,
+ bool force_switch,
+ bool *cur_db_changed);
+bool my_database_names_init(void);
+void my_database_names_free(void);
+bool check_db_dir_existence(const char *db_name);
+bool load_db_opt(THD *thd, const char *path, HA_CREATE_INFO *create);
+bool load_db_opt_by_name(THD *thd, const char *db_name,
+ HA_CREATE_INFO *db_create_info);
+CHARSET_INFO *get_default_db_collation(THD *thd, const char *db_name);
+bool my_dbopt_init(void);
+void my_dbopt_cleanup(void);
+
+extern int creating_database; // How many database locks are made
+extern HASH lock_db_cache;
+
+#define MY_DB_OPT_FILE "db.opt"
+
+#endif /* SQL_DB_INCLUDED */
=== modified file 'sql/sql_delete.cc'
--- a/sql/sql_delete.cc 2010-03-25 09:02:07 +0000
+++ b/sql/sql_delete.cc 2010-04-09 08:22:10 +0000
@@ -20,12 +20,28 @@
Multi-table deletes were introduced by Monty and Sinisa
*/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h"
#include "debug_sync.h"
+#include "probes_mysql.h"
+#include "sql_delete.h"
+#include "sql_cache.h" // query_cache_*
+#include "sql_base.h" // open_temprary_table
+#include "sql_table.h" // build_table_filename
+#include "lock.h" // lock_and_wait_for_table_name,
+ // unlock_table_name
+#include "sql_view.h" // check_key_in_view, mysql_frm_type
+#include "sql_parse.h" // mysql_init_select
+#include "sql_acl.h" // *_ACL
+#include "filesort.h" // filesort
+#include "sql_handler.h" // mysql_ha_rm_tables
#include "sql_select.h"
#include "sp_head.h"
#include "sql_trigger.h"
#include "transaction.h"
+#include "records.h" // init_read_record,
+ // end_read_record
/**
Implement DELETE SQL word.
=== added file 'sql/sql_delete.h'
--- a/sql/sql_delete.h 1970-01-01 00:00:00 +0000
+++ b/sql/sql_delete.h 2010-04-12 13:17:37 +0000
@@ -0,0 +1,34 @@
+/* Copyright 2006-2008 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef SQL_DELETE_INCLUDED
+#define SQL_DELETE_INCLUDED
+
+#include "my_base.h" /* ha_rows */
+
+class THD;
+struct TABLE_LIST;
+class Item;
+
+typedef class Item COND;
+typedef struct st_sql_list SQL_LIST;
+
+int mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds);
+bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
+ SQL_LIST *order, ha_rows rows, ulonglong options,
+ bool reset_auto_increment);
+bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok);
+
+#endif /* SQL_DELETE_INCLUDED */
=== modified file 'sql/sql_derived.cc'
--- a/sql/sql_derived.cc 2009-12-24 16:38:19 +0000
+++ b/sql/sql_derived.cc 2010-04-10 09:11:47 +0000
@@ -20,9 +20,13 @@
*/
-#include "mysql_priv.h"
+#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
+#include "sql_priv.h"
+#include "unireg.h"
+#include "sql_derived.h"
#include "sql_select.h"
-
+#include "sql_view.h" // check_duplicate_names
+#include "sql_acl.h" // SELECT_ACL
/*
=== added file 'sql/sql_derived.h'
--- a/sql/sql_derived.h 1970-01-01 00:00:00 +0000
+++ b/sql/sql_derived.h 2010-04-12 13:17:37 +0000
@@ -0,0 +1,29 @@
+/* Copyright 2006-2008 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef SQL_DERIVED_INCLUDED
+#define SQL_DERIVED_INCLUDED
+
+struct TABLE_LIST;
+class THD;
+struct LEX;
+
+bool mysql_handle_derived(LEX *lex, bool (*processor)(THD *thd,
+ LEX *lex,
+ TABLE_LIST *table));
+bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *t);
+bool mysql_derived_filling(THD *thd, LEX *lex, TABLE_LIST *t);
+
+#endif /* SQL_DERIVED_INCLUDED */
=== modified file 'sql/sql_do.cc'
--- a/sql/sql_do.cc 2009-12-11 15:44:05 +0000
+++ b/sql/sql_do.cc 2010-04-09 08:22:10 +0000
@@ -16,8 +16,13 @@
/* Execute DO statement */
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#include "transaction.h"
+#include "unireg.h"
+#include "sql_do.h"
+#include "sql_base.h" // setup_fields
+#include "sql_select.h" // free_underlaid_joins
bool mysql_do(THD *thd, List<Item> &values)
{
=== added file 'sql/sql_do.h'
--- a/sql/sql_do.h 1970-01-01 00:00:00 +0000
+++ b/sql/sql_do.h 2010-03-31 14:05:33 +0000
@@ -0,0 +1,26 @@
+/* Copyright 2006-2008 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef SQL_DO_INCLUDED
+#define SQL_DO_INCLUDED
+
+#include "sql_list.h" /* List */
+
+class THD;
+class Item;
+
+bool mysql_do(THD *thd, List<Item> &values);
+
+#endif /* SQL_DO_INCLUDED */
=== modified file 'sql/sql_error.cc'
--- a/sql/sql_error.cc 2009-11-02 15:11:43 +0000
+++ b/sql/sql_error.cc 2010-04-09 08:22:10 +0000
@@ -41,7 +41,9 @@ This file contains the implementation of
***********************************************************************/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h"
#include "sql_error.h"
#include "sp_rcontext.h"
=== modified file 'sql/sql_error.h'
--- a/sql/sql_error.h 2009-10-23 06:24:37 +0000
+++ b/sql/sql_error.h 2010-04-08 10:50:40 +0000
@@ -18,6 +18,7 @@
#include "sql_list.h" /* Sql_alloc, MEM_ROOT */
#include "m_string.h" /* LEX_STRING */
+#include "sql_string.h" /* String */
#include "mysql_com.h" /* MYSQL_ERRMSG_SIZE */
class THD;
=== modified file 'sql/sql_handler.cc'
--- a/sql/sql_handler.cc 2010-03-16 13:50:50 +0000
+++ b/sql/sql_handler.cc 2010-04-09 08:22:10 +0000
@@ -51,7 +51,14 @@
cursor points at the first record).
*/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "sql_handler.h"
+#include "unireg.h" // REQUIRED: for other includes
+#include "sql_base.h" // close_thread_tables
+#include "lock.h" // broadcast_refresh, mysql_unlock_tables
+#include "key.h" // key_copy
+#include "sql_base.h" // insert_fields
#include "sql_select.h"
#include <assert.h>
=== added file 'sql/sql_handler.h'
--- a/sql/sql_handler.h 1970-01-01 00:00:00 +0000
+++ b/sql/sql_handler.h 2010-04-12 13:17:37 +0000
@@ -0,0 +1,35 @@
+/* Copyright 2006-2008 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef SQL_HANDLER_INCLUDED
+#define SQL_HANDLER_INCLUDED
+
+#include "sql_class.h" /* enum_ha_read_mode */
+#include "my_base.h" /* ha_rkey_function, ha_rows */
+#include "sql_list.h" /* List */
+
+class THD;
+struct TABLE_LIST;
+
+bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen);
+bool mysql_ha_close(THD *thd, TABLE_LIST *tables);
+bool mysql_ha_read(THD *, TABLE_LIST *,enum enum_ha_read_modes,char *,
+ List<Item> *,enum ha_rkey_function,Item *,ha_rows,ha_rows);
+void mysql_ha_flush(THD *thd);
+void mysql_ha_rm_tables(THD *thd, TABLE_LIST *tables);
+void mysql_ha_cleanup(THD *thd);
+void mysql_ha_move_tickets_after_trans_sentinel(THD *thd);
+
+#endif /* SQL_HANDLER_INCLUDED */
=== modified file 'sql/sql_help.cc'
--- a/sql/sql_help.cc 2010-02-10 21:11:06 +0000
+++ b/sql/sql_help.cc 2010-04-09 08:22:10 +0000
@@ -13,7 +13,14 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h"
+#include "sql_help.h"
+#include "sql_table.h" // primary_key_name
+#include "sql_base.h" // REPORT_ALL_ERRORS, setup_tables
+#include "opt_range.h" // SQL_SELECT
+#include "records.h" // init_read_record, end_read_record
struct st_find_field
{
=== added file 'sql/sql_help.h'
--- a/sql/sql_help.h 1970-01-01 00:00:00 +0000
+++ b/sql/sql_help.h 2010-03-31 14:05:33 +0000
@@ -0,0 +1,28 @@
+/* Copyright 2006-2008 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef SQL_HELP_INCLUDED
+#define SQL_HELP_INCLUDED
+
+class THD;
+
+
+/*
+ Function prototypes
+*/
+
+bool mysqld_help (THD *thd, const char *text);
+
+#endif /* SQL_HELP_INCLUDED */
=== modified file 'sql/sql_insert.cc'
--- a/sql/sql_insert.cc 2010-03-23 09:14:15 +0000
+++ b/sql/sql_insert.cc 2010-04-10 09:11:47 +0000
@@ -54,16 +54,29 @@
*/
-#include "mysql_priv.h"
+#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
+#include "sql_priv.h"
+#include "unireg.h" // REQUIRED: for other includes
+#include "sql_insert.h"
+#include "sql_update.h" // compare_record
+#include "sql_base.h" // close_thread_tables
+#include "sql_cache.h" // query_cache_*
+#include "key.h" // key_copy
+#include "lock.h" // mysql_unlock_tables
#include "sp_head.h"
+#include "sql_view.h" // check_key_in_view, insert_view_fields
+#include "sql_table.h" // mysql_create_table_no_lock
+#include "sql_acl.h" // *_ACL, check_grant_all_columns
#include "sql_trigger.h"
#include "sql_select.h"
#include "sql_show.h"
#include "slave.h"
+#include "sql_parse.h" // end_active_trans
#include "rpl_mi.h"
#include "sql_audit.h"
#include "transaction.h"
#include "debug_sync.h"
+#include "probes_mysql.h"
#ifndef EMBEDDED_LIBRARY
static bool delayed_get_table(THD *thd, TABLE_LIST *table_list);
=== added file 'sql/sql_insert.h'
--- a/sql/sql_insert.h 1970-01-01 00:00:00 +0000
+++ b/sql/sql_insert.h 2010-03-31 14:05:33 +0000
@@ -0,0 +1,49 @@
+/* Copyright 2006-2008 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef SQL_INSERT_INCLUDED
+#define SQL_INSERT_INCLUDED
+
+#include "sql_class.h" /* enum_duplicates */
+#include "sql_list.h"
+
+/* Instead of including sql_lex.h we add this typedef here */
+typedef List<Item> List_item;
+typedef struct st_copy_info COPY_INFO;
+
+bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, TABLE *table,
+ List<Item> &fields, List_item *values,
+ List<Item> &update_fields,
+ List<Item> &update_values, enum_duplicates duplic,
+ COND **where, bool select_insert,
+ bool check_fields, bool abort_on_warning);
+bool mysql_insert(THD *thd,TABLE_LIST *table,List<Item> &fields,
+ List<List_item> &values, List<Item> &update_fields,
+ List<Item> &update_values, enum_duplicates flag,
+ bool ignore);
+void upgrade_lock_type_for_insert(THD *thd, thr_lock_type *lock_type,
+ enum_duplicates duplic,
+ bool is_multi_insert);
+int check_that_all_fields_are_given_values(THD *thd, TABLE *entry,
+ TABLE_LIST *table_list);
+void prepare_triggers_for_insert_stmt(TABLE *table);
+int write_record(THD *thd, TABLE *table, COPY_INFO *info);
+void kill_delayed_threads(void);
+
+#ifdef EMBEDDED_LIBRARY
+inline void kill_delayed_threads(void) {}
+#endif
+
+#endif /* SQL_INSERT_INCLUDED */
=== modified file 'sql/sql_join_cache.cc'
--- a/sql/sql_join_cache.cc 2010-03-25 07:29:55 +0000
+++ b/sql/sql_join_cache.cc 2010-04-08 10:50:40 +0000
@@ -27,9 +27,10 @@
#pragma implementation // gcc: Class implementation
#endif
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#include "sql_select.h"
-
+#include "key.h"
/*****************************************************************************
* Join cache module
=== modified file 'sql/sql_lex.cc'
--- a/sql/sql_lex.cc 2010-03-25 07:29:55 +0000
+++ b/sql/sql_lex.cc 2010-04-08 10:50:40 +0000
@@ -17,7 +17,12 @@
/* A lexical scanner on a temporary buffer with a yacc interface */
#define MYSQL_LEX 1
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h" // REQUIRED: for other includes
+#include "sql_class.h" // sql_lex.h: SQLCOM_END
+#include "sql_lex.h"
+#include "sql_parse.h" // add_to_list
#include "item_create.h"
#include <m_ctype.h>
#include <hash.h>
=== modified file 'sql/sql_lex.h'
--- a/sql/sql_lex.h 2010-03-23 09:14:15 +0000
+++ b/sql/sql_lex.h 2010-04-08 10:50:40 +0000
@@ -20,6 +20,11 @@
#ifndef SQL_LEX_INCLUDED
#define SQL_LEX_INCLUDED
+#include "violite.h" /* SSL_type */
+#include "sql_trigger.h"
+#include "item.h" /* From item_subselect.h: subselect_union_engine */
+#include "thr_lock.h" /* thr_lock_type, TL_UNLOCK */
+
/* YACC and LEX Definitions */
/* These may not be declared yet */
@@ -35,6 +40,12 @@ class partition_info;
class Event_parse_data;
class set_var_base;
class sys_var;
+class Item_func_match;
+class Alter_drop;
+class Alter_column;
+class Key;
+class File_parser;
+class Key_part_spec;
/**
used by the parser to store internal variable name
@@ -55,6 +66,7 @@ struct sys_var_with_base
#else
#if MYSQL_LEX
#include "lex_symbol.h"
+#include "item_func.h" /* Cast_target used in sql_yacc.h */
#include "sql_yacc.h"
#define LEX_YYSTYPE YYSTYPE *
#else
@@ -119,6 +131,12 @@ enum enum_drop_mode
DROP_RESTRICT // RESTRICT option
};
+/* Options to add_table_to_list() */
+#define TL_OPTION_UPDATING 1
+#define TL_OPTION_FORCE_INDEX 2
+#define TL_OPTION_IGNORE_LEAVES 4
+#define TL_OPTION_ALIAS 8
+
typedef List<Item> List_item;
/* SERVERS CACHE CHANGES */
@@ -188,7 +206,6 @@ typedef uchar index_clause_map;
#define INDEX_HINT_MASK_JOIN (1)
#define INDEX_HINT_MASK_GROUP (1 << 1)
#define INDEX_HINT_MASK_ORDER (1 << 2)
-
#define INDEX_HINT_MASK_ALL (INDEX_HINT_MASK_JOIN | INDEX_HINT_MASK_GROUP | \
INDEX_HINT_MASK_ORDER)
@@ -2164,6 +2181,7 @@ extern bool is_lex_native_function(const
*/
void my_missing_function_error(const LEX_STRING &token, const char *name);
+bool is_keyword(const char *name, uint len);
#endif /* MYSQL_SERVER */
#endif /* SQL_LEX_INCLUDED */
=== modified file 'sql/sql_list.cc'
--- a/sql/sql_list.cc 2009-10-23 06:47:02 +0000
+++ b/sql/sql_list.cc 2010-04-08 10:50:40 +0000
@@ -18,6 +18,7 @@
#pragma implementation // gcc: Class implementation
#endif
+#include "unireg.h"
#include "sql_list.h"
list_node end_of_list;
=== modified file 'sql/sql_list.h'
--- a/sql/sql_list.h 2010-02-17 21:07:50 +0000
+++ b/sql/sql_list.h 2010-04-08 10:50:40 +0000
@@ -26,6 +26,11 @@
void *sql_alloc(size_t);
+#include "my_sys.h" /* alloc_root, TRASH, MY_WME,
+ MY_FAE, MY_ALLOW_ZERO_PTR */
+#include "m_string.h" /* bfill */
+#include "thr_malloc.h" /* sql_alloc */
+
/* mysql standard class memory allocator */
class Sql_alloc
@@ -61,6 +66,57 @@ public:
};
+/**
+ Struct to handle simple linked lists.
+
+ @todo What is the relation between this class and list_node, below?
+ /Matz
+
+ @see list_node, base_list, List
+
+*/
+typedef struct st_sql_list {
+ uint elements;
+ uchar *first;
+ uchar **next;
+
+ st_sql_list() {} /* Remove gcc warning */
+ inline void empty()
+ {
+ elements=0;
+ first=0;
+ next= &first;
+ }
+ inline void link_in_list(uchar *element,uchar **next_ptr)
+ {
+ elements++;
+ (*next)=element;
+ next= next_ptr;
+ *next=0;
+ }
+ inline void save_and_clear(struct st_sql_list *save)
+ {
+ *save= *this;
+ empty();
+ }
+ inline void push_front(struct st_sql_list *save)
+ {
+ *save->next= first; /* link current list last */
+ first= save->first;
+ elements+= save->elements;
+ }
+ inline void push_back(struct st_sql_list *save)
+ {
+ if (save->first)
+ {
+ *next= save->first;
+ next= save->next;
+ elements+= save->elements;
+ }
+ }
+} SQL_LIST;
+
+
/*
Basic single linked list
Used for item and item_buffs.
@@ -638,4 +694,7 @@ list_copy_and_replace_each_value(List<T>
it.replace(el->clone(mem_root));
}
+void free_list(I_List <i_string_pair> *list);
+void free_list(I_List <i_string> *list);
+
#endif // INCLUDES_MYSQL_SQL_LIST_H
=== modified file 'sql/sql_load.cc'
--- a/sql/sql_load.cc 2010-03-25 07:20:34 +0000
+++ b/sql/sql_load.cc 2010-04-09 08:22:10 +0000
@@ -17,8 +17,22 @@
/* Copy data from a textfile to table */
/* 2006-12 Erik Wetterberg : LOAD XML added */
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h"
+#include "sql_load.h"
+#include "sql_load.h"
+#include "sql_cache.h" // query_cache_*
+#include "sql_base.h" // fill_record_n_invoke_before_triggers
#include <my_dir.h>
+#include "sql_view.h" // check_key_in_view
+#include "sql_insert.h" // check_that_all_fields_are_given_values,
+ // prepare_triggers_for_insert_stmt,
+ // write_record
+#include "sql_acl.h" // INSERT_ACL, UPDATE_ACL
+#include "log_event.h" // Delete_file_log_event,
+ // Execute_load_query_log_event,
+ // LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
#include <m_ctype.h>
#include "rpl_mi.h"
#include "sql_repl.h"
=== added file 'sql/sql_load.h'
--- a/sql/sql_load.h 1970-01-01 00:00:00 +0000
+++ b/sql/sql_load.h 2010-03-31 14:05:33 +0000
@@ -0,0 +1,34 @@
+/* Copyright 2006-2008 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef SQL_LOAD_INCLUDED
+#define SQL_LOAD_INCLUDED
+
+#include "sql_list.h" /* List */
+
+class Item;
+
+#include "sql_class.h" /* enum_duplicates */
+
+class sql_exchange;
+
+int mysql_load(THD *thd, sql_exchange *ex, TABLE_LIST *table_list,
+ List<Item> &fields_vars, List<Item> &set_fields,
+ List<Item> &set_values_list,
+ enum enum_duplicates handle_duplicates, bool ignore,
+ bool local_file);
+
+
+#endif /* SQL_LOAD_INCLUDED */
=== modified file 'sql/sql_locale.cc'
--- a/sql/sql_locale.cc 2009-11-09 10:27:46 +0000
+++ b/sql/sql_locale.cc 2010-04-09 08:22:10 +0000
@@ -20,7 +20,12 @@
!! This file is built from my_locale.pl !!
*/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h"
+#include "sql_locale.h"
+#include "sql_class.h" // THD
+#include "my_sys.h" // MY_*, NullS, NULL
enum err_msgs_index
=== added file 'sql/sql_locale.h'
--- a/sql/sql_locale.h 1970-01-01 00:00:00 +0000
+++ b/sql/sql_locale.h 2010-03-31 14:05:33 +0000
@@ -0,0 +1,78 @@
+/* Copyright 2006-2008 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef SQL_LOCALE_INCLUDED
+#define SQL_LOCALE_INCLUDED
+
+typedef struct my_locale_errmsgs
+{
+ const char *language;
+ const char **errmsgs;
+} MY_LOCALE_ERRMSGS;
+
+#include "my_global.h" /* uint */
+
+typedef struct st_typelib TYPELIB;
+
+class MY_LOCALE
+{
+public:
+ uint number;
+ const char *name;
+ const char *description;
+ const bool is_ascii;
+ TYPELIB *month_names;
+ TYPELIB *ab_month_names;
+ TYPELIB *day_names;
+ TYPELIB *ab_day_names;
+ uint max_month_name_length;
+ uint max_day_name_length;
+ uint decimal_point;
+ uint thousand_sep;
+ const char *grouping;
+ MY_LOCALE_ERRMSGS *errmsgs;
+ MY_LOCALE(uint number_par,
+ const char *name_par, const char *descr_par, bool is_ascii_par,
+ TYPELIB *month_names_par, TYPELIB *ab_month_names_par,
+ TYPELIB *day_names_par, TYPELIB *ab_day_names_par,
+ uint max_month_name_length_par, uint max_day_name_length_par,
+ uint decimal_point_par, uint thousand_sep_par,
+ const char *grouping_par, MY_LOCALE_ERRMSGS *errmsgs_par) :
+ number(number_par),
+ name(name_par), description(descr_par), is_ascii(is_ascii_par),
+ month_names(month_names_par), ab_month_names(ab_month_names_par),
+ day_names(day_names_par), ab_day_names(ab_day_names_par),
+ max_month_name_length(max_month_name_length_par),
+ max_day_name_length(max_day_name_length_par),
+ decimal_point(decimal_point_par),
+ thousand_sep(thousand_sep_par),
+ grouping(grouping_par),
+ errmsgs(errmsgs_par)
+ {}
+};
+/* Exported variables */
+
+extern MY_LOCALE my_locale_en_US;
+extern MY_LOCALE *my_locales[];
+extern MY_LOCALE *my_default_lc_messages;
+extern MY_LOCALE *my_default_lc_time_names;
+
+/* Exported functions */
+
+MY_LOCALE *my_locale_by_name(const char *name);
+MY_LOCALE *my_locale_by_number(uint number);
+void cleanup_errmsgs(void);
+
+#endif /* SQL_LOCALE_INCLUDED */
=== modified file 'sql/sql_manager.cc'
--- a/sql/sql_manager.cc 2010-01-07 05:48:46 +0000
+++ b/sql/sql_manager.cc 2010-04-09 08:22:10 +0000
@@ -21,8 +21,11 @@
* o Berkeley DB: removing unneeded log files.
*/
-#include "mysql_priv.h"
-
+#include "my_global.h"
+#include "sql_priv.h"
+#include "sql_manager.h"
+#include "unireg.h" // REQUIRED: for other includes
+#include "sql_base.h" // flush_tables
static bool volatile manager_thread_in_use;
static bool abort_manager;
=== added file 'sql/sql_manager.h'
--- a/sql/sql_manager.h 1970-01-01 00:00:00 +0000
+++ b/sql/sql_manager.h 2010-03-31 14:05:33 +0000
@@ -0,0 +1,23 @@
+/* Copyright 2006-2008 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef SQL_MANAGER_INCLUDED
+#define SQL_MANAGER_INCLUDED
+
+void start_handle_manager();
+void stop_handle_manager();
+bool mysql_manager_submit(void (*action)());
+
+#endif /* SQL_MANAGER_INCLUDED */
=== modified file 'sql/sql_map.cc'
--- a/sql/sql_map.cc 2010-01-07 05:48:46 +0000
+++ b/sql/sql_map.cc 2010-04-09 08:22:10 +0000
@@ -18,7 +18,12 @@
#pragma implementation // gcc: Class implementation
#endif
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h" // REQUIRED: for other includes
+#include "sql_map.h" // mapped_files
+#include "sql_class.h" // THD
+
#include <sys/stat.h>
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
=== modified file 'sql/sql_map.h'
--- a/sql/sql_map.h 2009-10-26 14:02:26 +0000
+++ b/sql/sql_map.h 2010-04-08 10:50:40 +0000
@@ -23,6 +23,9 @@
#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);
=== modified file 'sql/sql_olap.cc'
--- a/sql/sql_olap.cc 2007-05-10 09:59:39 +0000
+++ b/sql/sql_olap.cc 2010-04-09 08:22:10 +0000
@@ -31,7 +31,9 @@
#pragma implementation // gcc: Class implementation
#endif
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h"
#include "sql_select.h"
=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc 2010-03-23 09:14:15 +0000
+++ b/sql/sql_parse.cc 2010-04-10 09:11:47 +0000
@@ -14,7 +14,68 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#define MYSQL_LEX 1
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h" // REQUIRED: for other includes
+#include "sql_parse.h" // sql_kill, *_precheck, *_prepare
+#include "lock.h" // wait_if_global_read_lock,
+ // unlock_global_read_lock,
+ // try_transactional_lock,
+ // check_transactional_lock,
+ // set_handler_table_locks,
+ // start_waiting_global_read_lock,
+ // lock_global_read_lock,
+ // make_global_read_lock_block_commit
+#include "sql_base.h" // find_temporary_tablesx
+#include "sql_cache.h" // QUERY_CACHE_FLAGS_SIZE, query_cache_*
+#include "sql_show.h" // mysqld_list_*, mysqld_show_*,
+ // calc_sum_of_all_status
+#include "mysqld.h"
+#include "sql_locale.h" // my_locale_en_US
+#include "log.h" // flush_error_log
+#include "sql_view.h" // mysql_create_view, mysql_drop_view
+#include "sql_delete.h" // mysql_truncate, mysql_delete
+#include "sql_insert.h" // mysql_insert
+#include "sql_update.h" // mysql_update, mysql_multi_update
+#include "sql_partition.h" // struct partition_info
+#include "sql_db.h" // mysql_change_db, mysql_create_db,
+ // mysql_rm_db, mysql_upgrade_db,
+ // mysql_alter_db,
+ // check_db_dir_existence,
+ // my_dbopt_cleanup
+#include "sql_table.h" // mysql_create_like_table,
+ // mysql_create_table,
+ // mysql_alter_table,
+ // mysql_recreate_table,
+ // mysql_backup_table,
+ // mysql_restore_table
+#include "sql_connect.h" // check_user,
+ // decrease_user_connections,
+ // thd_init_client_charset, check_mqh,
+ // reset_mqh
+#include "sql_rename.h" // mysql_rename_table
+#include "sql_tablespace.h" // mysql_alter_tablespace
+#include "hostname.h" // hostname_cache_refresh
+#include "sql_acl.h" // *_ACL, check_grant, is_acl_user,
+ // has_any_table_level_privileges,
+ // mysql_drop_user, mysql_rename_user,
+ // check_grant_routine,
+ // mysql_routine_grant,
+ // mysql_show_grants,
+ // sp_grant_privileges, ...
+#include "sql_test.h" // mysql_print_status
+#include "sql_select.h" // handle_select, mysql_select,
+ // mysql_explain_union
+#include "sql_load.h" // mysql_load
+#include "sql_servers.h" // create_servers, alter_servers,
+ // drop_servers, servers_reload
+#include "sql_handler.h" // mysql_ha_open, mysql_ha_close,
+ // mysql_ha_read
+#include "sql_binlog.h" // mysql_client_binlog_statement
+#include "sql_do.h" // mysql_do
+#include "sql_help.h" // mysqld_help
+#include "rpl_constants.h" // Incident, INCIDENT_LOST_EVENTS
+#include "log_event.h"
#include "sql_repl.h"
#include "rpl_filter.h"
#include "repl_failsafe.h"
@@ -40,6 +101,8 @@
#endif
#include "probes_mysql.h"
+#define FLAGSTR(V,F) ((V)&(F)?#F" ":"")
+
/**
@defgroup Runtime_Environment Runtime Environment
@{
@@ -3128,15 +3191,21 @@ end_with_restore_list:
level.
NOTE: SHOW_VIEW ACL is checked when the view is created.
*/
+
+ DBUG_PRINT("debug", ("lex->only_view: %d, table: %s.%s",
+ lex->only_view,
+ first_table->db, first_table->table_name));
if (lex->only_view)
{
if (check_table_access(thd, SELECT_ACL, first_table, FALSE, FALSE,1))
{
+ DBUG_PRINT("debug", ("check_table_access failed"));
my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0),
"SHOW", thd->security_ctx->priv_user,
thd->security_ctx->host_or_ip, first_table->alias);
goto error;
}
+ DBUG_PRINT("debug", ("check_table_access succeeded"));
/* Ignore temporary tables if this is "SHOW CREATE VIEW" */
first_table->open_type= OT_BASE_ONLY;
@@ -3149,6 +3218,8 @@ end_with_restore_list:
access is granted. We need to check if first_table->grant.privilege
contains any table-specific privilege.
*/
+ DBUG_PRINT("debug", ("first_table->grant.privilege: %x",
+ first_table->grant.privilege));
if (check_some_access(thd, SHOW_CREATE_TABLE_ACLS, first_table) ||
(first_table->grant.privilege & SHOW_CREATE_TABLE_ACLS) == 0)
{
=== added file 'sql/sql_parse.h'
--- a/sql/sql_parse.h 1970-01-01 00:00:00 +0000
+++ b/sql/sql_parse.h 2010-04-12 13:18:53 +0000
@@ -0,0 +1,207 @@
+/* Copyright 2006-2008 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef SQL_PARSE_INCLUDED
+#define SQL_PARSE_INCLUDED
+
+#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
+#include "sql_acl.h" /* GLOBAL_ACLS */
+
+class Comp_creator;
+class Item;
+class Object_creation_ctx;
+class Parser_state;
+struct TABLE_LIST;
+class THD;
+class Table_ident;
+struct LEX;
+
+enum enum_mysql_completiontype {
+ ROLLBACK_RELEASE=-2, ROLLBACK=1, ROLLBACK_AND_CHAIN=7,
+ COMMIT_RELEASE=-1, COMMIT=0, COMMIT_AND_CHAIN=6
+};
+
+extern "C" int test_if_data_home_dir(const char *dir);
+
+bool multi_update_precheck(THD *thd, TABLE_LIST *tables);
+bool multi_delete_precheck(THD *thd, TABLE_LIST *tables);
+int mysql_multi_update_prepare(THD *thd);
+int mysql_multi_delete_prepare(THD *thd);
+bool mysql_insert_select_prepare(THD *thd);
+bool update_precheck(THD *thd, TABLE_LIST *tables);
+bool delete_precheck(THD *thd, TABLE_LIST *tables);
+bool insert_precheck(THD *thd, TABLE_LIST *tables);
+bool create_table_precheck(THD *thd, TABLE_LIST *tables,
+ TABLE_LIST *create_table);
+
+bool parse_sql(THD *thd,
+ Parser_state *parser_state,
+ Object_creation_ctx *creation_ctx);
+
+uint kill_one_thread(THD *thd, ulong id, bool only_kill_query);
+void sql_kill(THD *thd, ulong id, bool only_kill_query);
+
+void free_items(Item *item);
+void cleanup_items(Item *item);
+
+Comp_creator *comp_eq_creator(bool invert);
+Comp_creator *comp_ge_creator(bool invert);
+Comp_creator *comp_gt_creator(bool invert);
+Comp_creator *comp_le_creator(bool invert);
+Comp_creator *comp_lt_creator(bool invert);
+Comp_creator *comp_ne_creator(bool invert);
+
+int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident,
+ enum enum_schema_tables schema_table_idx);
+void get_default_definer(THD *thd, LEX_USER *definer);
+LEX_USER *create_default_definer(THD *thd);
+LEX_USER *create_definer(THD *thd, LEX_STRING *user_name, LEX_STRING *host_name);
+LEX_USER *get_current_user(THD *thd, LEX_USER *user);
+bool check_string_byte_length(LEX_STRING *str, const char *err_msg,
+ uint max_byte_length);
+bool check_string_char_length(LEX_STRING *str, const char *err_msg,
+ uint max_char_length, CHARSET_INFO *cs,
+ bool no_error);
+CHARSET_INFO* merge_charset_and_collation(CHARSET_INFO *cs, CHARSET_INFO *cl);
+bool check_host_name(LEX_STRING *str);
+bool check_identifier_name(LEX_STRING *str, uint max_char_length,
+ uint err_code, const char *param_for_err_msg);
+bool mysql_test_parse_for_slave(THD *thd,char *inBuf,uint length);
+bool is_update_query(enum enum_sql_command command);
+bool is_log_table_write_query(enum enum_sql_command command);
+bool alloc_query(THD *thd, const char *packet, uint packet_length);
+void mysql_init_select(LEX *lex);
+void mysql_parse(THD *thd, const char *inBuf, uint length,
+ const char ** semicolon);
+void mysql_reset_thd_for_next_command(THD *thd);
+bool mysql_new_select(LEX *lex, bool move_down);
+void create_select_for_variable(const char *var_name);
+void create_table_set_open_action_and_adjust_tables(LEX *lex);
+void mysql_init_multi_delete(LEX *lex);
+bool multi_delete_set_locks_and_link_aux_tables(LEX *lex);
+void create_table_set_open_action_and_adjust_tables(LEX *lex);
+pthread_handler_t handle_bootstrap(void *arg);
+bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
+ bool *write_to_binlog);
+int mysql_execute_command(THD *thd);
+bool do_command(THD *thd);
+void do_handle_bootstrap(THD *thd);
+bool dispatch_command(enum enum_server_command command, THD *thd,
+ char* packet, uint packet_length);
+void log_slow_statement(THD *thd);
+bool append_file_to_dir(THD *thd, const char **filename_ptr,
+ const char *table_name);
+bool append_file_to_dir(THD *thd, const char **filename_ptr,
+ const char *table_name);
+void execute_init_command(THD *thd, LEX_STRING *init_command,
+ mysql_rwlock_t *var_lock);
+bool add_field_to_list(THD *thd, LEX_STRING *field_name, enum_field_types type,
+ char *length, char *decimals,
+ uint type_modifier,
+ enum ha_storage_media storage_type,
+ enum column_format_type column_format,
+ Item *default_value, Item *on_update_value,
+ LEX_STRING *comment,
+ char *change,
+ List<String> *interval_list, CHARSET_INFO *cs,
+ uint uint_geom_type);
+bool add_to_list(THD *thd, SQL_LIST &list,Item *group,bool asc);
+void add_join_on(TABLE_LIST *b,Item *expr);
+void add_join_natural(TABLE_LIST *a,TABLE_LIST *b,List<String> *using_fields,
+ SELECT_LEX *lex);
+bool add_proc_to_list(THD *thd, Item *item);
+bool push_new_name_resolution_context(THD *thd,
+ TABLE_LIST *left_op,
+ TABLE_LIST *right_op);
+void store_position_for_column(const char *name);
+void init_update_queries(void);
+bool check_simple_select();
+Item *negate_expression(THD *thd, Item *expr);
+bool check_stack_overrun(THD *thd, long margin, uchar *dummy);
+
+bool begin_trans(THD *thd);
+bool end_active_trans(THD *thd);
+int end_trans(THD *thd, enum enum_mysql_completiontype completion);
+
+
+/* Variables */
+
+extern const char* any_db;
+extern uint sql_command_flags[];
+extern uint server_command_flags[];
+extern const LEX_STRING command_name[];
+extern uint server_command_flags[];
+
+/* Inline functions */
+inline bool check_identifier_name(LEX_STRING *str, uint err_code)
+{
+ return check_identifier_name(str, NAME_CHAR_LEN, err_code, "");
+}
+
+inline bool check_identifier_name(LEX_STRING *str)
+{
+ return check_identifier_name(str, NAME_CHAR_LEN, 0, "");
+}
+
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+bool check_one_table_access(THD *thd, ulong privilege, TABLE_LIST *tables);
+bool check_single_table_access(THD *thd, ulong privilege,
+ TABLE_LIST *tables, bool no_errors);
+bool check_routine_access(THD *thd,ulong want_access,char *db,char *name,
+ bool is_proc, bool no_errors);
+bool check_some_access(THD *thd, ulong want_access, TABLE_LIST *table);
+bool check_some_routine_access(THD *thd, const char *db, const char *name, bool is_proc);
+bool check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
+ GRANT_INTERNAL_INFO *grant_internal_info,
+ bool dont_check_global_grants, bool no_errors);
+bool check_table_access(THD *thd, ulong requirements,TABLE_LIST *tables,
+ bool no_errors, bool any_combination_of_privileges_will_do,
+ uint number);
+#else
+inline bool check_one_table_access(THD *thd, ulong privilege, TABLE_LIST *tables)
+{ return false; }
+inline bool check_single_table_access(THD *thd, ulong privilege,
+ TABLE_LIST *tables, bool no_errors)
+{ return false; }
+inline bool check_routine_access(THD *thd,ulong want_access,char *db,
+ char *name, bool is_proc, bool no_errors)
+{ return false; }
+inline bool check_some_access(THD *thd, ulong want_access, TABLE_LIST *table)
+{ return false; }
+inline bool check_merge_table_access(THD *thd, char *db, TABLE_LIST *table_list)
+{ return false; }
+inline bool check_some_routine_access(THD *thd, const char *db,
+ const char *name, bool is_proc)
+{ return false; }
+inline bool check_access(THD *thd, ulong access, const char *db,
+ ulong *save_priv, bool no_grant, bool no_errors,
+ bool schema_db)
+{
+ if (save_priv)
+ *save_priv= GLOBAL_ACLS;
+ return false;
+}
+inline bool
+check_table_access(THD *thd, ulong requirements,TABLE_LIST *tables,
+ bool no_errors, bool any_combination_of_privileges_will_do,
+ uint number)
+{ return false; }
+#endif /*NO_EMBEDDED_ACCESS_CHECKS*/
+
+/* These were under the INNODB_COMPATIBILITY_HOOKS */
+
+bool check_global_access(THD *thd, ulong want_access);
+
+#endif /* SQL_PARSE_INCLUDED */
=== modified file 'sql/sql_partition.cc'
--- a/sql/sql_partition.cc 2010-03-25 09:02:07 +0000
+++ b/sql/sql_partition.cc 2010-04-09 08:22:10 +0000
@@ -46,12 +46,27 @@
/* Some general useful functions */
#define MYSQL_LEX 1
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h" // REQUIRED: for other includes
+#include "sql_partition.h"
+#include "key.h" // key_restore
+#include "sql_parse.h" // parse_sql
+#include "sql_cache.h" // query_cache_invalidate3
+#include "lock.h" // mysql_lock_remove
+#include "sql_show.h" // append_identifier
#include <errno.h>
#include <m_ctype.h>
#include "my_md5.h"
#include "transaction.h"
+#include "sql_base.h" // close_thread_tables
+#include "sql_table.h" // build_table_filename,
+ // build_table_shadow_filename,
+ // table_to_filename
+#include "opt_range.h" // store_key_image_to_rec
+#include "sql_analyse.h" // append_escaped
+
#ifdef WITH_PARTITION_STORAGE_ENGINE
#include "ha_partition.h"
=== modified file 'sql/sql_partition.h'
--- a/sql/sql_partition.h 2010-03-23 09:14:15 +0000
+++ b/sql/sql_partition.h 2010-04-08 10:50:40 +0000
@@ -20,12 +20,51 @@
#pragma interface /* gcc class implementation */
#endif
+#include "sql_list.h" /* List */
+#include "table.h" /* TABLE_LIST */
+
+class Alter_info;
+class Field;
+class String;
+class handler;
+class partition_info;
+struct TABLE;
+struct TABLE_LIST;
+typedef struct st_bitmap MY_BITMAP;
+typedef struct st_ha_create_information HA_CREATE_INFO;
+typedef struct st_key KEY;
+typedef struct st_key_range key_range;
+
/* Flags for partition handlers */
#define HA_CAN_PARTITION (1 << 0) /* Partition support */
#define HA_CAN_UPDATE_PARTITION_KEY (1 << 1)
#define HA_CAN_PARTITION_UNIQUE (1 << 2)
#define HA_USE_AUTO_PARTITION (1 << 3)
+#define NORMAL_PART_NAME 0
+#define TEMP_PART_NAME 1
+#define RENAMED_PART_NAME 2
+
+typedef struct st_lock_param_type
+{
+ TABLE_LIST *table_list;
+ ulonglong copied;
+ ulonglong deleted;
+ THD *thd;
+ HA_CREATE_INFO *create_info;
+ Alter_info *alter_info;
+ TABLE *table;
+ KEY *key_info_buffer;
+ const char *db;
+ const char *table_name;
+ uchar *pack_frm_data;
+ uint key_count;
+ uint db_options;
+ size_t pack_frm_len;
+ partition_info *part_info;
+} ALTER_PARTITION_PARAM_TYPE;
+
+
/*typedef struct {
ulonglong data_file_length;
ulonglong max_data_file_length;
@@ -101,6 +140,7 @@ uint32 get_partition_id_range_for_endpoi
bool check_part_func_fields(Field **ptr, bool ok_with_charsets);
bool field_is_partition_charset(Field *field);
Item* convert_charset_partition_constant(Item *item, CHARSET_INFO *cs);
+void mem_alloc_error(size_t size);
/*
A "Get next" function for partition iterator.
@@ -220,4 +260,39 @@ typedef int (*get_partitions_in_range_it
#include "partition_info.h"
+#ifdef WITH_PARTITION_STORAGE_ENGINE
+uint fast_alter_partition_table(THD *thd, TABLE *table,
+ Alter_info *alter_info,
+ HA_CREATE_INFO *create_info,
+ TABLE_LIST *table_list,
+ char *db,
+ const char *table_name,
+ uint fast_alter_partition);
+uint set_part_state(Alter_info *alter_info, partition_info *tab_part_info,
+ enum partition_state part_state);
+uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info,
+ HA_CREATE_INFO *create_info,
+ handlerton *old_db_type,
+ bool *partition_changed,
+ uint *fast_alter_partition);
+char *generate_partition_syntax(partition_info *part_info,
+ uint *buf_length, bool use_sql_alloc,
+ bool show_partition_options,
+ HA_CREATE_INFO *create_info,
+ Alter_info *alter_info);
+#endif
+
+void create_partition_name(char *out, const char *in1,
+ const char *in2, uint name_variant,
+ bool translate);
+void create_subpartition_name(char *out, const char *in1,
+ const char *in2, const char *in3,
+ uint name_variant);
+
+void set_field_ptr(Field **ptr, const uchar *new_buf, const uchar *old_buf);
+void set_key_field_ptr(KEY *key_info, const uchar *new_buf,
+ const uchar *old_buf);
+
+extern const LEX_STRING partition_keywords[];
+
#endif /* SQL_PARTITION_INCLUDED */
=== modified file 'sql/sql_plugin.cc'
--- a/sql/sql_plugin.cc 2010-03-25 09:02:07 +0000
+++ b/sql/sql_plugin.cc 2010-04-09 08:22:10 +0000
@@ -13,10 +13,24 @@
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" // REQUIRED by m_string.h
+#include "sql_priv.h" // SHOW_MY_BOOL
+#include "unireg.h"
+#include "sql_class.h" // set_var.h: THD
#include "sys_vars_shared.h"
+#include "sql_locale.h"
+#include "sql_plugin.h"
+#include "sql_parse.h" // check_table_access
+#include "sql_base.h" // close_thread_tables
+#include "key.h" // key_copy
+#include "sql_show.h" // remove_status_vars, add_status_vars
+#include "strfunc.h" // find_set
+#include "sql_acl.h" // *_ACL
+#include "records.h" // init_read_record, end_read_record
#include <my_pthread.h>
#include <my_getopt.h>
#include <mysql/plugin_audit.h>
+#include "lock.h" // MYSQL_LOCK_IGNORE_TIMEOUT
#define REPORT_TO_LOG 1
#define REPORT_TO_USER 2
=== modified file 'sql/sql_plugin.h'
--- a/sql/sql_plugin.h 2010-01-07 05:48:46 +0000
+++ b/sql/sql_plugin.h 2010-04-08 10:50:40 +0000
@@ -16,6 +16,22 @@
#ifndef _sql_plugin_h
#define _sql_plugin_h
+/*
+ the following #define adds server-only members to enum_mysql_show_type,
+ that is defined in plugin.h
+*/
+#define SHOW_always_last SHOW_KEY_CACHE_LONG, \
+ SHOW_KEY_CACHE_LONGLONG, SHOW_LONG_STATUS, SHOW_DOUBLE_STATUS, \
+ SHOW_HAVE, SHOW_MY_BOOL, SHOW_HA_ROWS, SHOW_SYS, \
+ SHOW_LONG_NOFLUSH, SHOW_LONGLONG_STATUS, SHOW_LEX_STRING
+#include <mysql/plugin.h>
+#undef SHOW_always_last
+
+#include "m_string.h" /* LEX_STRING */
+#include "my_alloc.h" /* MEM_ROOT */
+
+#include "my_sys.h" /* CALLER_INFO_PROTO */
+
class sys_var;
enum SHOW_COMP_OPTION { SHOW_OPTION_YES, SHOW_OPTION_NO, SHOW_OPTION_DISABLED};
=== modified file 'sql/sql_prepare.cc'
--- a/sql/sql_prepare.cc 2010-03-11 14:15:40 +0000
+++ b/sql/sql_prepare.cc 2010-04-10 09:11:47 +0000
@@ -83,10 +83,24 @@ When one supplies long data for a placeh
at statement execute.
*/
-#include "mysql_priv.h"
+#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
+#include "sql_priv.h"
+#include "unireg.h"
+#include "sql_class.h" // set_var.h: THD
#include "set_var.h"
#include "sql_prepare.h"
+#include "sql_parse.h" // insert_precheck, update_precheck, delete_precheck
+#include "sql_base.h" // close_thread_tables
+#include "sql_cache.h" // query_cache_*
+#include "sql_view.h" // create_view_precheck
+#include "sql_delete.h" // mysql_prepare_delete
#include "sql_select.h" // for JOIN
+#include "sql_insert.h" // upgrade_lock_type_for_insert, mysql_prepare_insert
+#include "sql_update.h" // mysql_prepare_update
+#include "sql_db.h" // mysql_opt_change_db, mysql_change_db
+#include "sql_acl.h" // *_ACL
+#include "sql_derived.h" // mysql_derived_prepare,
+ // mysql_handle_derived
#include "sql_cursor.h"
#include "sp_head.h"
#include "sp.h"
@@ -98,6 +112,7 @@ When one supplies long data for a placeh
#else
#include <mysql_com.h>
#endif
+#include "lock.h" // MYSQL_OPEN_FORCE_SHARED_MDL
/**
A result class used to send cursor rows using the binary protocol.
=== renamed file 'sql/mysql_priv.h' => 'sql/sql_priv.h'
--- a/sql/mysql_priv.h 2010-03-25 09:02:07 +0000
+++ b/sql/sql_priv.h 2010-04-09 08:22:10 +0000
@@ -29,154 +29,8 @@
#ifndef MYSQL_CLIENT
/*
- the following #define adds server-only members to enum_mysql_show_type,
- that is defined in mysql/plugin.h
- it has to be before mysql/plugin.h is included.
-*/
-#define SHOW_always_last SHOW_KEY_CACHE_LONG, \
- SHOW_KEY_CACHE_LONGLONG, SHOW_LONG_STATUS, SHOW_DOUBLE_STATUS, \
- SHOW_HAVE, SHOW_MY_BOOL, SHOW_HA_ROWS, SHOW_SYS, \
- SHOW_LONG_NOFLUSH, SHOW_LONGLONG_STATUS, SHOW_LEX_STRING
-
-#include <my_global.h>
-#include <mysql_version.h>
-#include <mysql_embed.h>
-#include <my_sys.h>
-#include <my_time.h>
-#include <m_string.h>
-#include <hash.h>
-#include <signal.h>
-#include <thr_lock.h>
-#include <my_base.h> /* Needed by field.h */
-#include <queues.h>
-#include "sql_bitmap.h"
-#include "sql_array.h"
-#include "sql_plugin.h"
-#include "scheduler.h"
-#include <my_atomic.h>
-#include "probes_mysql.h"
-#include <mysql/psi/mysql_file.h>
-
-#ifndef __WIN__
-#include <netdb.h>
-#endif
-
-class Parser_state;
-
-/**
- Query type constants.
-
- QT_ORDINARY -- ordinary SQL query.
- QT_IS -- SQL query to be shown in INFORMATION_SCHEMA (in utf8 and without
- character set introducers).
-*/
-enum enum_query_type
-{
- QT_ORDINARY,
- QT_IS
-};
-
-/* TODO convert all these three maps to Bitmap classes */
-typedef ulonglong table_map; /* Used for table bits in join */
-#if MAX_INDEXES <= 64
-typedef Bitmap<64> key_map; /* Used for finding keys */
-#else
-typedef Bitmap<((MAX_INDEXES+7)/8*8)> key_map; /* Used for finding keys */
-#endif
-typedef ulong nesting_map; /* Used for flags of nesting constructs */
-/*
- Used to identify NESTED_JOIN structures within a join (applicable only to
- structures that have not been simplified away and embed more the one
- element)
-*/
-typedef ulonglong nested_join_map;
-
-/* query_id */
-typedef int64 query_id_t;
-extern query_id_t global_query_id;
-extern int32 thread_running;
-extern my_atomic_rwlock_t global_query_id_lock;
-extern my_atomic_rwlock_t thread_running_lock;
-
-/* increment query_id and return it. */
-inline query_id_t next_query_id()
-{
- query_id_t id;
- my_atomic_rwlock_wrlock(&global_query_id_lock);
- id= my_atomic_add64(&global_query_id, 1);
- my_atomic_rwlock_wrunlock(&global_query_id_lock);
- return (id+1);
-}
-
-inline query_id_t get_query_id()
-{
- query_id_t id;
- my_atomic_rwlock_wrlock(&global_query_id_lock);
- id= my_atomic_load64(&global_query_id);
- my_atomic_rwlock_wrunlock(&global_query_id_lock);
- return id;
-}
-
-inline int32
-inc_thread_running()
-{
- int32 num_thread_running;
- my_atomic_rwlock_wrlock(&thread_running_lock);
- num_thread_running= my_atomic_add32(&thread_running, 1);
- my_atomic_rwlock_wrunlock(&thread_running_lock);
- return (num_thread_running+1);
-}
-
-inline int32
-dec_thread_running()
-{
- int32 num_thread_running;
- my_atomic_rwlock_wrlock(&thread_running_lock);
- num_thread_running= my_atomic_add32(&thread_running, -1);
- my_atomic_rwlock_wrunlock(&thread_running_lock);
- return (num_thread_running-1);
-}
-
-inline int32
-get_thread_running()
-{
- int32 num_thread_running;
- my_atomic_rwlock_wrlock(&thread_running_lock);
- num_thread_running= my_atomic_load32(&thread_running);
- my_atomic_rwlock_wrunlock(&thread_running_lock);
- return num_thread_running;
-}
-
-/* useful constants */
-extern MYSQL_PLUGIN_IMPORT const key_map key_map_empty;
-extern MYSQL_PLUGIN_IMPORT key_map key_map_full; /* Should be threaded as const */
-extern MYSQL_PLUGIN_IMPORT const char *primary_key_name;
-
-#include "mysql_com.h"
-#include <violite.h>
-#include "unireg.h"
-
-void init_sql_alloc(MEM_ROOT *root, uint block_size, uint pre_alloc_size);
-void *sql_alloc(size_t);
-void *sql_calloc(size_t);
-char *sql_strdup(const char *str);
-char *sql_strmake(const char *str, size_t len);
-void *sql_memdup(const void * ptr, size_t size);
-char *sql_strmake_with_convert(const char *str, size_t arg_length,
- CHARSET_INFO *from_cs,
- size_t max_res_length,
- CHARSET_INFO *to_cs, size_t *result_length);
-uint kill_one_thread(THD *thd, ulong id, bool only_kill_query);
-void sql_kill(THD *thd, ulong id, bool only_kill_query);
-bool net_request_file(NET* net, const char* fname);
-
-#define x_free(A) { my_free((uchar*) (A),MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR)); }
-#define safeFree(x) { if(x) { my_free((uchar*) x,MYF(0)); x = NULL; } }
-#define PREV_BITS(type,A) ((type) (((type) 1 << (A)) -1))
-
-/*
- Generates a warning that a feature is deprecated. After a specified version
- asserts that the feature is removed.
+ Generates a warning that a feature is deprecated. After a specified
+ version asserts that the feature is removed.
Using it as
@@ -205,326 +59,10 @@ bool net_request_file(NET* net, const ch
(Old), (New)); \
} while(0)
-extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *system_charset_info;
-extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *files_charset_info ;
-extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *national_charset_info;
-extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *table_alias_charset;
-
-/**
- Character set of the buildin error messages loaded from errmsg.sys.
-*/
-extern CHARSET_INFO *error_message_charset_info;
-
-enum Derivation
-{
- DERIVATION_IGNORABLE= 6,
- DERIVATION_NUMERIC= 5,
- DERIVATION_COERCIBLE= 4,
- DERIVATION_SYSCONST= 3,
- DERIVATION_IMPLICIT= 2,
- DERIVATION_NONE= 1,
- DERIVATION_EXPLICIT= 0
-};
-
-#define my_charset_numeric my_charset_latin1
-#define MY_REPERTOIRE_NUMERIC MY_REPERTOIRE_ASCII
-
-typedef struct my_locale_errmsgs
-{
- const char *language;
- const char **errmsgs;
-} MY_LOCALE_ERRMSGS;
-
extern char err_shared_dir[];
-/** @note Keep this a POD-type because we use offsetof() on it */
-typedef struct my_locale_st
-{
- uint number;
- const char *name;
- const char *description;
- const bool is_ascii;
- TYPELIB *month_names;
- TYPELIB *ab_month_names;
- TYPELIB *day_names;
- TYPELIB *ab_day_names;
- uint max_month_name_length;
- uint max_day_name_length;
- uint decimal_point;
- uint thousand_sep;
- const char *grouping;
- MY_LOCALE_ERRMSGS *errmsgs;
-#ifdef __cplusplus
- my_locale_st(uint number_par,
- const char *name_par, const char *descr_par, bool is_ascii_par,
- TYPELIB *month_names_par, TYPELIB *ab_month_names_par,
- TYPELIB *day_names_par, TYPELIB *ab_day_names_par,
- uint max_month_name_length_par, uint max_day_name_length_par,
- uint decimal_point_par, uint thousand_sep_par,
- const char *grouping_par, MY_LOCALE_ERRMSGS *errmsgs_par) :
- number(number_par),
- name(name_par), description(descr_par), is_ascii(is_ascii_par),
- month_names(month_names_par), ab_month_names(ab_month_names_par),
- day_names(day_names_par), ab_day_names(ab_day_names_par),
- max_month_name_length(max_month_name_length_par),
- max_day_name_length(max_day_name_length_par),
- decimal_point(decimal_point_par),
- thousand_sep(thousand_sep_par),
- grouping(grouping_par),
- errmsgs(errmsgs_par)
- {}
-#endif
-} MY_LOCALE;
-
-extern MY_LOCALE my_locale_en_US;
-extern MY_LOCALE *my_locales[];
-extern MY_LOCALE *my_default_lc_messages;
-extern MY_LOCALE *my_default_lc_time_names;
-
-MY_LOCALE *my_locale_by_name(const char *name);
-MY_LOCALE *my_locale_by_number(uint number);
-
-void cleanup_errmsgs(void);
-/*************************************************************************/
-
-/**
- Object_creation_ctx -- interface for creation context of database objects
- (views, stored routines, events, triggers). Creation context -- is a set
- of attributes, that should be fixed at the creation time and then be used
- each time the object is parsed or executed.
-*/
-
-class Object_creation_ctx
-{
-public:
- Object_creation_ctx *set_n_backup(THD *thd);
-
- void restore_env(THD *thd, Object_creation_ctx *backup_ctx);
-
-protected:
- Object_creation_ctx() {}
- virtual Object_creation_ctx *create_backup_ctx(THD *thd) const = 0;
-
- virtual void change_env(THD *thd) const = 0;
-
-public:
- virtual ~Object_creation_ctx()
- { }
-};
-
/*************************************************************************/
-/**
- Default_object_creation_ctx -- default implementation of
- Object_creation_ctx.
-*/
-
-class Default_object_creation_ctx : public Object_creation_ctx
-{
-public:
- CHARSET_INFO *get_client_cs()
- {
- return m_client_cs;
- }
-
- CHARSET_INFO *get_connection_cl()
- {
- return m_connection_cl;
- }
-
-protected:
- Default_object_creation_ctx(THD *thd);
-
- Default_object_creation_ctx(CHARSET_INFO *client_cs,
- CHARSET_INFO *connection_cl);
-
-protected:
- virtual Object_creation_ctx *create_backup_ctx(THD *thd) const;
-
- virtual void change_env(THD *thd) const;
-
-protected:
- /**
- client_cs stores the value of character_set_client session variable.
- The only character set attribute is used.
-
- Client character set is included into query context, because we save
- query in the original character set, which is client character set. So,
- in order to parse the query properly we have to switch client character
- set on parsing.
- */
- CHARSET_INFO *m_client_cs;
-
- /**
- connection_cl stores the value of collation_connection session
- variable. Both character set and collation attributes are used.
-
- Connection collation is included into query context, becase it defines
- the character set and collation of text literals in internal
- representation of query (item-objects).
- */
- CHARSET_INFO *m_connection_cl;
-};
-
-
-/**
- Opening modes for open_temporary_table and open_table_from_share
-*/
-
-enum open_table_mode
-{
- OTM_OPEN= 0,
- OTM_CREATE= 1,
- OTM_ALTER= 2
-};
-
-/***************************************************************************
- Configuration parameters
-****************************************************************************/
-
-#define ACL_CACHE_SIZE 256
-#define MAX_PASSWORD_LENGTH 32
-#define HOST_CACHE_SIZE 128
-#define MAX_ACCEPT_RETRY 10 // Test accept this many times
-#define MAX_FIELDS_BEFORE_HASH 32
-#define USER_VARS_HASH_SIZE 16
-#define TABLE_OPEN_CACHE_MIN 400
-#define TABLE_OPEN_CACHE_DEFAULT 400
-#define TABLE_DEF_CACHE_DEFAULT 400
-/**
- We must have room for at least 400 table definitions in the table
- cache, since otherwise there is no chance prepared
- statements that use these many tables can work.
- Prepared statements use table definition cache ids (table_map_id)
- as table version identifiers. If the table definition
- cache size is less than the number of tables used in a statement,
- the contents of the table definition cache is guaranteed to rotate
- between a prepare and execute. This leads to stable validation
- errors. In future we shall use more stable version identifiers,
- for now the only solution is to ensure that the table definition
- cache can contain at least all tables of a given statement.
-*/
-#define TABLE_DEF_CACHE_MIN 400
-
-/*
- Stack reservation.
- Feel free to raise this by the smallest amount you can to get the
- "execution_constants" test to pass.
-*/
-#define STACK_MIN_SIZE 16000 // Abort if less stack during eval.
-
-#define STACK_MIN_SIZE_FOR_OPEN 1024*80
-#define STACK_BUFF_ALLOC 352 ///< For stack overrun checks
-#ifndef MYSQLD_NET_RETRY_COUNT
-#define MYSQLD_NET_RETRY_COUNT 10 ///< Abort read after this many int.
-#endif
-
-#define QUERY_ALLOC_BLOCK_SIZE 8192
-#define QUERY_ALLOC_PREALLOC_SIZE 8192
-#define TRANS_ALLOC_BLOCK_SIZE 4096
-#define TRANS_ALLOC_PREALLOC_SIZE 4096
-#define RANGE_ALLOC_BLOCK_SIZE 4096
-#define ACL_ALLOC_BLOCK_SIZE 1024
-#define UDF_ALLOC_BLOCK_SIZE 1024
-#define TABLE_ALLOC_BLOCK_SIZE 1024
-#define WARN_ALLOC_BLOCK_SIZE 2048
-#define WARN_ALLOC_PREALLOC_SIZE 1024
-
-/*
- The following parameters is to decide when to use an extra cache to
- optimise seeks when reading a big table in sorted order
-*/
-#define MIN_FILE_LENGTH_TO_USE_ROW_CACHE (10L*1024*1024)
-#define MIN_ROWS_TO_USE_TABLE_CACHE 100
-#define MIN_ROWS_TO_USE_BULK_INSERT 100
-
-/**
- The following is used to decide if MySQL should use table scanning
- instead of reading with keys. The number says how many evaluation of the
- WHERE clause is comparable to reading one extra row from a table.
-*/
-#define TIME_FOR_COMPARE 5 // 5 compares == one read
-
-/**
- Number of comparisons of table rowids equivalent to reading one row from a
- table.
-*/
-#define TIME_FOR_COMPARE_ROWID (TIME_FOR_COMPARE*2)
-
-/*
- For sequential disk seeks the cost formula is:
- DISK_SEEK_BASE_COST + DISK_SEEK_PROP_COST * #blocks_to_skip
-
- The cost of average seek
- DISK_SEEK_BASE_COST + DISK_SEEK_PROP_COST*BLOCKS_IN_AVG_SEEK =1.0.
-*/
-#define DISK_SEEK_BASE_COST ((double)0.9)
-
-#define BLOCKS_IN_AVG_SEEK 128
-
-#define DISK_SEEK_PROP_COST ((double)0.1/BLOCKS_IN_AVG_SEEK)
-
-/**
- Number of rows in a reference table when refereed through a not unique key.
- This value is only used when we don't know anything about the key
- distribution.
-*/
-#define MATCHING_ROWS_IN_OTHER_TABLE 10
-
-/*
- Subquery materialization-related constants
-*/
-#define HEAP_TEMPTABLE_LOOKUP_COST 0.05
-#define DISK_TEMPTABLE_LOOKUP_COST 1.0
-
-/** Don't pack string keys shorter than this (if PACK_KEYS=1 isn't used). */
-#define KEY_DEFAULT_PACK_LENGTH 8
-
-/** Characters shown for the command in 'show processlist'. */
-#define PROCESS_LIST_WIDTH 100
-/* Characters shown for the command in 'information_schema.processlist' */
-#define PROCESS_LIST_INFO_WIDTH 65535
-
-#define PRECISION_FOR_DOUBLE 53
-#define PRECISION_FOR_FLOAT 24
-
-/* -[digits].E+## */
-#define MAX_FLOAT_STR_LENGTH (FLT_DIG + 6)
-/* -[digits].E+### */
-#define MAX_DOUBLE_STR_LENGTH (DBL_DIG + 7)
-
-/*
- Default time to wait before aborting a new client connection
- that does not respond to "initial server greeting" timely
-*/
-#define CONNECT_TIMEOUT 10
-
-/* The following can also be changed from the command line */
-#define DEFAULT_CONCURRENCY 10
-#define DELAYED_LIMIT 100 /**< pause after xxx inserts */
-#define DELAYED_QUEUE_SIZE 1000
-#define DELAYED_WAIT_TIMEOUT 5*60 /**< Wait for delayed insert */
-#define FLUSH_TIME 0 /**< Don't flush tables */
-#define MAX_CONNECT_ERRORS 10 ///< errors before disabling host
-
-#if defined(__WIN__)
-#undef FLUSH_TIME
-#define FLUSH_TIME 1800 /**< Flush every half hour */
-#endif /* __WIN__ */
-
- /* Bits from testflag */
-#define TEST_PRINT_CACHED_TABLES 1
-#define TEST_NO_KEY_GROUP 2
-#define TEST_MIT_THREAD 4
-#define TEST_BLOCKING 8
-#define TEST_KEEP_TMP_TABLES 16
-#define TEST_READCHECK 64 /**< Force use of readcheck */
-#define TEST_NO_EXTRA 128
-#define TEST_CORE_ON_SIGNAL 256 /**< Give core if signal */
-#define TEST_NO_STACKTRACE 512
-#define TEST_SIGINT 1024 /**< Allow sigint on threads */
-#define TEST_SYNCHRONIZATION 2048 /**< get server to do sleep in
- some places */
#endif
/*
@@ -598,49 +136,9 @@ enum open_table_mode
*/
#define OPTION_ALLOW_BATCH (1ULL << 34) // THD, intern (slave)
-/**
- Maximum length of time zone name that we support
- (Time zone name is char(64) in db). mysqlbinlog needs it.
-*/
-#define MAX_TIME_ZONE_NAME_LENGTH (NAME_LEN + 1)
-
/* The rest of the file is included in the server only */
#ifndef MYSQL_CLIENT
-/* Bits for different SQL modes modes (including ANSI mode) */
-#define MODE_REAL_AS_FLOAT 1
-#define MODE_PIPES_AS_CONCAT 2
-#define MODE_ANSI_QUOTES 4
-#define MODE_IGNORE_SPACE 8
-#define MODE_NOT_USED 16
-#define MODE_ONLY_FULL_GROUP_BY 32
-#define MODE_NO_UNSIGNED_SUBTRACTION 64
-#define MODE_NO_DIR_IN_CREATE 128
-#define MODE_POSTGRESQL 256
-#define MODE_ORACLE 512
-#define MODE_MSSQL 1024
-#define MODE_DB2 2048
-#define MODE_MAXDB 4096
-#define MODE_NO_KEY_OPTIONS 8192
-#define MODE_NO_TABLE_OPTIONS 16384
-#define MODE_NO_FIELD_OPTIONS 32768
-#define MODE_MYSQL323 65536L
-#define MODE_MYSQL40 (MODE_MYSQL323*2)
-#define MODE_ANSI (MODE_MYSQL40*2)
-#define MODE_NO_AUTO_VALUE_ON_ZERO (MODE_ANSI*2)
-#define MODE_NO_BACKSLASH_ESCAPES (MODE_NO_AUTO_VALUE_ON_ZERO*2)
-#define MODE_STRICT_TRANS_TABLES (MODE_NO_BACKSLASH_ESCAPES*2)
-#define MODE_STRICT_ALL_TABLES (MODE_STRICT_TRANS_TABLES*2)
-#define MODE_NO_ZERO_IN_DATE (MODE_STRICT_ALL_TABLES*2)
-#define MODE_NO_ZERO_DATE (MODE_NO_ZERO_IN_DATE*2)
-#define MODE_INVALID_DATES (MODE_NO_ZERO_DATE*2)
-#define MODE_ERROR_FOR_DIVISION_BY_ZERO (MODE_INVALID_DATES*2)
-#define MODE_TRADITIONAL (MODE_ERROR_FOR_DIVISION_BY_ZERO*2)
-#define MODE_NO_AUTO_CREATE_USER (MODE_TRADITIONAL*2)
-#define MODE_HIGH_NOT_PRECEDENCE (MODE_NO_AUTO_CREATE_USER*2)
-#define MODE_NO_ENGINE_SUBSTITUTION (MODE_HIGH_NOT_PRECEDENCE*2)
-#define MODE_PAD_CHAR_TO_FULL_LENGTH (1ULL << 31)
-
/* @@optimizer_switch flags. These must be in sync with optimizer_switch_typelib */
#define OPTIMIZER_SWITCH_INDEX_MERGE (1ULL << 0)
#define OPTIMIZER_SWITCH_INDEX_MERGE_UNION (1ULL << 1)
@@ -689,8 +187,6 @@ enum open_table_mode
*/
-#define MY_CHARSET_BIN_MB_MAXLEN 1
-
// uncachable cause
#define UNCACHEABLE_DEPENDENT 1
#define UNCACHEABLE_RAND 2
@@ -710,30 +206,6 @@ enum open_table_mode
#define BINLOG_DUMP_NON_BLOCK 1
-struct TABLE_LIST;
-class String;
-void view_store_options(THD *thd, TABLE_LIST *table, String *buff);
-
-/* Options to add_table_to_list() */
-#define TL_OPTION_UPDATING 1
-#define TL_OPTION_FORCE_INDEX 2
-#define TL_OPTION_IGNORE_LEAVES 4
-#define TL_OPTION_ALIAS 8
-
-/* Some portable defines */
-
-#define portable_sizeof_char_ptr 8
-
-#define tmp_file_prefix "#sql" /**< Prefix for tmp tables */
-#define tmp_file_prefix_length 4
-
-/* Flags for calc_week() function. */
-#define WEEK_MONDAY_FIRST 1
-#define WEEK_YEAR 2
-#define WEEK_FIRST_WEEKDAY 4
-
-#define STRING_BUFFER_USUAL_SIZE 80
-
/*
Some defines for exit codes for ::is_equal class functions.
*/
@@ -750,779 +222,19 @@ enum enum_parsing_place
IN_ON
};
-class THD;
-
-enum enum_check_fields
-{
- CHECK_FIELD_IGNORE,
- CHECK_FIELD_WARN,
- CHECK_FIELD_ERROR_FOR_NULL
-};
-
-/** Struct to handle simple linked lists. */
-typedef struct st_sql_list {
- uint elements;
- uchar *first;
- uchar **next;
-
- st_sql_list() {} /* Remove gcc warning */
- inline void empty()
- {
- elements=0;
- first=0;
- next= &first;
- }
- inline void link_in_list(uchar *element,uchar **next_ptr)
- {
- elements++;
- (*next)=element;
- next= next_ptr;
- *next=0;
- }
- inline void save_and_clear(struct st_sql_list *save)
- {
- *save= *this;
- empty();
- }
- inline void push_front(struct st_sql_list *save)
- {
- *save->next= first; /* link current list last */
- first= save->first;
- elements+= save->elements;
- }
- inline void push_back(struct st_sql_list *save)
- {
- if (save->first)
- {
- *next= save->first;
- next= save->next;
- elements+= save->elements;
- }
- }
-} SQL_LIST;
-
-extern MYSQL_PLUGIN_IMPORT pthread_key(THD*, THR_THD);
-inline THD *_current_thd(void)
-{
- return my_pthread_getspecific_ptr(THD*,THR_THD);
-}
-#define current_thd _current_thd()
-
-/**
- The meat of thd_proc_info(THD*, char*), a macro that packs the last
- three calling-info parameters.
-*/
-extern "C"
-const char *set_thd_proc_info(THD *thd, const char *info,
- const char *calling_func,
- const char *calling_file,
- const unsigned int calling_line);
-
-/**
- Enumerate possible types of a table from re-execution
- standpoint.
- TABLE_LIST class has a member of this type.
- At prepared statement prepare, this member is assigned a value
- as of the current state of the database. Before (re-)execution
- of a prepared statement, we check that the value recorded at
- prepare matches the type of the object we obtained from the
- table definition cache.
-
- @sa check_and_update_table_version()
- @sa Execute_observer
- @sa Prepared_statement::reprepare()
-*/
-
-enum enum_table_ref_type
-{
- /** Initial value set by the parser */
- TABLE_REF_NULL= 0,
- TABLE_REF_VIEW,
- TABLE_REF_BASE_TABLE,
- TABLE_REF_I_S_TABLE,
- TABLE_REF_TMP_TABLE
-};
-
-/*
- External variables
-*/
-extern ulong server_id, concurrency;
-
-
-typedef my_bool (*qc_engine_callback)(THD *thd, char *table_key,
- uint key_length,
- ulonglong *engine_data);
-#include "sql_string.h"
-#include "sql_list.h"
-#include "sql_map.h"
-#include "my_decimal.h"
-#include "handler.h"
-#include "parse_file.h"
-#include "table.h"
-#include "sql_error.h"
-#include "field.h" /* Field definitions */
-#include "protocol.h"
-#include "sql_udf.h"
-#include "sql_profile.h"
-#include "sql_partition.h"
-
-class user_var_entry;
-class Security_context;
enum enum_var_type
{
OPT_DEFAULT= 0, OPT_SESSION, OPT_GLOBAL
};
-class sys_var;
-#ifdef MYSQL_SERVER
-class Comp_creator;
-typedef Comp_creator* (*chooser_compare_func_creator)(bool invert);
-#endif
-#include "item.h"
-extern my_decimal decimal_zero;
-
-/* my_decimal.cc */
-bool str_set_decimal(uint mask, const my_decimal *val, uint fixed_prec,
- uint fixed_dec, char filler, String *str,
- CHARSET_INFO *cs);
-inline bool str_set_decimal(const my_decimal *val, String *str,
- CHARSET_INFO *cs)
-{
- return str_set_decimal(E_DEC_FATAL_ERROR, val, 0, 0, 0, str, cs);
-}
-
-/* sql_parse.cc */
-void free_items(Item *item);
-void cleanup_items(Item *item);
-class THD;
-void close_thread_tables(THD *thd);
-
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
-bool check_one_table_access(THD *thd, ulong privilege, TABLE_LIST *tables);
-bool check_single_table_access(THD *thd, ulong privilege,
- TABLE_LIST *tables, bool no_errors);
-bool check_routine_access(THD *thd,ulong want_access,char *db,char *name,
- bool is_proc, bool no_errors);
-bool check_some_access(THD *thd, ulong want_access, TABLE_LIST *table);
-bool check_some_routine_access(THD *thd, const char *db, const char *name, bool is_proc);
-#else
-inline bool check_one_table_access(THD *thd, ulong privilege, TABLE_LIST *tables)
-{ return false; }
-inline bool check_single_table_access(THD *thd, ulong privilege,
- TABLE_LIST *tables, bool no_errors)
-{ return false; }
-inline bool check_routine_access(THD *thd,ulong want_access,char *db,
- char *name, bool is_proc, bool no_errors)
-{ return false; }
-inline bool check_some_access(THD *thd, ulong want_access, TABLE_LIST *table)
-{ return false; }
-inline bool check_merge_table_access(THD *thd, char *db, TABLE_LIST *table_list)
-{ return false; }
-inline bool check_some_routine_access(THD *thd, const char *db,
- const char *name, bool is_proc)
-{ return false; }
-#endif /*NO_EMBEDDED_ACCESS_CHECKS*/
-
-bool multi_update_precheck(THD *thd, TABLE_LIST *tables);
-bool multi_delete_precheck(THD *thd, TABLE_LIST *tables);
-int mysql_multi_update_prepare(THD *thd);
-int mysql_multi_delete_prepare(THD *thd);
-bool mysql_insert_select_prepare(THD *thd);
-bool update_precheck(THD *thd, TABLE_LIST *tables);
-bool delete_precheck(THD *thd, TABLE_LIST *tables);
-bool insert_precheck(THD *thd, TABLE_LIST *tables);
-bool create_table_precheck(THD *thd, TABLE_LIST *tables,
- TABLE_LIST *create_table);
-int append_query_string(CHARSET_INFO *csinfo,
- String const *from, String *to);
-
-void get_default_definer(THD *thd, LEX_USER *definer);
-LEX_USER *create_default_definer(THD *thd);
-LEX_USER *create_definer(THD *thd, LEX_STRING *user_name, LEX_STRING *host_name);
-LEX_USER *get_current_user(THD *thd, LEX_USER *user);
-bool check_string_byte_length(LEX_STRING *str, const char *err_msg,
- uint max_byte_length);
-bool check_string_char_length(LEX_STRING *str, const char *err_msg,
- uint max_char_length, CHARSET_INFO *cs,
- bool no_error);
-bool check_host_name(LEX_STRING *str);
-bool check_identifier_name(LEX_STRING *str, uint max_char_length,
- uint err_code, const char *param_for_err_msg);
-inline bool check_identifier_name(LEX_STRING *str, uint err_code)
-{
- return check_identifier_name(str, NAME_CHAR_LEN, err_code, "");
-}
-inline bool check_identifier_name(LEX_STRING *str)
-{
- return check_identifier_name(str, NAME_CHAR_LEN, 0, "");
-}
-CHARSET_INFO *merge_charset_and_collation(CHARSET_INFO *cs, CHARSET_INFO *cl);
-
-bool parse_sql(THD *thd,
- Parser_state *parser_state,
- Object_creation_ctx *creation_ctx);
-Item *negate_expression(THD *thd, Item *expr);
-
-/* log.cc */
-
-int vprint_msg_to_log(enum loglevel level, const char *format, va_list args);
-void sql_print_error(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
-void sql_print_warning(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
-void sql_print_information(const char *format, ...)
- ATTRIBUTE_FORMAT(printf, 1, 2);
-typedef void (*sql_print_message_func)(const char *format, ...)
- ATTRIBUTE_FORMAT(printf, 1, 2);
-extern sql_print_message_func sql_print_message_handlers[];
-
-int error_log_print(enum loglevel level, const char *format,
- va_list args);
-
-bool slow_log_print(THD *thd, const char *query, uint query_length,
- ulonglong current_utime);
-
-bool general_log_print(THD *thd, enum enum_server_command command,
- const char *format,...);
-
-bool general_log_write(THD *thd, enum enum_server_command command,
- const char *query, uint query_length);
-
-#include "sql_class.h"
-#include "sql_acl.h"
-#include "tztime.h"
-#ifdef MYSQL_SERVER
-#include "sql_servers.h"
-#include "records.h"
-#include "opt_range.h"
-
-#ifdef HAVE_QUERY_CACHE
-struct Query_cache_query_flags
-{
- unsigned int client_long_flag:1;
- unsigned int client_protocol_41:1;
- unsigned int protocol_type:2;
- unsigned int more_results_exists:1;
- unsigned int in_trans:1;
- unsigned int autocommit:1;
- unsigned int pkt_nr;
- uint character_set_client_num;
- uint character_set_results_num;
- uint collation_connection_num;
- ha_rows limit;
- Time_zone *time_zone;
- ulong sql_mode;
- ulong max_sort_length;
- ulong group_concat_max_len;
- ulong default_week_format;
- ulong div_precision_increment;
- MY_LOCALE *lc_time_names;
-};
-#define QUERY_CACHE_FLAGS_SIZE sizeof(Query_cache_query_flags)
-#include "sql_cache.h"
-#define query_cache_abort(A) query_cache.abort(A)
-#define query_cache_end_of_result(A) query_cache.end_of_result(A)
-#define query_cache_store_query(A, B) query_cache.store_query(A, B)
-#define query_cache_destroy() query_cache.destroy()
-#define query_cache_result_size_limit(A) query_cache.result_size_limit(A)
-#define query_cache_init() query_cache.init()
-#define query_cache_resize(A) query_cache.resize(A)
-#define query_cache_set_min_res_unit(A) query_cache.set_min_res_unit(A)
-#define query_cache_invalidate3(A, B, C) query_cache.invalidate(A, B, C)
-#define query_cache_invalidate1(A) query_cache.invalidate(A)
-#define query_cache_send_result_to_client(A, B, C) \
- query_cache.send_result_to_client(A, B, C)
-#define query_cache_invalidate_by_MyISAM_filename_ref \
- &query_cache_invalidate_by_MyISAM_filename
-/* note the "maybe": it's a read without mutex */
-#define query_cache_maybe_disabled(T) \
- (T->variables.query_cache_type == 0 || query_cache.query_cache_size == 0)
-#define query_cache_is_cacheable_query(L) \
- (((L)->sql_command == SQLCOM_SELECT) && (L)->safe_to_cache_query)
-#else
-#define QUERY_CACHE_FLAGS_SIZE 0
-#define query_cache_store_query(A, B)
-#define query_cache_destroy()
-#define query_cache_result_size_limit(A)
-#define query_cache_init()
-#define query_cache_resize(A)
-#define query_cache_set_min_res_unit(A)
-#define query_cache_invalidate3(A, B, C)
-#define query_cache_invalidate1(A)
-#define query_cache_send_result_to_client(A, B, C) 0
-#define query_cache_invalidate_by_MyISAM_filename_ref NULL
-
-#define query_cache_abort(A)
-#define query_cache_end_of_result(A)
-#define query_cache_invalidate_by_MyISAM_filename_ref NULL
-#define query_cache_maybe_disabled(T) 1
-#define query_cache_is_cacheable_query(L) 0
-#endif /*HAVE_QUERY_CACHE*/
-
-int write_bin_log(THD *thd, bool clear_error,
- char const *query, ulong query_length,
- bool is_trans= FALSE);
-
-/* sql_connect.cc */
-int check_user(THD *thd, enum enum_server_command command,
- const char *passwd, uint passwd_len, const char *db,
- bool check_count);
-pthread_handler_t handle_one_connection(void *arg);
-void do_handle_one_connection(THD *thd_arg);
-bool init_new_connection_handler_thread();
-void reset_mqh(LEX_USER *lu, bool get_them);
-bool check_mqh(THD *thd, uint check_command);
-void time_out_user_resource_limits(THD *thd, USER_CONN *uc);
-void decrease_user_connections(USER_CONN *uc);
-void thd_init_client_charset(THD *thd, uint cs_number);
-bool setup_connection_thread_globals(THD *thd);
-bool login_connection(THD *thd);
-void end_connection(THD *thd);
-
-
-int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create, bool silent);
-bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create);
-bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent);
-bool mysql_upgrade_db(THD *thd, LEX_STRING *old_db);
-void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos, ushort flags);
-void mysql_client_binlog_statement(THD *thd);
-bool mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
- my_bool drop_temporary);
-int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
- bool drop_temporary, bool drop_view, bool log_query);
-bool quick_rm_table(handlerton *base,const char *db,
- const char *table_name, uint flags);
-bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent);
-bool do_rename(THD *thd, TABLE_LIST *ren_table, char *new_db,
- char *new_table_name, char *new_table_alias,
- bool skip_error);
-
-bool mysql_change_db(THD *thd, const LEX_STRING *new_db_name,
- bool force_switch);
-
-bool mysql_opt_change_db(THD *thd,
- const LEX_STRING *new_db_name,
- LEX_STRING *saved_db_name,
- bool force_switch,
- bool *cur_db_changed);
-
-void mysql_parse(THD *thd, const char *inBuf, uint length,
- const char ** semicolon);
-
-bool mysql_test_parse_for_slave(THD *thd,char *inBuf,uint length);
-bool is_update_query(enum enum_sql_command command);
-bool is_log_table_write_query(enum enum_sql_command command);
-bool alloc_query(THD *thd, const char *packet, uint packet_length);
-void mysql_init_select(LEX *lex);
-void mysql_reset_thd_for_next_command(THD *thd);
-bool mysql_new_select(LEX *lex, bool move_down);
-void create_select_for_variable(const char *var_name);
-void mysql_init_multi_delete(LEX *lex);
-bool multi_delete_set_locks_and_link_aux_tables(LEX *lex);
-void create_table_set_open_action_and_adjust_tables(LEX *lex);
-void init_max_user_conn(void);
-void init_update_queries(void);
-void free_max_user_conn(void);
-pthread_handler_t handle_bootstrap(void *arg);
-void do_handle_bootstrap(THD *thd);
-int mysql_execute_command(THD *thd);
-
-bool do_command(THD *thd);
-bool dispatch_command(enum enum_server_command command, THD *thd,
- char* packet, uint packet_length);
-void log_slow_statement(THD *thd);
-bool check_dup(const char *db, const char *name, TABLE_LIST *tables);
-bool compare_record(TABLE *table);
-bool append_file_to_dir(THD *thd, const char **filename_ptr,
- const char *table_name);
-bool table_def_init(void);
-void table_def_start_shutdown(void);
-void table_def_free(void);
-void assign_new_table_id(TABLE_SHARE *share);
-uint cached_open_tables(void);
-uint cached_table_definitions(void);
-void kill_mysql(void);
-void close_connection(THD *thd, uint errcode, bool lock);
-bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
- bool *write_to_binlog);
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
-bool check_access(THD *thd, ulong access, const char *db, ulong *save_priv,
- GRANT_INTERNAL_INFO *grant_internal_info,
- bool no_grant, bool no_errors);
-bool check_table_access(THD *thd, ulong requirements, TABLE_LIST *tables,
- bool no_errors,
- bool any_combination_of_privileges_will_do,
- uint number);
-#else
-inline bool check_access(THD *thd, ulong access, const char *db,
- ulong *save_priv,
- GRANT_INTERNAL_INFO *grant_internal_info,
- bool no_grant, bool no_errors)
-{
- if (save_priv)
- *save_priv= GLOBAL_ACLS;
- return false;
-}
-inline bool check_table_access(THD *thd, ulong want_access, TABLE_LIST *tables,
- bool no_errors,
- bool any_combination_of_privileges_will_do,
- uint number)
-{ return false; }
-#endif /*NO_EMBEDDED_ACCESS_CHECKS*/
+class sys_var;
-#endif /* MYSQL_SERVER */
-#if defined MYSQL_SERVER || defined INNODB_COMPATIBILITY_HOOKS
-bool check_global_access(THD *thd, ulong want_access);
-#endif /* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */
#ifdef MYSQL_SERVER
-/*
- Support routine for SQL parser on partitioning syntax
-*/
-my_bool is_partition_management(LEX *lex);
-/*
- General routine to change field->ptr of a NULL-terminated array of Field
- objects. Useful when needed to call val_int, val_str or similar and the
- field data is not in table->record[0] but in some other structure.
- set_key_field_ptr changes all fields of an index using a key_info object.
- All methods presume that there is at least one field to change.
-*/
-
-void set_field_ptr(Field **ptr, const uchar *new_buf, const uchar *old_buf);
-void set_key_field_ptr(KEY *key_info, const uchar *new_buf,
- const uchar *old_buf);
-
-bool mysql_backup_table(THD* thd, TABLE_LIST* table_list);
-bool mysql_restore_table(THD* thd, TABLE_LIST* table_list);
-
-bool mysql_checksum_table(THD* thd, TABLE_LIST* table_list,
- HA_CHECK_OPT* check_opt);
-bool mysql_check_table(THD* thd, TABLE_LIST* table_list,
- HA_CHECK_OPT* check_opt);
-bool mysql_repair_table(THD* thd, TABLE_LIST* table_list,
- HA_CHECK_OPT* check_opt);
-bool mysql_analyze_table(THD* thd, TABLE_LIST* table_list,
- HA_CHECK_OPT* check_opt);
-bool mysql_optimize_table(THD* thd, TABLE_LIST* table_list,
- HA_CHECK_OPT* check_opt);
-bool mysql_assign_to_keycache(THD* thd, TABLE_LIST* table_list,
- LEX_STRING *key_cache_name);
-bool mysql_preload_keys(THD* thd, TABLE_LIST* table_list);
-int reassign_keycache_tables(THD* thd, KEY_CACHE *src_cache,
- KEY_CACHE *dst_cache);
-TABLE *create_virtual_tmp_table(THD *thd, List<Create_field> &field_list);
-
-bool mysql_xa_recover(THD *thd);
-
-bool check_simple_select();
-int mysql_alter_tablespace(THD* thd, st_alter_tablespace *ts_info);
-
-SORT_FIELD * make_unireg_sortorder(ORDER *order, uint *length,
- SORT_FIELD *sortorder);
-int setup_order(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
- List<Item> &fields, List <Item> &all_fields, ORDER *order);
-int setup_group(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
- List<Item> &fields, List<Item> &all_fields, ORDER *order,
- bool *hidden_group_fields);
-bool fix_inner_refs(THD *thd, List<Item> &all_fields, SELECT_LEX *select,
- Item **ref_pointer_array, ORDER *group_list= NULL);
-
-bool handle_select(THD *thd, LEX *lex, select_result *result,
- ulong setup_tables_done_option);
-bool mysql_select(THD *thd, Item ***rref_pointer_array,
- TABLE_LIST *tables, uint wild_num, List<Item> &list,
- COND *conds, uint og_num, ORDER *order, ORDER *group,
- Item *having, ORDER *proc_param, ulonglong select_type,
- select_result *result, SELECT_LEX_UNIT *unit,
- SELECT_LEX *select_lex);
-void free_underlaid_joins(THD *thd, SELECT_LEX *select);
-bool mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit,
- select_result *result);
-int mysql_explain_select(THD *thd, SELECT_LEX *sl, char const *type,
- select_result *result);
-bool mysql_union(THD *thd, LEX *lex, select_result *result,
- SELECT_LEX_UNIT *unit, ulong setup_tables_done_option);
-bool mysql_handle_derived(LEX *lex, bool (*processor)(THD *thd,
- LEX *lex,
- TABLE_LIST *table));
-bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *t);
-bool mysql_derived_filling(THD *thd, LEX *lex, TABLE_LIST *t);
-Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
- Item ***copy_func, Field **from_field,
- Field **def_field,
- bool group, bool modify_item,
- bool table_cant_handle_bit_fields,
- bool make_copy_field,
- uint convert_blob_length);
-void sp_prepare_create_field(THD *thd, Create_field *sql_field);
-int prepare_create_field(Create_field *sql_field,
- uint *blob_columns,
- int *timestamps, int *timestamps_with_niladic,
- longlong table_flags);
-CHARSET_INFO* get_sql_field_charset(Create_field *sql_field,
- HA_CREATE_INFO *create_info);
-bool mysql_create_table(THD *thd, TABLE_LIST *create_table,
- HA_CREATE_INFO *create_info,
- Alter_info *alter_info);
-bool mysql_create_table_no_lock(THD *thd, const char *db,
- const char *table_name,
- HA_CREATE_INFO *create_info,
- Alter_info *alter_info,
- bool tmp_table, uint select_field_count);
-
-bool mysql_alter_table(THD *thd, char *new_db, char *new_name,
- HA_CREATE_INFO *create_info,
- TABLE_LIST *table_list,
- Alter_info *alter_info,
- uint order_num, ORDER *order, bool ignore);
-bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list);
-bool mysql_create_like_table(THD *thd, TABLE_LIST *table,
- TABLE_LIST *src_table,
- HA_CREATE_INFO *create_info);
-bool mysql_rename_table(handlerton *base, const char *old_db,
- const char * old_name, const char *new_db,
- const char * new_name, uint flags);
-bool mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
- Item **conds, uint order_num, ORDER *order);
-int mysql_update(THD *thd,TABLE_LIST *tables,List<Item> &fields,
- List<Item> &values,COND *conds,
- uint order_num, ORDER *order, ha_rows limit,
- enum enum_duplicates handle_duplicates, bool ignore,
- ha_rows *found_return, ha_rows *updated_return);
-bool mysql_multi_update(THD *thd, TABLE_LIST *table_list,
- List<Item> *fields, List<Item> *values,
- COND *conds, ulonglong options,
- enum enum_duplicates handle_duplicates, bool ignore,
- SELECT_LEX_UNIT *unit, SELECT_LEX *select_lex,
- multi_update **result);
-bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, TABLE *table,
- List<Item> &fields, List_item *values,
- List<Item> &update_fields,
- List<Item> &update_values, enum_duplicates duplic,
- COND **where, bool select_insert,
- bool check_fields, bool abort_on_warning);
-bool mysql_insert(THD *thd,TABLE_LIST *table,List<Item> &fields,
- List<List_item> &values, List<Item> &update_fields,
- List<Item> &update_values, enum_duplicates flag,
- bool ignore);
-void upgrade_lock_type_for_insert(THD *thd, thr_lock_type *lock_type,
- enum_duplicates duplic,
- bool is_multi_insert);
-int check_that_all_fields_are_given_values(THD *thd, TABLE *entry,
- TABLE_LIST *table_list);
-void prepare_triggers_for_insert_stmt(TABLE *table);
-int mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds);
-bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
- SQL_LIST *order, ha_rows rows, ulonglong options,
- bool reset_auto_increment);
-bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok);
-bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create);
-uint create_table_def_key(THD *thd, char *key, TABLE_LIST *table_list,
- bool tmp_table);
-TABLE_SHARE *get_table_share(THD *thd, TABLE_LIST *table_list, char *key,
- uint key_length, uint db_flags, int *error,
- my_hash_value_type hash_value);
-void release_table_share(TABLE_SHARE *share);
-TABLE_SHARE *get_cached_table_share(const char *db, const char *table_name);
-TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type update,
- uint lock_flags);
-bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT* mem,
- Open_table_context *backoff, uint flags);
-bool tdc_open_view(THD *thd, TABLE_LIST *table_list, const char *alias,
- char *cache_key, uint cache_key_length,
- MEM_ROOT *mem_root, uint flags);
-TABLE *find_locked_table(TABLE *list, const char *db, const char *table_name);
-TABLE *find_table_for_mdl_upgrade(TABLE *list, const char *db,
- const char *table_name,
- bool no_error);
-thr_lock_type read_lock_type_for_table(THD *thd, TABLE *table);
-bool open_new_frm(THD *thd, TABLE_SHARE *share, const char *alias,
- uint db_stat, uint prgflag,
- uint ha_open_flags, TABLE *outparam,
- TABLE_LIST *table_desc, MEM_ROOT *mem_root);
-void execute_init_command(THD *thd, LEX_STRING *init_command,
- mysql_rwlock_t *var_mutex);
-extern Field *not_found_field;
-extern Field *view_ref_found;
-
-enum find_item_error_report_type {REPORT_ALL_ERRORS, REPORT_EXCEPT_NOT_FOUND,
- IGNORE_ERRORS, REPORT_EXCEPT_NON_UNIQUE,
- IGNORE_EXCEPT_NON_UNIQUE};
-Field *
-find_field_in_tables(THD *thd, Item_ident *item,
- TABLE_LIST *first_table, TABLE_LIST *last_table,
- Item **ref, find_item_error_report_type report_error,
- bool check_privileges, bool register_tree_change);
-Field *
-find_field_in_table_ref(THD *thd, TABLE_LIST *table_list,
- const char *name, uint length,
- const char *item_name, const char *db_name,
- const char *table_name, Item **ref,
- bool check_privileges, bool allow_rowid,
- uint *cached_field_index_ptr,
- bool register_tree_change, TABLE_LIST **actual_table);
-Field *
-find_field_in_table(THD *thd, TABLE *table, const char *name, uint length,
- bool allow_rowid, uint *cached_field_index_ptr);
-Field *
-find_field_in_table_sef(TABLE *table, const char *name);
-
#endif /* MYSQL_SERVER */
-#ifdef HAVE_OPENSSL
-#include <openssl/des.h>
-struct st_des_keyblock
-{
- DES_cblock key1, key2, key3;
-};
-struct st_des_keyschedule
-{
- DES_key_schedule ks1, ks2, ks3;
-};
-extern char *des_key_file;
-extern struct st_des_keyschedule des_keyschedule[10];
-extern uint des_default_key;
-extern mysql_mutex_t LOCK_des_key_file;
-bool load_des_key_file(const char *file_name);
-#endif /* HAVE_OPENSSL */
-
#ifdef MYSQL_SERVER
-/* sql_do.cc */
-bool mysql_do(THD *thd, List<Item> &values);
-
-/* sql_analyse.h */
-bool append_escaped(String *to_str, String *from_str);
-
-/* sql_show.cc */
-bool mysqld_show_open_tables(THD *thd,const char *wild);
-bool mysqld_show_logs(THD *thd);
-void append_identifier(THD *thd, String *packet, const char *name,
- uint length);
-#endif /* MYSQL_SERVER */
-#if defined MYSQL_SERVER || defined INNODB_COMPATIBILITY_HOOKS
-int get_quote_char_for_identifier(THD *thd, const char *name, uint length);
-#endif /* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */
-#ifdef MYSQL_SERVER
-void mysqld_list_fields(THD *thd,TABLE_LIST *table, const char *wild);
-int mysqld_dump_create_info(THD *thd, TABLE_LIST *table_list, int fd);
-bool mysqld_show_create(THD *thd, TABLE_LIST *table_list);
-bool mysqld_show_create_db(THD *thd, char *dbname, HA_CREATE_INFO *create);
-
-void mysqld_list_processes(THD *thd,const char *user,bool verbose);
-int mysqld_show_status(THD *thd);
-int mysqld_show_variables(THD *thd,const char *wild);
-bool mysqld_show_storage_engines(THD *thd);
-bool mysqld_show_authors(THD *thd);
-bool mysqld_show_contributors(THD *thd);
-bool mysqld_show_privileges(THD *thd);
-bool mysqld_show_column_types(THD *thd);
-bool mysqld_help (THD *thd, const char *text);
-void calc_sum_of_all_status(STATUS_VAR *to);
-
-void append_definer(THD *thd, String *buffer, const LEX_STRING *definer_user,
- const LEX_STRING *definer_host);
-
-int add_status_vars(SHOW_VAR *list);
-void remove_status_vars(SHOW_VAR *list);
-void init_status_vars();
-void free_status_vars();
-void reset_status_vars();
-/* information schema */
-extern LEX_STRING INFORMATION_SCHEMA_NAME;
-/* performance schema */
-extern LEX_STRING PERFORMANCE_SCHEMA_DB_NAME;
-/* log tables */
-extern LEX_STRING MYSQL_SCHEMA_NAME;
-extern LEX_STRING GENERAL_LOG_NAME;
-extern LEX_STRING SLOW_LOG_NAME;
-extern LEX_STRING BACKUP_HISTORY_LOG_NAME;
-extern LEX_STRING BACKUP_PROGRESS_LOG_NAME;
-extern LEX_STRING BACKUP_SETTINGS_NAME;
-
-extern const LEX_STRING partition_keywords[];
-ST_SCHEMA_TABLE *find_schema_table(THD *thd, const char* table_name);
-ST_SCHEMA_TABLE *get_schema_table(enum enum_schema_tables schema_table_idx);
-int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident,
- enum enum_schema_tables schema_table_idx);
-int make_schema_select(THD *thd, SELECT_LEX *sel,
- enum enum_schema_tables schema_table_idx);
-int mysql_schema_table(THD *thd, LEX *lex, TABLE_LIST *table_list);
-int fill_schema_user_privileges(THD *thd, TABLE_LIST *tables, COND *cond);
-int fill_schema_schema_privileges(THD *thd, TABLE_LIST *tables, COND *cond);
-int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond);
-int fill_schema_column_privileges(THD *thd, TABLE_LIST *tables, COND *cond);
-bool get_schema_tables_result(JOIN *join,
- enum enum_schema_table_state executed_place);
-enum enum_schema_tables get_schema_table_idx(ST_SCHEMA_TABLE *schema_table);
-
-inline bool is_infoschema_db(const char *name, size_t len)
-{
- return (INFORMATION_SCHEMA_NAME.length == len &&
- !my_strcasecmp(system_charset_info,
- INFORMATION_SCHEMA_NAME.str, name));
-}
-
-inline bool is_infoschema_db(const char *name)
-{
- return (!my_strcasecmp(system_charset_info,
- INFORMATION_SCHEMA_NAME.str, name));
-}
-
-void initialize_information_schema_acl();
-
-/* sql_handler.cc */
-bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen);
-bool mysql_ha_close(THD *thd, TABLE_LIST *tables);
-bool mysql_ha_read(THD *, TABLE_LIST *,enum enum_ha_read_modes,char *,
- List<Item> *,enum ha_rkey_function,Item *,ha_rows,ha_rows);
-void mysql_ha_flush(THD *thd);
-void mysql_ha_rm_tables(THD *thd, TABLE_LIST *tables);
-void mysql_ha_cleanup(THD *thd);
-void mysql_ha_move_tickets_after_trans_sentinel(THD *thd);
-
-/* sql_base.cc */
-#define TMP_TABLE_KEY_EXTRA 8
-void set_item_name(Item *item,char *pos,uint length);
-bool add_field_to_list(THD *thd, LEX_STRING *field_name, enum enum_field_types type,
- char *length, char *decimal,
- uint type_modifier,
- enum ha_storage_media storage_type,
- enum column_format_type column_format,
- Item *default_value, Item *on_update_value,
- LEX_STRING *comment,
- char *change, List<String> *interval_list,
- CHARSET_INFO *cs,
- uint uint_geom_type);
-Create_field * new_create_field(THD *thd, char *field_name, enum_field_types type,
- char *length, char *decimals,
- uint type_modifier,
- Item *default_value, Item *on_update_value,
- LEX_STRING *comment, char *change,
- List<String> *interval_list, CHARSET_INFO *cs,
- uint uint_geom_type);
-void store_position_for_column(const char *name);
-bool add_to_list(THD *thd, SQL_LIST &list,Item *group,bool asc);
-bool push_new_name_resolution_context(THD *thd,
- TABLE_LIST *left_op,
- TABLE_LIST *right_op);
-void add_join_on(TABLE_LIST *b,Item *expr);
-void add_join_natural(TABLE_LIST *a,TABLE_LIST *b,List<String> *using_fields,
- SELECT_LEX *lex);
-bool add_proc_to_list(THD *thd, Item *item);
-bool wait_while_table_is_used(THD *thd, TABLE *table,
- enum ha_extra_function function);
-void drop_open_table(THD *thd, TABLE *table, const char *db_name,
- const char *table_name);
-void close_all_tables_for_name(THD *thd, TABLE_SHARE *share,
- bool remove_from_locked_tables);
-void update_non_unique_table_error(TABLE_LIST *update,
- const char *operation,
- TABLE_LIST *duplicate);
-
-SQL_SELECT *make_select(TABLE *head, table_map const_tables,
- table_map read_tables, COND *conds,
- bool allow_null_cond, int *error);
-extern Item **not_found_item;
-
/*
A set of constants used for checking non aggregated fields and sum
functions mixture in the ONLY_FULL_GROUP_BY_MODE.
@@ -1531,1055 +243,15 @@ extern Item **not_found_item;
#define SUM_FUNC_USED 2
/*
- This enumeration type is used only by the function find_item_in_list
- to return the info on how an item has been resolved against a list
- of possibly aliased items.
- The item can be resolved:
- - against an alias name of the list's element (RESOLVED_AGAINST_ALIAS)
- - against non-aliased field name of the list (RESOLVED_WITH_NO_ALIAS)
- - against an aliased field name of the list (RESOLVED_BEHIND_ALIAS)
- - ignoring the alias name in cases when SQL requires to ignore aliases
- (e.g. when the resolved field reference contains a table name or
- when the resolved item is an expression) (RESOLVED_IGNORING_ALIAS)
-*/
-enum enum_resolution_type {
- NOT_RESOLVED=0,
- RESOLVED_IGNORING_ALIAS,
- RESOLVED_BEHIND_ALIAS,
- RESOLVED_WITH_NO_ALIAS,
- RESOLVED_AGAINST_ALIAS
-};
-Item ** find_item_in_list(Item *item, List<Item> &items, uint *counter,
- find_item_error_report_type report_error,
- enum_resolution_type *resolution);
-bool get_key_map_from_key_list(key_map *map, TABLE *table,
- List<String> *index_list);
-bool insert_fields(THD *thd, Name_resolution_context *context,
- const char *db_name, const char *table_name,
- List_iterator<Item> *it, bool any_privileges);
-bool setup_tables(THD *thd, Name_resolution_context *context,
- List<TABLE_LIST> *from_clause, TABLE_LIST *tables,
- TABLE_LIST **leaves, bool select_insert);
-bool setup_tables_and_check_access(THD *thd,
- Name_resolution_context *context,
- List<TABLE_LIST> *from_clause,
- TABLE_LIST *tables,
- TABLE_LIST **leaves,
- bool select_insert,
- ulong want_access_first,
- ulong want_access);
-int setup_wild(THD *thd, TABLE_LIST *tables, List<Item> &fields,
- List<Item> *sum_func_list, uint wild_num);
-bool setup_fields(THD *thd, Item** ref_pointer_array,
- List<Item> &item, enum_mark_columns mark_used_columns,
- List<Item> *sum_func_list, bool allow_sum_func);
-inline bool setup_fields_with_no_wrap(THD *thd, Item **ref_pointer_array,
- List<Item> &item,
- enum_mark_columns mark_used_columns,
- List<Item> *sum_func_list,
- bool allow_sum_func)
-{
- bool res;
- thd->lex->select_lex.no_wrap_view_item= TRUE;
- res= setup_fields(thd, ref_pointer_array, item, mark_used_columns, sum_func_list,
- allow_sum_func);
- thd->lex->select_lex.no_wrap_view_item= FALSE;
- return res;
-}
-int setup_conds(THD *thd, TABLE_LIST *tables, TABLE_LIST *leaves,
- COND **conds);
-int setup_ftfuncs(SELECT_LEX* select);
-int init_ftfuncs(THD *thd, SELECT_LEX* select, bool no_order);
-void wait_for_condition(THD *thd, mysql_mutex_t *mutex,
- mysql_cond_t *cond);
-bool open_tables(THD *thd, TABLE_LIST **tables, uint *counter, uint flags,
- Prelocking_strategy *prelocking_strategy);
-inline bool
-open_tables(THD *thd, TABLE_LIST **tables, uint *counter, uint flags)
-{
- DML_prelocking_strategy prelocking_strategy;
-
- return open_tables(thd, tables, counter, flags, &prelocking_strategy);
-}
-/* open_and_lock_tables with optional derived handling */
-bool open_and_lock_tables(THD *thd, TABLE_LIST *tables,
- bool derived, uint flags,
- Prelocking_strategy *prelocking_strategy);
-inline bool open_and_lock_tables(THD *thd, TABLE_LIST *tables,
- bool derived, uint flags)
-{
- DML_prelocking_strategy prelocking_strategy;
-
- return open_and_lock_tables(thd, tables, derived, flags,
- &prelocking_strategy);
-}
-/* simple open_and_lock_tables without derived handling for single table */
-TABLE *open_n_lock_single_table(THD *thd, TABLE_LIST *table_l,
- thr_lock_type lock_type, uint flags);
-bool open_normal_and_derived_tables(THD *thd, TABLE_LIST *tables, uint flags);
-bool lock_tables(THD *thd, TABLE_LIST *tables, uint counter, uint flags);
-TABLE *open_temporary_table(THD *thd, const char *path, const char *db,
- const char *table_name, bool link_in_list,
- open_table_mode open_mode);
-bool rm_temporary_table(handlerton *base, char *path, bool frm_only);
-void free_io_cache(TABLE *entry);
-void intern_close_table(TABLE *entry);
-bool close_thread_table(THD *thd, TABLE **table_ptr);
-void close_temporary_tables(THD *thd);
-void close_tables_for_reopen(THD *thd, TABLE_LIST **tables,
- MDL_ticket *mdl_savepoint);
-TABLE_LIST *find_table_in_list(TABLE_LIST *table,
- TABLE_LIST *TABLE_LIST::*link,
- const char *db_name,
- const char *table_name);
-TABLE_LIST *unique_table(THD *thd, TABLE_LIST *table, TABLE_LIST *table_list,
- bool check_alias);
-TABLE *find_temporary_table(THD *thd, const char *db, const char *table_name);
-TABLE *find_temporary_table(THD *thd, TABLE_LIST *table_list);
-int drop_temporary_table(THD *thd, TABLE_LIST *table_list);
-void close_temporary_table(THD *thd, TABLE *table, bool free_share,
- bool delete_table);
-void mark_tmp_table_for_reuse(TABLE *table);
-void close_temporary(TABLE *table, bool free_share, bool delete_table);
-bool rename_temporary_table(THD* thd, TABLE *table, const char *new_db,
- const char *table_name);
-void flush_tables();
-bool is_equal(const LEX_STRING *a, const LEX_STRING *b);
-char *make_log_name(char *buff, const char *name, const char* log_ext);
-extern char default_logfile_name[FN_REFLEN];
-
-#ifdef WITH_PARTITION_STORAGE_ENGINE
-uint fast_alter_partition_table(THD *thd, TABLE *table,
- Alter_info *alter_info,
- HA_CREATE_INFO *create_info,
- TABLE_LIST *table_list,
- char *db,
- const char *table_name,
- uint fast_alter_partition);
-uint set_part_state(Alter_info *alter_info, partition_info *tab_part_info,
- enum partition_state part_state);
-uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info,
- HA_CREATE_INFO *create_info,
- handlerton *old_db_type,
- bool *partition_changed,
- uint *fast_alter_partition);
-char *generate_partition_syntax(partition_info *part_info,
- uint *buf_length, bool use_sql_alloc,
- bool show_partition_options,
- HA_CREATE_INFO *create_info,
- Alter_info *alter_info);
-#endif
-
-enum enum_tdc_remove_table_type {TDC_RT_REMOVE_ALL, TDC_RT_REMOVE_NOT_OWN,
- TDC_RT_REMOVE_UNUSED};
-void tdc_remove_table(THD *thd, enum_tdc_remove_table_type remove_type,
- const char *db, const char *table_name);
-
-#define NORMAL_PART_NAME 0
-#define TEMP_PART_NAME 1
-#define RENAMED_PART_NAME 2
-void create_partition_name(char *out, const char *in1,
- const char *in2, uint name_variant,
- bool translate);
-void create_subpartition_name(char *out, const char *in1,
- const char *in2, const char *in3,
- uint name_variant);
-
-typedef struct st_lock_param_type
-{
- TABLE_LIST *table_list;
- ulonglong copied;
- ulonglong deleted;
- THD *thd;
- HA_CREATE_INFO *create_info;
- Alter_info *alter_info;
- TABLE *table;
- KEY *key_info_buffer;
- const char *db;
- const char *table_name;
- uchar *pack_frm_data;
- uint key_count;
- uint db_options;
- size_t pack_frm_len;
- partition_info *part_info;
-} ALTER_PARTITION_PARAM_TYPE;
-
-void mem_alloc_error(size_t size);
-
-enum ddl_log_entry_code
-{
- /*
- DDL_LOG_EXECUTE_CODE:
- This is a code that indicates that this is a log entry to
- be executed, from this entry a linked list of log entries
- can be found and executed.
- DDL_LOG_ENTRY_CODE:
- An entry to be executed in a linked list from an execute log
- entry.
- DDL_IGNORE_LOG_ENTRY_CODE:
- An entry that is to be ignored
- */
- DDL_LOG_EXECUTE_CODE = 'e',
- DDL_LOG_ENTRY_CODE = 'l',
- DDL_IGNORE_LOG_ENTRY_CODE = 'i'
-};
-
-enum ddl_log_action_code
-{
- /*
- The type of action that a DDL_LOG_ENTRY_CODE entry is to
- perform.
- DDL_LOG_DELETE_ACTION:
- Delete an entity
- DDL_LOG_RENAME_ACTION:
- Rename an entity
- DDL_LOG_REPLACE_ACTION:
- Rename an entity after removing the previous entry with the
- new name, that is replace this entry.
- */
- DDL_LOG_DELETE_ACTION = 'd',
- DDL_LOG_RENAME_ACTION = 'r',
- DDL_LOG_REPLACE_ACTION = 's'
-};
-
-
-typedef struct st_ddl_log_entry
-{
- const char *name;
- const char *from_name;
- const char *handler_name;
- uint next_entry;
- uint entry_pos;
- enum ddl_log_entry_code entry_type;
- enum ddl_log_action_code action_type;
- /*
- Most actions have only one phase. REPLACE does however have two
- phases. The first phase removes the file with the new name if
- there was one there before and the second phase renames the
- old name to the new name.
- */
- char phase;
-} DDL_LOG_ENTRY;
-
-typedef struct st_ddl_log_memory_entry
-{
- uint entry_pos;
- struct st_ddl_log_memory_entry *next_log_entry;
- struct st_ddl_log_memory_entry *prev_log_entry;
- struct st_ddl_log_memory_entry *next_active_log_entry;
-} DDL_LOG_MEMORY_ENTRY;
-
-
-bool write_ddl_log_entry(DDL_LOG_ENTRY *ddl_log_entry,
- DDL_LOG_MEMORY_ENTRY **active_entry);
-bool write_execute_ddl_log_entry(uint first_entry,
- bool complete,
- DDL_LOG_MEMORY_ENTRY **active_entry);
-bool deactivate_ddl_log_entry(uint entry_no);
-void release_ddl_log_memory_entry(DDL_LOG_MEMORY_ENTRY *log_entry);
-bool sync_ddl_log();
-void release_ddl_log();
-void execute_ddl_log_recovery();
-bool execute_ddl_log_entry(THD *thd, uint first_entry);
-
-extern mysql_mutex_t LOCK_gdl;
-
-#define WFRM_WRITE_SHADOW 1
-#define WFRM_INSTALL_SHADOW 2
-#define WFRM_PACK_FRM 4
-#define WFRM_KEEP_SHARE 8
-bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags);
-int abort_and_upgrade_lock(ALTER_PARTITION_PARAM_TYPE *lpt);
-void close_open_tables_and_downgrade(ALTER_PARTITION_PARAM_TYPE *lpt);
-
-/* Functions to work with system tables. */
-bool open_system_tables_for_read(THD *thd, TABLE_LIST *table_list,
- Open_tables_backup *backup);
-void close_system_tables(THD *thd, Open_tables_backup *backup);
-TABLE *open_system_table_for_update(THD *thd, TABLE_LIST *one_table);
-
-TABLE *open_log_table(THD *thd, TABLE_LIST *one_table, Open_tables_backup *backup);
-void close_log_table(THD *thd, Open_tables_backup *backup);
-
-bool close_cached_tables(THD *thd, TABLE_LIST *tables, bool have_lock,
- bool wait_for_refresh);
-bool close_cached_connection_tables(THD *thd, bool wait_for_refresh,
- LEX_STRING *connect_string,
- bool have_lock = FALSE);
-void copy_field_from_tmp_record(Field *field,int offset);
-bool fill_record(THD *thd, Field **field, List<Item> &values,
- bool ignore_errors);
-bool fill_record_n_invoke_before_triggers(THD *thd, List<Item> &fields,
- List<Item> &values,
- bool ignore_errors,
- Table_triggers_list *triggers,
- enum trg_event_type event);
-bool fill_record_n_invoke_before_triggers(THD *thd, Field **field,
- List<Item> &values,
- bool ignore_errors,
- Table_triggers_list *triggers,
- enum trg_event_type event);
-OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *db, const char *wild);
-
-inline TABLE_LIST *find_table_in_global_list(TABLE_LIST *table,
- const char *db_name,
- const char *table_name)
-{
- return find_table_in_list(table, &TABLE_LIST::next_global,
- db_name, table_name);
-}
-
-inline TABLE_LIST *find_table_in_local_list(TABLE_LIST *table,
- const char *db_name,
- const char *table_name)
-{
- return find_table_in_list(table, &TABLE_LIST::next_local,
- db_name, table_name);
-}
-
-
-/* sql_calc.cc */
-bool eval_const_cond(COND *cond);
-
-/* sql_load.cc */
-int mysql_load(THD *thd, sql_exchange *ex, TABLE_LIST *table_list,
- List<Item> &fields_vars, List<Item> &set_fields,
- List<Item> &set_values_list,
- enum enum_duplicates handle_duplicates, bool ignore,
- bool local_file);
-int write_record(THD *thd, TABLE *table, COPY_INFO *info);
-
-/* sql_manager.cc */
-extern bool volatile mqh_used;
-void start_handle_manager();
-void stop_handle_manager();
-bool mysql_manager_submit(void (*action)());
-
-
-/* sql_test.cc */
-#ifndef DBUG_OFF
-void print_where(COND *cond,const char *info, enum_query_type query_type);
-void print_cached_tables(void);
-void TEST_filesort(SORT_FIELD *sortorder,uint s_length);
-void print_plan(JOIN* join,uint idx, double record_count, double read_time,
- double current_read_time, const char *info);
-void print_keyuse_array(DYNAMIC_ARRAY *keyuse_array);
-void print_sjm(SJ_MATERIALIZATION_INFO *sjm);
-#define EXTRA_DEBUG_DUMP_TABLE_LISTS
-#ifdef EXTRA_DEBUG_DUMP_TABLE_LISTS
-void dump_TABLE_LIST_graph(SELECT_LEX *select_lex, TABLE_LIST* tl);
-#endif
-#endif
-void mysql_print_status();
-
-/* key.cc */
-int find_ref_key(KEY *key, uint key_count, uchar *record, Field *field,
- uint *key_length, uint *keypart);
-void key_copy(uchar *to_key, uchar *from_record, KEY *key_info, uint key_length);
-void key_restore(uchar *to_record, uchar *from_key, KEY *key_info,
- uint key_length);
-void key_zero_nulls(uchar *tuple, KEY *key_info);
-bool key_cmp_if_same(TABLE *form,const uchar *key,uint index,uint key_length);
-void key_unpack(String *to,TABLE *form,uint index);
-bool is_key_used(TABLE *table, uint idx, const MY_BITMAP *fields);
-int key_cmp(KEY_PART_INFO *key_part, const uchar *key, uint key_length);
-extern "C" int key_rec_cmp(void *key_info, uchar *a, uchar *b);
-
-bool init_errmessage(void);
-#endif /* MYSQL_SERVER */
-void sql_perror(const char *message);
-bool read_texts(const char *file_name, const char *language,
- const char ***point, uint error_messages);
-
-bool fn_format_relative_to_data_home(char * to, const char *name,
- const char *dir, const char *extension);
-#ifdef MYSQL_SERVER
-File open_binlog(IO_CACHE *log, const char *log_file_name,
- const char **errmsg);
-
-/* mysqld.cc */
-extern void MYSQLerror(const char*);
-void refresh_status(THD *thd);
-my_bool mysql_rm_tmp_tables(void);
-void handle_connection_in_main_thread(THD *thd);
-void create_thread_to_handle_connection(THD *thd);
-void unlink_thd(THD *thd);
-bool one_thread_per_connection_end(THD *thd, bool put_in_cache);
-void flush_thread_cache();
-
-/* item_func.cc */
-extern bool check_reserved_words(LEX_STRING *name);
-extern enum_field_types agg_field_type(Item **items, uint nitems);
-
-/* strfunc.cc */
-ulonglong find_set(TYPELIB *lib, const char *x, uint length, CHARSET_INFO *cs,
- char **err_pos, uint *err_len, bool *set_warning);
-uint find_type(const TYPELIB *lib, const char *find, uint length,
- bool part_match);
-uint find_type2(const TYPELIB *lib, const char *find, uint length,
- CHARSET_INFO *cs);
-void unhex_type2(TYPELIB *lib);
-uint check_word(TYPELIB *lib, const char *val, const char *end,
- const char **end_of_word);
-int find_string_in_array(LEX_STRING * const haystack, LEX_STRING * const needle,
- CHARSET_INFO * const cs);
-char *set_to_string(THD *thd, LEX_STRING *result, ulonglong set,
- const char *lib[]);
-char *flagset_to_string(THD *thd, LEX_STRING *result, ulonglong set,
- const char *lib[]);
-
-
-bool is_keyword(const char *name, uint len);
-
-#define MY_DB_OPT_FILE "db.opt"
-bool my_database_names_init(void);
-void my_database_names_free(void);
-bool check_db_dir_existence(const char *db_name);
-bool load_db_opt(THD *thd, const char *path, HA_CREATE_INFO *create);
-bool load_db_opt_by_name(THD *thd, const char *db_name,
- HA_CREATE_INFO *db_create_info);
-CHARSET_INFO *get_default_db_collation(THD *thd, const char *db_name);
-bool my_dbopt_init(void);
-void my_dbopt_cleanup(void);
-extern int creating_database; // How many database locks are made
-extern int creating_table; // How many mysql_create_table() are running
-
-/*
External variables
*/
-extern time_t server_start_time, flush_status_time;
-#endif /* MYSQL_SERVER */
-#if defined MYSQL_SERVER || defined INNODB_COMPATIBILITY_HOOKS
-extern uint mysql_data_home_len, mysql_real_data_home_len;
-extern const char *mysql_real_data_home_ptr;
-extern uint thread_handling;
-
-extern MYSQL_PLUGIN_IMPORT char *mysql_data_home;
-extern char server_version[SERVER_VERSION_LENGTH];
-extern MYSQL_PLUGIN_IMPORT char mysql_real_data_home[];
-extern char mysql_unpacked_real_data_home[];
-
-extern CHARSET_INFO *character_set_filesystem;
-#endif /* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */
-#ifdef MYSQL_SERVER
-extern char *opt_mysql_tmpdir, mysql_charsets_dir[];
-extern int mysql_unpacked_real_data_home_len;
-#define mysql_tmpdir (my_tmpdir(&mysql_tmpdir_list))
-extern MYSQL_PLUGIN_IMPORT MY_TMPDIR mysql_tmpdir_list;
-extern const LEX_STRING command_name[];
-
-extern LEX_STRING opt_init_connect, opt_init_slave;
-
-extern const char *first_keyword, *delayed_user, *binary_keyword;
-extern MYSQL_PLUGIN_IMPORT const char *my_localhost;
-extern MYSQL_PLUGIN_IMPORT const char **errmesg; /* Error messages */
-
-extern const char *in_left_expr_name, *in_additional_cond, *in_having_cond;
-extern const char * const TRG_EXT;
-extern const char * const TRN_EXT;
-extern Eq_creator eq_creator;
-extern Ne_creator ne_creator;
-extern Gt_creator gt_creator;
-extern Lt_creator lt_creator;
-extern Ge_creator ge_creator;
-extern Le_creator le_creator;
-extern char lc_messages_dir[FN_REFLEN];
-extern char *lc_messages_dir_ptr, *log_error_file_ptr;
-#endif /* MYSQL_SERVER */
-#if defined MYSQL_SERVER || defined INNODB_COMPATIBILITY_HOOKS
-extern MYSQL_PLUGIN_IMPORT char reg_ext[FN_EXTLEN];
-extern MYSQL_PLUGIN_IMPORT uint reg_ext_length;
-#endif /* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */
-#ifdef MYSQL_SERVER
-extern char *mysql_home_ptr, *pidfile_name_ptr;
-extern char glob_hostname[FN_REFLEN], mysql_home[FN_REFLEN];
-extern char pidfile_name[FN_REFLEN], system_time_zone[30], *opt_init_file;
-extern char log_error_file[FN_REFLEN], *opt_tc_log_file;
-extern const double log_10[309];
-extern ulonglong log_10_int[20];
-extern ulonglong keybuff_size;
-extern ulonglong thd_startup_options;
-extern ulong thread_id;
-extern ulong binlog_cache_use, binlog_cache_disk_use;
-extern ulong aborted_threads,aborted_connects;
-extern ulong delayed_insert_timeout;
-extern ulong delayed_insert_limit, delayed_queue_size;
-extern ulong delayed_insert_threads, delayed_insert_writes;
-extern ulong delayed_rows_in_use,delayed_insert_errors;
-extern ulong slave_open_temp_tables;
-extern ulong query_cache_size, query_cache_min_res_unit;
-extern ulong slow_launch_threads, slow_launch_time;
-extern ulong table_cache_size, table_def_size;
-extern MYSQL_PLUGIN_IMPORT ulong max_connections;
-extern ulong max_connect_errors, connect_timeout;
-extern my_bool slave_allow_batching;
-extern my_bool allow_slave_start;
-extern LEX_CSTRING reason_slave_blocked;
-extern ulong slave_trans_retries;
-extern uint slave_net_timeout;
-extern ulong what_to_log,flush_time;
-extern ulong query_buff_size;
-extern ulong max_prepared_stmt_count, prepared_stmt_count;
-extern ulong binlog_cache_size, open_files_limit;
-extern ulonglong max_binlog_cache_size;
-extern ulong max_binlog_size, max_relay_log_size;
-extern ulong opt_binlog_rows_event_max_size;
-extern ulong rpl_recovery_rank, thread_cache_size, thread_pool_size;
-extern ulong back_log;
-#endif /* MYSQL_SERVER */
-#if defined MYSQL_SERVER || defined INNODB_COMPATIBILITY_HOOKS
-extern MYSQL_PLUGIN_IMPORT ulong specialflag;
-#endif /* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */
-#ifdef MYSQL_SERVER
-extern ulong current_pid;
-extern ulong expire_logs_days;
-extern uint sync_binlog_period, sync_relaylog_period,
- sync_relayloginfo_period, sync_masterinfo_period;
-extern ulong opt_tc_log_size, tc_log_max_pages_used, tc_log_page_size;
-extern ulong tc_log_page_waits;
-extern my_bool relay_log_purge, opt_innodb_safe_binlog, opt_innodb;
-extern my_bool relay_log_recovery;
-extern uint test_flags,select_errors,ha_open_options;
-extern uint protocol_version, mysqld_port, dropping_tables;
-extern uint delay_key_write_options;
-#endif /* MYSQL_SERVER */
-#if defined MYSQL_SERVER || defined INNODB_COMPATIBILITY_HOOKS
-extern MYSQL_PLUGIN_IMPORT uint lower_case_table_names;
-#endif /* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */
-#ifdef MYSQL_SERVER
-extern bool opt_endinfo, using_udf_functions;
-extern my_bool locked_in_memory;
-extern bool opt_using_transactions;
-#endif /* MYSQL_SERVER */
-#if defined MYSQL_SERVER || defined INNODB_COMPATIBILITY_HOOKS
-extern MYSQL_PLUGIN_IMPORT bool mysqld_embedded;
-#endif /* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */
-#ifdef MYSQL_SERVER
-extern bool opt_large_files, server_id_supplied;
-extern bool opt_bin_log, opt_error_log;
-extern my_bool opt_log, opt_slow_log;
-extern my_bool opt_backup_history_log;
-extern my_bool opt_backup_progress_log;
-extern my_bool opt_mysql_backup;
-extern ulonglong log_output_options;
-extern ulonglong log_backup_output_options;
-extern my_bool opt_log_queries_not_using_indexes;
-extern bool opt_disable_networking, opt_skip_show_db;
-extern bool opt_ignore_builtin_innodb;
-extern my_bool opt_character_set_client_handshake;
-extern bool volatile abort_loop, shutdown_in_progress;
-extern bool in_bootstrap;
-extern uint volatile thread_count, global_read_lock;
-extern ulong thread_created;
-extern uint connection_count;
-extern my_bool opt_sql_bin_update, opt_safe_user_create, opt_no_mix_types;
-extern my_bool opt_local_infile, opt_myisam_use_mmap;
-extern my_bool opt_slave_compressed_protocol, use_temp_pool;
-extern uint slave_exec_mode_options;
-extern ulonglong slave_type_conversions_options;
-extern my_bool opt_readonly, lower_case_file_system;
-extern my_bool opt_enable_named_pipe, opt_sync_frm, opt_allow_suspicious_udfs;
-extern my_bool opt_secure_auth;
-extern char* opt_secure_file_priv;
-extern char* opt_secure_backup_file_priv;
-extern size_t opt_secure_backup_file_priv_len;
-extern my_bool opt_log_slow_admin_statements, opt_log_slow_slave_statements;
-extern my_bool sp_automatic_privileges, opt_noacl, disable_slaves;
-extern my_bool opt_old_style_user_limits, trust_function_creators;
-extern uint opt_crash_binlog_innodb;
-extern char *shared_memory_base_name, *mysqld_unix_port;
-extern my_bool opt_enable_shared_memory;
-extern char *default_tz_name;
-extern Time_zone *default_tz;
-extern char *default_storage_engine;
-#endif /* MYSQL_SERVER */
-#if defined MYSQL_SERVER || defined INNODB_COMPATIBILITY_HOOKS
-extern my_bool opt_large_pages;
-extern uint opt_large_page_size;
-#endif /* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */
-#ifdef MYSQL_SERVER
-extern char *opt_logname, *opt_slow_logname;
-extern char *opt_backup_history_logname, *opt_backup_progress_logname,
- *opt_backup_settings_name, *opt_backupdir;
-extern my_bool old_mode;
-
-extern MYSQL_PLUGIN_IMPORT MYSQL_BIN_LOG mysql_bin_log;
-extern LOGGER logger;
-extern TABLE_LIST general_log, slow_log,
- backup_history_log, backup_progress_log;
-extern MYSQL_FILE *bootstrap_file;
-extern int bootstrap_error;
-extern FILE *stderror_file;
-extern pthread_key(MEM_ROOT**,THR_MALLOC);
-extern mysql_mutex_t LOCK_mysql_create_db, LOCK_open, LOCK_lock_db,
- LOCK_mapped_file, LOCK_user_locks, LOCK_status,
- LOCK_error_log, LOCK_delayed_insert, LOCK_uuid_short,
- LOCK_delayed_status, LOCK_delayed_create, LOCK_crypt, LOCK_timezone,
- LOCK_slave_list, LOCK_active_mi, LOCK_manager, LOCK_global_read_lock,
- LOCK_global_system_variables, LOCK_user_conn, LOCK_slave_start,
- LOCK_prepared_stmt_count, LOCK_error_messages,
- LOCK_connection_count;
-extern MYSQL_PLUGIN_IMPORT mysql_mutex_t LOCK_thread_count;
-#ifdef HAVE_OPENSSL
-extern mysql_mutex_t LOCK_des_key_file;
-#endif
-extern mysql_mutex_t LOCK_server_started;
-extern mysql_cond_t COND_server_started;
-extern int mysqld_server_started;
-extern mysql_rwlock_t LOCK_grant, LOCK_sys_init_connect, LOCK_sys_init_slave;
-extern mysql_rwlock_t LOCK_system_variables_hash;
-extern mysql_cond_t COND_thread_count;
-extern mysql_cond_t COND_refresh, COND_manager;
-extern mysql_cond_t COND_global_read_lock;
-extern pthread_attr_t connection_attrib;
-extern I_List<THD> threads;
-extern MY_BITMAP temp_pool;
-extern String my_empty_string;
-extern const String my_null_string;
-extern SHOW_VAR status_vars[];
-#endif /* MYSQL_SERVER */
-#if defined MYSQL_SERVER || defined INNODB_COMPATIBILITY_HOOKS
-extern MYSQL_PLUGIN_IMPORT struct system_variables global_system_variables;
-#endif /* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */
-#ifdef MYSQL_SERVER
-extern struct system_variables max_system_variables;
-extern struct system_status_var global_status_var;
-extern struct my_rnd_struct sql_rand;
-
-extern DATE_TIME_FORMAT global_date_format, global_datetime_format, global_time_format;
-extern KNOWN_DATE_TIME_FORMAT known_date_time_formats[];
-
-extern String null_string;
-extern HASH table_def_cache, lock_db_cache;
-extern TABLE *unused_tables;
-extern uint table_cache_count;
-extern const char* any_db;
-extern const LEX_STRING view_type;
-extern scheduler_functions thread_scheduler;
-extern TYPELIB thread_handling_typelib;
-extern uint sql_command_flags[];
-extern uint server_command_flags[];
-extern TYPELIB log_output_typelib;
-extern const char *log_output_names[];
-
-/* optional things, have_* variables */
-extern SHOW_COMP_OPTION have_csv, have_innodb;
-extern SHOW_COMP_OPTION have_ndbcluster, have_partitioning;
-extern SHOW_COMP_OPTION have_profiling;
-extern handlerton *partition_hton;
-extern handlerton *myisam_hton;
-extern handlerton *maria_hton;
-extern handlerton *heap_hton;
-
-extern SHOW_COMP_OPTION have_ssl, have_symlink, have_dlopen;
-extern SHOW_COMP_OPTION have_query_cache;
-extern SHOW_COMP_OPTION have_geometry, have_rtree_keys;
-extern SHOW_COMP_OPTION have_crypt;
-extern SHOW_COMP_OPTION have_compress;
-
-extern int orig_argc;
-extern char **orig_argv;
-extern const char *load_default_groups[];
-
-#ifndef __WIN__
-extern pthread_t signal_thread;
-#endif
-
-extern char *opt_ssl_ca, *opt_ssl_capath, *opt_ssl_cert, *opt_ssl_cipher,
- *opt_ssl_key;
-
-#ifdef HAVE_OPENSSL
-extern struct st_VioSSLFd * ssl_acceptor_fd;
-#endif /* HAVE_OPENSSL */
-
-MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **table, uint count, uint flags);
-/* mysql_lock_tables() and open_table() flags bits */
-#define MYSQL_OPEN_IGNORE_GLOBAL_READ_LOCK 0x0001
-#define MYSQL_OPEN_IGNORE_FLUSH 0x0002
-#define MYSQL_OPEN_TEMPORARY_ONLY 0x0004
-#define MYSQL_LOCK_IGNORE_GLOBAL_READ_ONLY 0x0008
-#define MYSQL_LOCK_LOG_TABLE 0x0010
-#define MYSQL_OPEN_TAKE_UPGRADABLE_MDL 0x0020
-/**
- Do not try to acquire a metadata lock on the table: we
- already have one.
-*/
-#define MYSQL_OPEN_HAS_MDL_LOCK 0x0040
-/**
- If in locked tables mode, ignore the locked tables and get
- a new instance of the table.
-*/
-#define MYSQL_OPEN_GET_NEW_TABLE 0x0080
-/** Don't look up the table in the list of temporary tables. */
-#define MYSQL_OPEN_SKIP_TEMPORARY 0x0100
-/** Fail instead of waiting when conficting metadata lock is discovered. */
-#define MYSQL_OPEN_FAIL_ON_MDL_CONFLICT 0x0200
-/** Open tables using MDL_SHARED lock instead of one specified in parser. */
-#define MYSQL_OPEN_FORCE_SHARED_MDL 0x0400
-/**
- Open tables using MDL_SHARED_HIGH_PRIO lock instead of one specified
- in parser.
-*/
-#define MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL 0x0800
-/**
- When opening or locking the table, use the maximum timeout
- (LONG_TIMEOUT = 1 year) rather than the user-supplied timeout value.
-*/
-#define MYSQL_LOCK_IGNORE_TIMEOUT 0x1000
-
-/** Please refer to the internals manual. */
-#define MYSQL_OPEN_REOPEN (MYSQL_OPEN_IGNORE_FLUSH |\
- MYSQL_OPEN_IGNORE_GLOBAL_READ_LOCK |\
- MYSQL_LOCK_IGNORE_GLOBAL_READ_ONLY |\
- MYSQL_LOCK_IGNORE_TIMEOUT |\
- MYSQL_OPEN_GET_NEW_TABLE |\
- MYSQL_OPEN_SKIP_TEMPORARY |\
- MYSQL_OPEN_HAS_MDL_LOCK)
-
-void mysql_unlock_tables(THD *thd, MYSQL_LOCK *sql_lock);
-void mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock);
-void mysql_unlock_some_tables(THD *thd, TABLE **table,uint count);
-void mysql_lock_remove(THD *thd, MYSQL_LOCK *locked,TABLE *table);
-void mysql_lock_abort(THD *thd, TABLE *table, bool upgrade_lock);
-void mysql_lock_downgrade_write(THD *thd, TABLE *table,
- thr_lock_type new_lock_type);
-bool mysql_lock_abort_for_thread(THD *thd, TABLE *table);
-MYSQL_LOCK *mysql_lock_merge(MYSQL_LOCK *a,MYSQL_LOCK *b);
-TABLE_LIST *mysql_lock_have_duplicate(THD *thd, TABLE_LIST *needle,
- TABLE_LIST *haystack);
-void broadcast_refresh(void);
-int try_transactional_lock(THD *thd, TABLE_LIST *table_list);
-int check_transactional_lock(THD *thd, TABLE_LIST *table_list);
-int set_handler_table_locks(THD *thd, TABLE_LIST *table_list,
- bool transactional);
-
-/* Lock based on name */
-bool lock_table_names(THD *thd, TABLE_LIST *table_list);
-void unlock_table_names(THD *thd);
-
-/* Lock based on stored routine name */
-bool lock_routine_name(THD *thd, bool is_function, const char *db,
- const char *name);
-
-/* old unireg functions */
-
-void unireg_init(ulong options);
-void unireg_end(void) __attribute__((noreturn));
-bool mysql_create_frm(THD *thd, const char *file_name,
- const char *db, const char *table,
- HA_CREATE_INFO *create_info,
- List<Create_field> &create_field,
- uint key_count,KEY *key_info,handler *db_type);
-int rea_create_table(THD *thd, const char *path,
- const char *db, const char *table_name,
- HA_CREATE_INFO *create_info,
- List<Create_field> &create_field,
- uint key_count,KEY *key_info,
- handler *file);
-int format_number(uint inputflag,uint max_length,char * pos,uint length,
- char * *errpos);
-
-/* table.cc */
-TABLE_SHARE *alloc_table_share(TABLE_LIST *table_list, char *key,
- uint key_length);
-void init_tmp_table_share(THD *thd, TABLE_SHARE *share, const char *key,
- uint key_length,
- const char *table_name, const char *path);
-void free_table_share(TABLE_SHARE *share);
-int open_table_def(THD *thd, TABLE_SHARE *share, uint db_flags);
-void open_table_error(TABLE_SHARE *share, int error, int db_errno, int errarg);
-int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias,
- uint db_stat, uint prgflag, uint ha_open_flags,
- TABLE *outparam, open_table_mode open_mode);
-int readfrm(const char *name, uchar **data, size_t *length);
-int writefrm(const char* name, const uchar* data, size_t len);
-int closefrm(TABLE *table, bool free_share);
-int read_string(File file, uchar* *to, size_t length);
-void free_blobs(TABLE *table);
-void free_field_buffers_larger_than(TABLE *table, uint32 size);
-int set_zone(int nr,int min_zone,int max_zone);
-ulong convert_period_to_month(ulong period);
-ulong convert_month_to_period(ulong month);
-void get_date_from_daynr(long daynr,uint *year, uint *month,
- uint *day);
-my_time_t TIME_to_timestamp(THD *thd, const MYSQL_TIME *t, my_bool *not_exist);
-/* Character set-aware version of str_to_time() */
-bool str_to_time(CHARSET_INFO *cs, const char *str,uint length,
- MYSQL_TIME *l_time, int *warning);
-/* Character set-aware version of str_to_datetime() */
-timestamp_type str_to_datetime(CHARSET_INFO *cs,
- const char *str, uint length,
- MYSQL_TIME *l_time, uint flags, int *was_cut);
-bool str_to_time_with_warn(CHARSET_INFO *cs, const char *str,uint length,
- MYSQL_TIME *l_time);
-timestamp_type str_to_datetime_with_warn(CHARSET_INFO *cs,
- const char *str, uint length,
- MYSQL_TIME *l_time, uint flags);
-void localtime_to_TIME(MYSQL_TIME *to, struct tm *from);
-void calc_time_from_sec(MYSQL_TIME *to, long seconds, long microseconds);
-
-void make_truncated_value_warning(THD *thd, MYSQL_ERROR::enum_warning_level level,
- const char *str_val,
- uint str_length, timestamp_type time_type,
- const char *field_name);
-
-bool date_add_interval(MYSQL_TIME *ltime, interval_type int_type, INTERVAL interval);
-bool calc_time_diff(MYSQL_TIME *l_time1, MYSQL_TIME *l_time2, int l_sign,
- longlong *seconds_out, long *microseconds_out);
-
-extern LEX_STRING interval_type_to_name[];
-
-
-bool parse_date_time_format(timestamp_type format_type,
- const char *format, uint format_length,
- DATE_TIME_FORMAT *date_time_format);
-/* convenience wrapper */
-inline bool parse_date_time_format(timestamp_type format_type,
- DATE_TIME_FORMAT *date_time_format)
-{
- return parse_date_time_format(format_type,
- date_time_format->format.str,
- date_time_format->format.length,
- date_time_format);
-}
-
-extern DATE_TIME_FORMAT *date_time_format_make(timestamp_type format_type,
- const char *format_str,
- uint format_length);
-extern DATE_TIME_FORMAT *date_time_format_copy(THD *thd,
- DATE_TIME_FORMAT *format);
-const char *get_date_time_format_str(KNOWN_DATE_TIME_FORMAT *format,
- timestamp_type type);
-extern bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time,
- timestamp_type type, String *str);
-void make_datetime(const DATE_TIME_FORMAT *format, const MYSQL_TIME *l_time,
- String *str);
-void make_date(const DATE_TIME_FORMAT *format, const MYSQL_TIME *l_time,
- String *str);
-void make_time(const DATE_TIME_FORMAT *format, const MYSQL_TIME *l_time,
- String *str);
-int my_time_compare(MYSQL_TIME *a, MYSQL_TIME *b);
-longlong get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg,
- Item *warn_item, bool *is_null);
-
-int test_if_number(char *str,int *res,bool allow_wildcards);
-void change_byte(uchar *,uint,char,char);
-void init_read_record(READ_RECORD *info, THD *thd, TABLE *reg_form,
- SQL_SELECT *select, int use_record_cache,
- bool print_errors, bool disable_rr_cache);
-void init_read_record_idx(READ_RECORD *info, THD *thd, TABLE *table,
- bool print_error, uint idx);
-void end_read_record(READ_RECORD *info);
-ha_rows filesort(THD *thd, TABLE *form,struct st_sort_field *sortorder,
- uint s_length, SQL_SELECT *select,
- ha_rows max_rows, bool sort_positions,
- ha_rows *examined_rows);
-void filesort_free_buffers(TABLE *table, bool full);
-void change_double_for_sort(double nr,uchar *to);
-double my_double_round(double value, longlong dec, bool dec_unsigned,
- bool truncate);
-int get_quick_record(SQL_SELECT *select);
-
-int calc_weekday(long daynr,bool sunday_first_day_of_week);
-uint calc_week(MYSQL_TIME *l_time, uint week_behaviour, uint *year);
-void find_date(char *pos,uint *vek,uint flag);
-TYPELIB *convert_strings_to_array_type(char * *typelibs, char * *end);
-TYPELIB *typelib(MEM_ROOT *mem_root, List<String> &strings);
-ulong get_form_pos(File file, uchar *head, TYPELIB *save_names);
-ulong make_new_entry(File file,uchar *fileinfo,TYPELIB *formnames,
- const char *newname);
-ulong next_io_size(ulong pos);
-void append_unescaped(String *res, const char *pos, uint length);
-int create_frm(THD *thd, const char *name, const char *db, const char *table,
- uint reclength, uchar *fileinfo,
- HA_CREATE_INFO *create_info, uint keys, KEY *key_info);
-void update_create_info_from_table(HA_CREATE_INFO *info, TABLE *form);
-int rename_file_ext(const char * from,const char * to,const char * ext);
-bool check_and_convert_db_name(LEX_STRING *db, bool preserve_lettercase);
-bool check_column_name(const char *name);
-bool check_table_name(const char *name, uint length);
-char *get_field(MEM_ROOT *mem, Field *field);
-bool get_field(MEM_ROOT *mem, Field *field, class String *res);
-int wild_case_compare(CHARSET_INFO *cs, const char *str,const char *wildstr);
-char *fn_rext(char *name);
-bool check_duplicate_warning(THD *thd, char *msg, ulong length);
-
-/* Conversion functions */
-#endif /* MYSQL_SERVER */
-#if defined MYSQL_SERVER || defined INNODB_COMPATIBILITY_HOOKS
-uint strconvert(CHARSET_INFO *from_cs, const char *from,
- CHARSET_INFO *to_cs, char *to, uint to_length, uint *errors);
-/* depends on errmsg.txt Database `db`, Table `t` ... */
-#define EXPLAIN_FILENAME_MAX_EXTRA_LENGTH 63
-enum enum_explain_filename_mode
-{
- EXPLAIN_ALL_VERBOSE= 0,
- EXPLAIN_PARTITIONS_VERBOSE,
- EXPLAIN_PARTITIONS_AS_COMMENT
-};
-uint explain_filename(THD* thd, const char *from, char *to, uint to_length,
- enum_explain_filename_mode explain_mode);
-uint filename_to_tablename(const char *from, char *to, uint to_length);
-uint tablename_to_filename(const char *from, char *to, uint to_length);
-uint check_n_cut_mysql50_prefix(const char *from, char *to, uint to_length);
-#endif /* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */
-#ifdef MYSQL_SERVER
-uint build_table_filename(char *buff, size_t bufflen, const char *db,
- const char *table, const char *ext, uint flags);
-const char *get_canonical_filename(handler *file, const char *path,
- char *tmp_path);
-
-#define MYSQL50_TABLE_NAME_PREFIX "#mysql50#"
-#define MYSQL50_TABLE_NAME_PREFIX_LENGTH 9
-
-uint build_table_shadow_filename(char *buff, size_t bufflen,
- ALTER_PARTITION_PARAM_TYPE *lpt);
-/* Flags for conversion functions. */
-#define FN_FROM_IS_TMP (1 << 0)
-#define FN_TO_IS_TMP (1 << 1)
-#define FN_IS_TMP (FN_FROM_IS_TMP | FN_TO_IS_TMP)
-#define NO_FRM_RENAME (1 << 2)
-#define FRM_ONLY (1 << 3)
-
-/* from hostname.cc */
-bool ip_to_hostname(struct sockaddr_storage *ip_storage,
- const char *ip_string,
- char **hostname, uint *connect_errors);
-void inc_host_errors(const char *ip_string);
-void reset_host_errors(const char *ip_string);
-bool hostname_cache_init();
-void hostname_cache_free();
-void hostname_cache_refresh(void);
-
-/* sql_cache.cc */
-extern bool sql_cache_init();
-extern void sql_cache_free();
-extern int sql_cache_hit(THD *thd, char *inBuf, uint length);
-
-/* item_func.cc */
-Item *get_system_var(THD *thd, enum_var_type var_type, LEX_STRING name,
- LEX_STRING component);
-int get_var_with_binlog(THD *thd, enum_sql_command sql_command,
- LEX_STRING &name, user_var_entry **out_entry);
-/* log.cc */
-bool flush_error_log(void);
-
-/* sql_list.cc */
-void free_list(I_List <i_string_pair> *list);
-void free_list(I_List <i_string> *list);
-
/* sql_yacc.cc */
#ifndef DBUG_OFF
extern void turn_parser_debug_on();
-#endif
-/* frm_crypt.cc */
-#ifdef HAVE_CRYPTED_FRM
-SQL_CRYPT *get_crypt_for_frm(void);
#endif
-/* password.c */
-extern "C" void my_make_scrambled_password_323(char *to, const char *password,
- size_t pass_len);
-extern "C" void my_make_scrambled_password(char *to, const char *password,
- size_t pass_len);
-
-#include "sql_view.h"
-
-/* Some inline functions for more speed */
-
-inline bool add_item_to_list(THD *thd, Item *item)
-{
- return thd->lex->current_select->add_item_to_list(thd, item);
-}
-
-inline bool add_value_to_list(THD *thd, Item *value)
-{
- return thd->lex->value_list.push_back(value);
-}
-
-inline bool add_order_to_list(THD *thd, Item *item, bool asc)
-{
- return thd->lex->current_select->add_order_to_list(thd, item, asc);
-}
-
-inline bool add_group_to_list(THD *thd, Item *item, bool asc)
-{
- return thd->lex->current_select->add_group_to_list(thd, item, asc);
-}
-
-inline void mark_as_null_row(TABLE *table)
-{
- table->null_row=1;
- table->status|=STATUS_NULL_ROW;
- bfill(table->null_flags,table->s->null_bytes,255);
-}
-
-inline void table_case_convert(char * name, uint length)
-{
- if (lower_case_table_names)
- files_charset_info->cset->casedn(files_charset_info,
- name, length, name, length);
-}
-
-inline const char *table_case_name(HA_CREATE_INFO *info, const char *name)
-{
- return ((lower_case_table_names == 2 && info->alias) ? info->alias : name);
-}
-
-inline ulong sql_rnd_with_mutex()
-{
- mysql_mutex_lock(&LOCK_thread_count);
- ulong tmp=(ulong) (my_rnd(&sql_rand) * 0xffffffff); /* make all bits random */
- mysql_mutex_unlock(&LOCK_thread_count);
- return tmp;
-}
-
-Comp_creator *comp_eq_creator(bool invert);
-Comp_creator *comp_ge_creator(bool invert);
-Comp_creator *comp_gt_creator(bool invert);
-Comp_creator *comp_le_creator(bool invert);
-Comp_creator *comp_lt_creator(bool invert);
-Comp_creator *comp_ne_creator(bool invert);
-
-Item * all_any_subquery_creator(Item *left_expr,
- chooser_compare_func_creator cmp,
- bool all,
- SELECT_LEX *select_lex);
-
-/**
- clean/setup table fields and map.
-
- @param table TABLE structure pointer (which should be setup)
- @param table_list TABLE_LIST structure pointer (owner of TABLE)
- @param tablenr table number
-*/
-
-
-inline void setup_table_map(TABLE *table, TABLE_LIST *table_list, uint tablenr)
-{
- table->used_fields= 0;
- table->const_table= 0;
- table->null_row= 0;
- table->status= STATUS_NO_RECORD;
- table->maybe_null= table_list->outer_join;
- TABLE_LIST *embedding= table_list->embedding;
- while (!table->maybe_null && embedding)
- {
- table->maybe_null= embedding->outer_join;
- embedding= embedding->embedding;
- }
- table->tablenr= tablenr;
- table->map= (table_map) 1 << tablenr;
- table->force_index= table_list->force_index;
- table->force_index_order= 0;
- table->force_index_group= 0;
- table->covering_keys= table->s->keys_for_keyread;
- table->merge_keys.clear_all();
-}
-
-
/**
convert a hex digit into number.
*/
@@ -2594,16 +266,6 @@ inline int hexchar_to_int(char c)
return -1;
}
-/**
- return true if the table was created explicitly.
-*/
-inline bool is_user_table(TABLE * table)
-{
- const char *name= table->s->table_name.str;
- return strncmp(name, tmp_file_prefix, tmp_file_prefix_length);
-}
-
-
#ifndef HAVE_LOG2
/*
This will be slightly slower and perhaps a tiny bit less accurate than
@@ -2615,225 +277,11 @@ inline double log2(double x)
}
#endif
-
-/*
- Some functions that are different in the embedded library and the normal
- server
-*/
-
-#ifndef EMBEDDED_LIBRARY
-extern "C" void unireg_abort(int exit_code) __attribute__((noreturn));
-void kill_delayed_threads(void);
-#else
-extern "C" void unireg_clear(int exit_code);
-#define unireg_abort(exit_code) do { unireg_clear(exit_code); DBUG_RETURN(exit_code); } while(0)
-inline void kill_delayed_threads(void) {}
-#endif
-
-bool check_stack_overrun(THD *thd, long margin, uchar *dummy);
-
/* This must match the path length limit in the ER_NOT_RW_DIR error msg. */
#define ER_NOT_RW_DIR_PATHSIZE 200
-bool is_usable_directory(THD *thd, const char *varname,
- const char *path, const char *prefix);
-
-/* Used by handlers to store things in schema tables */
-#define IS_FILES_FILE_ID 0
-#define IS_FILES_FILE_NAME 1
-#define IS_FILES_FILE_TYPE 2
-#define IS_FILES_TABLESPACE_NAME 3
-#define IS_FILES_TABLE_CATALOG 4
-#define IS_FILES_TABLE_SCHEMA 5
-#define IS_FILES_TABLE_NAME 6
-#define IS_FILES_LOGFILE_GROUP_NAME 7
-#define IS_FILES_LOGFILE_GROUP_NUMBER 8
-#define IS_FILES_ENGINE 9
-#define IS_FILES_FULLTEXT_KEYS 10
-#define IS_FILES_DELETED_ROWS 11
-#define IS_FILES_UPDATE_COUNT 12
-#define IS_FILES_FREE_EXTENTS 13
-#define IS_FILES_TOTAL_EXTENTS 14
-#define IS_FILES_EXTENT_SIZE 15
-#define IS_FILES_INITIAL_SIZE 16
-#define IS_FILES_MAXIMUM_SIZE 17
-#define IS_FILES_AUTOEXTEND_SIZE 18
-#define IS_FILES_CREATION_TIME 19
-#define IS_FILES_LAST_UPDATE_TIME 20
-#define IS_FILES_LAST_ACCESS_TIME 21
-#define IS_FILES_RECOVER_TIME 22
-#define IS_FILES_TRANSACTION_COUNTER 23
-#define IS_FILES_VERSION 24
-#define IS_FILES_ROW_FORMAT 25
-#define IS_FILES_TABLE_ROWS 26
-#define IS_FILES_AVG_ROW_LENGTH 27
-#define IS_FILES_DATA_LENGTH 28
-#define IS_FILES_MAX_DATA_LENGTH 29
-#define IS_FILES_INDEX_LENGTH 30
-#define IS_FILES_DATA_FREE 31
-#define IS_FILES_CREATE_TIME 32
-#define IS_FILES_UPDATE_TIME 33
-#define IS_FILES_CHECK_TIME 34
-#define IS_FILES_CHECKSUM 35
-#define IS_FILES_STATUS 36
-#define IS_FILES_EXTRA 37
-
-#define IS_TABLESPACES_TABLESPACE_NAME 0
-#define IS_TABLESPACES_ENGINE 1
-#define IS_TABLESPACES_TABLESPACE_TYPE 2
-#define IS_TABLESPACES_LOGFILE_GROUP_NAME 3
-#define IS_TABLESPACES_EXTENT_SIZE 4
-#define IS_TABLESPACES_AUTOEXTEND_SIZE 5
-#define IS_TABLESPACES_MAXIMUM_SIZE 6
-#define IS_TABLESPACES_NODEGROUP_ID 7
-#define IS_TABLESPACES_TABLESPACE_COMMENT 8
-
-void init_fill_schema_files_row(TABLE* table);
-bool schema_table_store_record(THD *thd, TABLE *table);
-
-/* sql/item_create.cc */
-int item_create_init();
-void item_create_cleanup();
-
-bool show_create_trigger(THD *thd, const sp_name *trg_name);
-
-inline void lex_string_set(LEX_STRING *lex_str, const char *c_str)
-{
- lex_str->str= (char *) c_str;
- lex_str->length= strlen(c_str);
-}
-
-bool load_charset(MEM_ROOT *mem_root,
- Field *field,
- CHARSET_INFO *dflt_cs,
- CHARSET_INFO **cs);
-
-bool load_collation(MEM_ROOT *mem_root,
- Field *field,
- CHARSET_INFO *dflt_cl,
- CHARSET_INFO **cl);
-
-#define LONG_TIMEOUT ((ulong) 3600L*24L*365L)
-
-/**
- only options that need special treatment in get_one_option() deserve
- to be listed below
-*/
-enum options_mysqld
-{
- OPT_to_set_the_start_number=256,
- OPT_BIND_ADDRESS,
- OPT_BINLOG_DO_DB,
- OPT_BINLOG_FORMAT,
- OPT_BINLOG_IGNORE_DB,
- OPT_BIN_LOG,
- OPT_BOOTSTRAP,
- OPT_CONSOLE,
- OPT_DEBUG_SYNC_TIMEOUT,
- OPT_ISAM_LOG,
- OPT_KEY_BUFFER_SIZE,
- OPT_KEY_CACHE_AGE_THRESHOLD,
- OPT_KEY_CACHE_BLOCK_SIZE,
- OPT_KEY_CACHE_DIVISION_LIMIT,
- OPT_LOWER_CASE_TABLE_NAMES,
- OPT_ONE_THREAD,
- OPT_POOL_OF_THREADS,
- OPT_REPLICATE_DO_DB,
- OPT_REPLICATE_DO_TABLE,
- OPT_REPLICATE_IGNORE_DB,
- OPT_REPLICATE_IGNORE_TABLE,
- OPT_REPLICATE_REWRITE_DB,
- OPT_REPLICATE_WILD_DO_TABLE,
- OPT_REPLICATE_WILD_IGNORE_TABLE,
- OPT_SAFE,
- OPT_SERVER_ID,
- OPT_SKIP_HOST_CACHE,
- OPT_SKIP_NEW,
- OPT_SKIP_PRIOR,
- OPT_SKIP_RESOLVE,
- OPT_SKIP_STACK_TRACE,
- OPT_SLOW_QUERY_LOG,
- OPT_SSL_CA,
- OPT_SSL_CAPATH,
- OPT_SSL_CERT,
- OPT_SSL_CIPHER,
- OPT_SSL_KEY,
- OPT_WANT_CORE,
- OPT_ENGINE_CONDITION_PUSHDOWN,
- OPT_LOG_ERROR
-};
#endif /* MYSQL_SERVER */
-extern "C" int test_if_data_home_dir(const char *dir);
#endif /* MYSQL_CLIENT */
-#ifdef MYSQL_SERVER
-#ifdef HAVE_PSI_INTERFACE
-#ifdef HAVE_MMAP
-extern PSI_mutex_key key_PAGE_lock, key_LOCK_sync, key_LOCK_active,
- key_LOCK_pool;
-#endif /* HAVE_MMAP */
-
-#ifdef HAVE_OPENSSL
-extern PSI_mutex_key key_LOCK_des_key_file;
-#endif
-
-extern PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_prep_xids,
- key_delayed_insert_mutex, key_hash_filo_lock, key_LOCK_active_mi,
- 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_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,
- key_LOCK_user_conn, key_LOCK_uuid_short, key_LOG_LOCK_log,
- key_mutex_rpl_info_data_lock, key_mutex_rpl_info_run_lock,
- key_mutex_slave_reporting_capability_err_lock, key_relay_log_info_data_lock,
- key_relay_log_info_log_space_lock, key_relay_log_info_run_lock,
- key_structure_guard_mutex, key_TABLE_SHARE_LOCK_ha_data,
- key_LOCK_error_messages, key_HA_DATA_PARTITION_mutex,
- key_LOCK_thread_count;
-
-extern PSI_rwlock_key key_rwlock_LOCK_grant, key_rwlock_LOCK_logger,
- key_rwlock_LOCK_sys_init_connect, key_rwlock_LOCK_sys_init_slave,
- key_rwlock_LOCK_system_variables_hash, key_rwlock_query_cache_query_lock;
-
-#ifdef HAVE_MMAP
-extern PSI_cond_key key_PAGE_cond, key_COND_active, key_COND_pool;
-#endif /* HAVE_MMAP */
-
-extern PSI_cond_key key_BINLOG_COND_prep_xids, key_BINLOG_update_cond,
- key_COND_cache_status_changed, key_COND_global_read_lock, key_COND_manager,
- key_COND_refresh, key_COND_rpl_status, key_COND_server_started,
- key_delayed_insert_cond, key_delayed_insert_cond_client,
- key_item_func_sleep_cond, key_cond_rpl_info_data_cond,
- key_cond_rpl_info_start_cond, key_cond_rpl_info_stop_cond,
- key_relay_log_info_data_cond, key_relay_log_info_log_space_cond,
- key_relay_log_info_start_cond, key_relay_log_info_stop_cond,
- key_user_level_lock_cond,
- key_COND_thread_count, key_COND_thread_cache, key_COND_flush_thread_cache;
-
-
-extern PSI_thread_key key_thread_bootstrap, key_thread_delayed_insert,
- key_thread_handle_manager, key_thread_kill_server, key_thread_main,
- key_thread_one_connection, key_thread_signal_hand;
-
-#ifdef HAVE_MMAP
-extern PSI_file_key key_file_map;
-#endif /* HAVE_MMAP */
-
-extern PSI_file_key key_file_binlog, key_file_binlog_index, key_file_casetest,
- key_file_dbopt, key_file_des_key_file, key_file_ERRMSG, key_select_to_file,
- key_file_fileparser, key_file_frm, key_file_global_ddl_log, key_file_load,
- key_file_loadfile, key_file_log_event_data, key_file_log_event_info,
- key_file_master_info, key_file_misc, key_file_MYSQL_LOG, key_file_partition,
- key_file_pid, key_file_relay_log_info, key_file_send_file, key_file_tclog,
- key_file_trg, key_file_trn, key_file_init;
-
-void init_server_psi_keys();
-#endif /* HAVE_PSI_INTERFACE */
-#endif /* MYSQL_SERVER */
-
-
#endif /* MYSQL_PRIV_H */
=== modified file 'sql/sql_profile.cc'
--- a/sql/sql_profile.cc 2010-03-25 09:02:07 +0000
+++ b/sql/sql_profile.cc 2010-04-09 08:22:10 +0000
@@ -29,8 +29,13 @@
*/
-#include "mysql_priv.h"
+#include "my_global.h" // REQUIRED by m_string.h
+#include "sql_priv.h"
+#include "unireg.h" // REQUIRED: for other includes
+#include "sql_profile.h"
#include "my_sys.h"
+#include "sql_show.h" // schema_table_store_record
+#include "sql_class.h" // THD
#define TIME_FLOAT_DIGITS 9
/** two vals encoded: (dec*100)+len */
=== modified file 'sql/sql_profile.h'
--- a/sql/sql_profile.h 2010-02-15 11:58:01 +0000
+++ b/sql/sql_profile.h 2010-04-12 13:18:53 +0000
@@ -16,6 +16,12 @@
#ifndef _SQL_PROFILE_H
#define _SQL_PROFILE_H
+class Item;
+struct TABLE_LIST;
+class THD;
+typedef struct st_field_info ST_FIELD_INFO;
+typedef struct st_schema_table ST_SCHEMA_TABLE;
+
extern ST_FIELD_INFO query_profile_statistics_info[];
int fill_query_profile_statistics_info(THD *thd, TABLE_LIST *tables, Item *cond);
int make_profile_table_for_show(THD *thd, ST_SCHEMA_TABLE *schema_table);
@@ -34,7 +40,9 @@ int make_profile_table_for_show(THD *thd
#if defined(ENABLED_PROFILING)
-#include "mysql_priv.h"
+#include "my_global.h" // REQUIRED by m_string.h
+#include "sql_priv.h"
+#include "unireg.h"
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
=== modified file 'sql/sql_rename.cc'
--- a/sql/sql_rename.cc 2010-02-17 21:07:50 +0000
+++ b/sql/sql_rename.cc 2010-04-09 08:22:10 +0000
@@ -17,9 +17,19 @@
Atomic rename of table; RENAME TABLE t1 to t2, tmp to t1 [,...]
*/
-#include "mysql_priv.h"
+#include "my_global.h" // REQUIRED by m_string.h
+#include "sql_priv.h"
+#include "unireg.h"
+#include "sql_rename.h"
+#include "sql_cache.h" // query_cache_*
+#include "sql_table.h" // build_table_filename
+#include "sql_view.h" // mysql_frm_type, mysql_rename_view
#include "sql_trigger.h"
-
+#include "lock.h" // wait_if_global_read_lock, lock_table_names,
+ // unlock_table_names,
+ // start_waiting_global_read_lock
+#include "sql_base.h" // tdc_remove_table
+#include "sql_handler.h" // mysql_ha_rm_tables
static TABLE_LIST *rename_tables(THD *thd, TABLE_LIST *table_list,
bool skip_error);
=== added file 'sql/sql_rename.h'
--- a/sql/sql_rename.h 1970-01-01 00:00:00 +0000
+++ b/sql/sql_rename.h 2010-03-31 14:05:33 +0000
@@ -0,0 +1,27 @@
+/* Copyright 2006-2008 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef SQL_RENAME_INCLUDED
+#define SQL_RENAME_INCLUDED
+
+class THD;
+struct TABLE_LIST;
+
+bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent);
+bool do_rename(THD *thd, TABLE_LIST *ren_table, char *new_db,
+ char *new_table_name, char *new_table_alias,
+ bool skip_error);
+
+#endif /* SQL_RENAME_INCLUDED */
=== modified file 'sql/sql_repl.cc'
--- a/sql/sql_repl.cc 2010-03-25 09:02:07 +0000
+++ b/sql/sql_repl.cc 2010-04-09 08:22:10 +0000
@@ -13,11 +13,15 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "mysql_priv.h"
+#include "my_global.h" // REQUIRED by m_string.h
+#include "sql_priv.h"
+#include "unireg.h"
+#include "sql_parse.h" // check_access
#ifdef HAVE_REPLICATION
#include "rpl_mi.h"
#include "sql_repl.h"
+#include "sql_acl.h" // SUPER_ACL
#include "log_event.h"
#include "rpl_filter.h"
#include <my_dir.h>
=== modified file 'sql/sql_repl.h'
--- a/sql/sql_repl.h 2009-10-26 14:02:26 +0000
+++ b/sql/sql_repl.h 2010-04-08 10:50:40 +0000
@@ -67,6 +67,7 @@ typedef struct st_load_file_info
int log_loaded_block(IO_CACHE *, const uchar *, uint, my_off_t);
int init_replication_sys_vars();
+void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos, ushort flags);
#endif /* HAVE_REPLICATION */
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc 2010-03-25 09:02:07 +0000
+++ b/sql/sql_select.cc 2010-04-09 08:22:10 +0000
@@ -28,17 +28,35 @@
#pragma implementation // gcc: Class implementation
#endif
-#include "mysql_priv.h"
+#include "my_global.h" // REQUIRED by m_string.h
+#include "sql_priv.h"
+#include "unireg.h"
#include "sql_select.h"
+#include "sql_cache.h" // query_cache_*
+#include "sql_table.h" // primary_key_name
#include "sql_cursor.h"
#include "probes_mysql.h"
-
+#include "key.h" // key_copy, key_cmp, key_cmp_if_same
+#include "lock.h" // mysql_unlock_some_tables,
+ // mysql_unlock_read_tables
+#include "sql_show.h" // append_identifier
+#include "sql_base.h" // setup_wild, setup_fields, fill_record
+#include "sql_parse.h" // check_stack_overrun
+#include "sql_partition.h" // make_used_partitions_str
+#include "sql_acl.h" // *_ACL
+#include "sql_test.h" // print_where, print_keyuse_array,
+ // print_sjm, print_plan
+#include "records.h" // init_read_record, end_read_record
+#include "filesort.h" // filesort_free_buffers
+#include "sql_union.h" // mysql_union
#include <m_ctype.h>
#include <my_bit.h>
#include <hash.h>
#include <ft_global.h>
#define TMP_ENGINE_HTON myisam_hton
+#define PREV_BITS(type,A) ((type) (((type) 1 << (A)) -1))
+
const char *join_type_str[]={ "UNKNOWN","system","const","eq_ref","ref",
"MAYBE_REF","ALL","range","index","fulltext",
"ref_or_null","unique_subquery","index_subquery",
=== modified file 'sql/sql_select.h'
--- a/sql/sql_select.h 2010-03-23 09:14:15 +0000
+++ b/sql/sql_select.h 2010-04-08 10:50:40 +0000
@@ -29,6 +29,10 @@
#endif
#include "procedure.h"
+#include <myisam.h>
+#include "sql_array.h" /* Array */
+#include "records.h" /* READ_RECORD */
+#include "opt_range.h" /* SQL_SELECT, QUICK_SELECT_I */
/* Values in optimize */
#define KEY_OPTIMIZE_EXISTS 1
@@ -2030,5 +2034,50 @@ int test_if_item_cache_changed(List<Cach
void calc_used_field_length(THD *thd, JOIN_TAB *join_tab);
int join_init_read_record(JOIN_TAB *tab);
int do_sj_dups_weedout(THD *thd, SJ_TMP_TABLE *sjtbl);
+int get_quick_record(SQL_SELECT *select);
+SORT_FIELD * make_unireg_sortorder(ORDER *order, uint *length,
+ SORT_FIELD *sortorder);
+int setup_order(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
+ List<Item> &fields, List <Item> &all_fields, ORDER *order);
+int setup_group(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
+ List<Item> &fields, List<Item> &all_fields, ORDER *order,
+ bool *hidden_group_fields);
+bool fix_inner_refs(THD *thd, List<Item> &all_fields, SELECT_LEX *select,
+ Item **ref_pointer_array, ORDER *group_list= NULL);
+
+bool handle_select(THD *thd, LEX *lex, select_result *result,
+ ulong setup_tables_done_option);
+bool mysql_select(THD *thd, Item ***rref_pointer_array,
+ TABLE_LIST *tables, uint wild_num, List<Item> &list,
+ COND *conds, uint og_num, ORDER *order, ORDER *group,
+ Item *having, ORDER *proc_param, ulonglong select_type,
+ select_result *result, SELECT_LEX_UNIT *unit,
+ SELECT_LEX *select_lex);
+void free_underlaid_joins(THD *thd, SELECT_LEX *select);
+bool mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit,
+ select_result *result);
+Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
+ Item ***copy_func, Field **from_field,
+ Field **def_field,
+ bool group, bool modify_item,
+ bool table_cant_handle_bit_fields,
+ bool make_copy_field,
+ uint convert_blob_length);
+
+/*
+ General routine to change field->ptr of a NULL-terminated array of Field
+ objects. Useful when needed to call val_int, val_str or similar and the
+ field data is not in table->record[0] but in some other structure.
+ set_key_field_ptr changes all fields of an index using a key_info object.
+ All methods presume that there is at least one field to change.
+*/
+
+TABLE *create_virtual_tmp_table(THD *thd, List<Create_field> &field_list);
+
+
+inline bool optimizer_flag(THD *thd, uint flag)
+{
+ return (thd->variables.optimizer_switch & flag);
+}
#endif /* SQL_SELECT_INCLUDED */
=== modified file 'sql/sql_servers.cc'
--- a/sql/sql_servers.cc 2010-02-26 14:25:52 +0000
+++ b/sql/sql_servers.cc 2010-04-09 08:22:10 +0000
@@ -33,13 +33,19 @@
currently running transactions etc will not be disrupted.
*/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "sql_servers.h"
+#include "unireg.h"
+#include "sql_base.h" // close_thread_tables
+#include "records.h" // init_read_record, end_read_record
#include "hash_filo.h"
#include <m_ctype.h>
#include <stdarg.h>
#include "sp_head.h"
#include "sp.h"
#include "transaction.h"
+#include "lock.h" // MYSQL_LOCK_IGNORE_TIMEOUT
/*
We only use 1 mutex to guard the data structures - THR_LOCK_servers.
=== modified file 'sql/sql_servers.h'
--- a/sql/sql_servers.h 2009-10-26 14:02:26 +0000
+++ b/sql/sql_servers.h 2010-04-08 10:50:40 +0000
@@ -16,8 +16,13 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+#include "my_global.h" /* uint */
#include "slave.h" // for tables_ok(), rpl_filter
+class THD;
+typedef struct st_lex_server_options LEX_SERVER_OPTIONS;
+typedef struct st_mem_root MEM_ROOT;
+
/* structs */
typedef struct st_federated_server
{
=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc 2010-03-23 09:14:15 +0000
+++ b/sql/sql_show.cc 2010-04-10 09:11:47 +0000
@@ -16,10 +16,26 @@
/* Function with list databases, tables or fields */
-#include "mysql_priv.h"
+#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
+#include "sql_priv.h"
+#include "unireg.h"
+#include "sql_acl.h" // fill_schema_*_privileges
#include "sql_select.h" // For select_describe
+#include "sql_base.h" // close_tables_for_reopen
#include "sql_show.h"
+#include "sql_table.h" // filename_to_tablename,
+ // primary_key_name,
+ // build_table_filename
#include "repl_failsafe.h"
+#include "sql_view.h" // mysql_frm_type
+#include "sql_parse.h" // check_access, check_table_access
+#include "sql_partition.h" // partition_element
+#include "sql_db.h" // check_db_dir_existence, load_db_opt_by_name
+#include "sql_time.h" // interval_type_to_name
+#include "tztime.h" // struct Time_zone
+#include "sql_acl.h" // TABLE_ACLS, check_grant, DB_ACLS, acl_get,
+ // check_grant_db
+#include "filesort.h" // filesort_free_buffers
#include "sp.h"
#include "sp_head.h"
#include "sp_pcontext.h"
@@ -34,6 +50,7 @@
#endif
#include <my_dir.h>
#include "debug_sync.h"
+#include "lock.h" // MYSQL_LOCK_IGNORE_FLUSH
#define STR_OR_NIL(S) ((S) ? (S) : "<nil>")
=== modified file 'sql/sql_show.h'
--- a/sql/sql_show.h 2009-10-12 09:08:34 +0000
+++ b/sql/sql_show.h 2010-04-09 04:36:24 +0000
@@ -16,12 +16,24 @@
#ifndef SQL_SHOW_H
#define SQL_SHOW_H
+#include "sql_list.h" /* List */
+#include "handler.h" /* enum_schema_tables */
+#include "table.h" /* enum_schema_table_state */
+
/* Forward declarations */
+class JOIN;
class String;
class THD;
+class sp_name;
+struct TABLE_LIST;
struct st_ha_create_information;
+typedef class st_select_lex SELECT_LEX;
typedef st_ha_create_information HA_CREATE_INFO;
-struct TABLE_LIST;
+struct LEX;
+typedef struct st_mysql_show_var SHOW_VAR;
+typedef struct st_schema_table ST_SCHEMA_TABLE;
+struct TABLE;
+typedef struct system_status_var STATUS_VAR;
enum find_files_result {
FIND_FILES_OK,
@@ -29,6 +41,56 @@ enum find_files_result {
FIND_FILES_DIR
};
+/* Used by handlers to store things in schema tables */
+#define IS_FILES_FILE_ID 0
+#define IS_FILES_FILE_NAME 1
+#define IS_FILES_FILE_TYPE 2
+#define IS_FILES_TABLESPACE_NAME 3
+#define IS_FILES_TABLE_CATALOG 4
+#define IS_FILES_TABLE_SCHEMA 5
+#define IS_FILES_TABLE_NAME 6
+#define IS_FILES_LOGFILE_GROUP_NAME 7
+#define IS_FILES_LOGFILE_GROUP_NUMBER 8
+#define IS_FILES_ENGINE 9
+#define IS_FILES_FULLTEXT_KEYS 10
+#define IS_FILES_DELETED_ROWS 11
+#define IS_FILES_UPDATE_COUNT 12
+#define IS_FILES_FREE_EXTENTS 13
+#define IS_FILES_TOTAL_EXTENTS 14
+#define IS_FILES_EXTENT_SIZE 15
+#define IS_FILES_INITIAL_SIZE 16
+#define IS_FILES_MAXIMUM_SIZE 17
+#define IS_FILES_AUTOEXTEND_SIZE 18
+#define IS_FILES_CREATION_TIME 19
+#define IS_FILES_LAST_UPDATE_TIME 20
+#define IS_FILES_LAST_ACCESS_TIME 21
+#define IS_FILES_RECOVER_TIME 22
+#define IS_FILES_TRANSACTION_COUNTER 23
+#define IS_FILES_VERSION 24
+#define IS_FILES_ROW_FORMAT 25
+#define IS_FILES_TABLE_ROWS 26
+#define IS_FILES_AVG_ROW_LENGTH 27
+#define IS_FILES_DATA_LENGTH 28
+#define IS_FILES_MAX_DATA_LENGTH 29
+#define IS_FILES_INDEX_LENGTH 30
+#define IS_FILES_DATA_FREE 31
+#define IS_FILES_CREATE_TIME 32
+#define IS_FILES_UPDATE_TIME 33
+#define IS_FILES_CHECK_TIME 34
+#define IS_FILES_CHECKSUM 35
+#define IS_FILES_STATUS 36
+#define IS_FILES_EXTRA 37
+
+#define IS_TABLESPACES_TABLESPACE_NAME 0
+#define IS_TABLESPACES_ENGINE 1
+#define IS_TABLESPACES_TABLESPACE_TYPE 2
+#define IS_TABLESPACES_LOGFILE_GROUP_NAME 3
+#define IS_TABLESPACES_EXTENT_SIZE 4
+#define IS_TABLESPACES_AUTOEXTEND_SIZE 5
+#define IS_TABLESPACES_MAXIMUM_SIZE 6
+#define IS_TABLESPACES_NODEGROUP_ID 7
+#define IS_TABLESPACES_TABLESPACE_COMMENT 8
+
find_files_result find_files(THD *thd, List<LEX_STRING> *files, const char *db,
const char *path, const char *wild, bool dir);
@@ -40,4 +102,47 @@ int view_store_create_info(THD *thd, TAB
int copy_event_to_schema_table(THD *thd, TABLE *sch_table, TABLE *event_table);
+void append_identifier(THD *thd, String *packet, const char *name,
+ uint length);
+void mysqld_list_fields(THD *thd,TABLE_LIST *table, const char *wild);
+int mysqld_dump_create_info(THD *thd, TABLE_LIST *table_list, int fd);
+bool mysqld_show_create(THD *thd, TABLE_LIST *table_list);
+bool mysqld_show_create_db(THD *thd, char *dbname, HA_CREATE_INFO *create);
+
+void mysqld_list_processes(THD *thd,const char *user,bool verbose);
+int mysqld_show_status(THD *thd);
+int mysqld_show_variables(THD *thd,const char *wild);
+bool mysqld_show_storage_engines(THD *thd);
+bool mysqld_show_authors(THD *thd);
+bool mysqld_show_contributors(THD *thd);
+bool mysqld_show_privileges(THD *thd);
+bool mysqld_show_column_types(THD *thd);
+char *make_backup_log_name(char *buff, const char *name, const char* log_ext);
+void calc_sum_of_all_status(STATUS_VAR *to);
+void append_definer(THD *thd, String *buffer, const LEX_STRING *definer_user,
+ const LEX_STRING *definer_host);
+int add_status_vars(SHOW_VAR *list);
+void remove_status_vars(SHOW_VAR *list);
+void init_status_vars();
+void free_status_vars();
+void reset_status_vars();
+bool show_create_trigger(THD *thd, const sp_name *trg_name);
+void view_store_options(THD *thd, TABLE_LIST *table, String *buff);
+
+void init_fill_schema_files_row(TABLE* table);
+bool schema_table_store_record(THD *thd, TABLE *table);
+void initialize_information_schema_acl();
+
+ST_SCHEMA_TABLE *find_schema_table(THD *thd, const char* table_name);
+ST_SCHEMA_TABLE *get_schema_table(enum enum_schema_tables schema_table_idx);
+int make_schema_select(THD *thd, SELECT_LEX *sel,
+ enum enum_schema_tables schema_table_idx);
+int mysql_schema_table(THD *thd, LEX *lex, TABLE_LIST *table_list);
+bool get_schema_tables_result(JOIN *join,
+ enum enum_schema_table_state executed_place);
+enum enum_schema_tables get_schema_table_idx(ST_SCHEMA_TABLE *schema_table);
+
+/* These functions were under INNODB_COMPATIBILITY_HOOKS */
+int get_quote_char_for_identifier(THD *thd, const char *name, uint length);
+
#endif /* SQL_SHOW_H */
=== modified file 'sql/sql_signal.cc'
--- a/sql/sql_signal.cc 2009-10-12 09:08:34 +0000
+++ b/sql/sql_signal.cc 2010-04-08 10:50:40 +0000
@@ -13,7 +13,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#include "sp_head.h"
#include "sp_pcontext.h"
#include "sp_rcontext.h"
=== modified file 'sql/sql_sort.h'
--- a/sql/sql_sort.h 2009-10-26 14:02:26 +0000
+++ b/sql/sql_sort.h 2010-04-08 10:50:40 +0000
@@ -16,6 +16,18 @@
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" /* uchar */
+#include "my_base.h" /* ha_rows */
+#include "my_sys.h" /* qsort2_cmp */
+
+typedef struct st_buffpek BUFFPEK;
+typedef struct st_queue QUEUE;
+typedef struct st_sort_field SORT_FIELD;
+
+class Field;
+struct TABLE;
+
+
/* Defines used by filesort and uniques */
#define MERGEBUFF 7
=== modified file 'sql/sql_string.h'
--- a/sql/sql_string.h 2009-11-19 22:24:07 +0000
+++ b/sql/sql_string.h 2010-04-08 10:50:40 +0000
@@ -22,7 +22,15 @@
#pragma interface /* gcc class implementation */
#endif
+#include "m_ctype.h" /* my_charset_bin */
+#include "my_sys.h" /* alloc_root, my_free, my_realloc */
+#include "m_string.h" /* TRASH */
+
class String;
+typedef struct charset_info_st CHARSET_INFO;
+typedef struct st_io_cache IO_CACHE;
+typedef struct st_mem_root MEM_ROOT;
+
int sortcmp(const String *a,const String *b, CHARSET_INFO *cs);
String *copy_if_not_alloced(String *a,String *b,uint32 arg_length);
uint32 copy_and_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc 2010-03-25 09:02:07 +0000
+++ b/sql/sql_table.cc 2010-04-09 08:22:10 +0000
@@ -15,14 +15,41 @@
/* drop and alter of tables */
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h"
#include "debug_sync.h"
+#include "sql_table.h"
+#include "sql_rename.h" // do_rename
+#include "sql_parse.h" // test_if_data_home_dir
+#include "sql_cache.h" // query_cache_*
+#include "sql_base.h" // open_temporary_table
+#include "lock.h" // wait_if_global_read_lock, lock_table_names,
+ // start_waiting_global_read_lock,
+ // unlock_table_names, mysql_unlock_tables
+#include "strfunc.h" // find_type2, find_set
+#include "sql_view.h" // mysql_frm_type, view_checksum, mysql_frm_type
+#include "sql_delete.h" // mysql_truncate
+#include "sql_partition.h" // mem_alloc_error,
+ // generate_partition_syntax,
+ // partition_info
+#include "sql_db.h" // load_db_opt_by_name, lock_db_cache, creating_database
+#include "sql_time.h" // make_truncated_value_warning
+#include "records.h" // init_read_record, end_read_record
+#include "filesort.h" // filesort_free_buffers
+#include "sql_select.h" // setup_order,
+ // make_unireg_sortorder
+#include "sql_handler.h" // mysql_ha_rm_tables
+#include "discover.h" // readfrm
+#include "my_pthread.h" // pthread_mutex_t
+#include "log_event.h" // Query_log_event
#include <hash.h>
#include <myisam.h>
#include <my_dir.h>
#include "sp_head.h"
#include "sp.h"
#include "sql_trigger.h"
+#include "sql_parse.h"
#include "sql_show.h"
#include "transaction.h"
#include "keycaches.h"
=== added file 'sql/sql_table.h'
--- a/sql/sql_table.h 1970-01-01 00:00:00 +0000
+++ b/sql/sql_table.h 2010-04-12 13:17:37 +0000
@@ -0,0 +1,215 @@
+/* Copyright 2006-2008 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef SQL_TABLE_INCLUDED
+#define SQL_TABLE_INCLUDED
+
+#include "my_global.h" /* my_bool */
+#include "my_sys.h" // pthread_mutex_t
+
+class Alter_info;
+class Alter_info;
+class Create_field;
+struct TABLE_LIST;
+class THD;
+struct TABLE;
+struct handlerton;
+typedef struct st_ha_check_opt HA_CHECK_OPT;
+typedef struct st_ha_create_information HA_CREATE_INFO;
+typedef struct st_key_cache KEY_CACHE;
+typedef struct st_lock_param_type ALTER_PARTITION_PARAM_TYPE;
+typedef struct st_lock_param_type ALTER_PARTITION_PARAM_TYPE;
+typedef struct st_mysql_lex_string LEX_STRING;
+typedef struct st_order ORDER;
+
+enum ddl_log_entry_code
+{
+ /*
+ DDL_LOG_EXECUTE_CODE:
+ This is a code that indicates that this is a log entry to
+ be executed, from this entry a linked list of log entries
+ can be found and executed.
+ DDL_LOG_ENTRY_CODE:
+ An entry to be executed in a linked list from an execute log
+ entry.
+ DDL_IGNORE_LOG_ENTRY_CODE:
+ An entry that is to be ignored
+ */
+ DDL_LOG_EXECUTE_CODE = 'e',
+ DDL_LOG_ENTRY_CODE = 'l',
+ DDL_IGNORE_LOG_ENTRY_CODE = 'i'
+};
+
+enum ddl_log_action_code
+{
+ /*
+ The type of action that a DDL_LOG_ENTRY_CODE entry is to
+ perform.
+ DDL_LOG_DELETE_ACTION:
+ Delete an entity
+ DDL_LOG_RENAME_ACTION:
+ Rename an entity
+ DDL_LOG_REPLACE_ACTION:
+ Rename an entity after removing the previous entry with the
+ new name, that is replace this entry.
+ */
+ DDL_LOG_DELETE_ACTION = 'd',
+ DDL_LOG_RENAME_ACTION = 'r',
+ DDL_LOG_REPLACE_ACTION = 's'
+};
+
+
+typedef struct st_ddl_log_entry
+{
+ const char *name;
+ const char *from_name;
+ const char *handler_name;
+ uint next_entry;
+ uint entry_pos;
+ enum ddl_log_entry_code entry_type;
+ enum ddl_log_action_code action_type;
+ /*
+ Most actions have only one phase. REPLACE does however have two
+ phases. The first phase removes the file with the new name if
+ there was one there before and the second phase renames the
+ old name to the new name.
+ */
+ char phase;
+} DDL_LOG_ENTRY;
+
+typedef struct st_ddl_log_memory_entry
+{
+ uint entry_pos;
+ struct st_ddl_log_memory_entry *next_log_entry;
+ struct st_ddl_log_memory_entry *prev_log_entry;
+ struct st_ddl_log_memory_entry *next_active_log_entry;
+} DDL_LOG_MEMORY_ENTRY;
+
+
+enum enum_explain_filename_mode
+{
+ EXPLAIN_ALL_VERBOSE= 0,
+ EXPLAIN_PARTITIONS_VERBOSE,
+ EXPLAIN_PARTITIONS_AS_COMMENT
+};
+
+/* depends on errmsg.txt Database `db`, Table `t` ... */
+#define EXPLAIN_FILENAME_MAX_EXTRA_LENGTH 63
+
+#define MYSQL50_TABLE_NAME_PREFIX "#mysql50#"
+#define MYSQL50_TABLE_NAME_PREFIX_LENGTH 9
+
+#define WFRM_WRITE_SHADOW 1
+#define WFRM_INSTALL_SHADOW 2
+#define WFRM_PACK_FRM 4
+#define WFRM_KEEP_SHARE 8
+
+/* Flags for conversion functions. */
+#define FN_FROM_IS_TMP (1 << 0)
+#define FN_TO_IS_TMP (1 << 1)
+#define FN_IS_TMP (FN_FROM_IS_TMP | FN_TO_IS_TMP)
+#define NO_FRM_RENAME (1 << 2)
+#define FRM_ONLY (1 << 3)
+
+uint filename_to_tablename(const char *from, char *to, uint to_length);
+uint tablename_to_filename(const char *from, char *to, uint to_length);
+uint check_n_cut_mysql50_prefix(const char *from, char *to, uint to_length);
+uint build_table_filename(char *buff, size_t bufflen, const char *db,
+ const char *table, const char *ext, uint flags);
+uint build_table_shadow_filename(char *buff, size_t bufflen,
+ ALTER_PARTITION_PARAM_TYPE *lpt);
+bool mysql_create_table(THD *thd, TABLE_LIST *create_table,
+ HA_CREATE_INFO *create_info,
+ Alter_info *alter_info);
+bool mysql_create_table_no_lock(THD *thd, const char *db,
+ const char *table_name,
+ HA_CREATE_INFO *create_info,
+ Alter_info *alter_info,
+ bool tmp_table, uint select_field_count);
+
+bool mysql_alter_table(THD *thd, char *new_db, char *new_name,
+ HA_CREATE_INFO *create_info,
+ TABLE_LIST *table_list,
+ Alter_info *alter_info,
+ uint order_num, ORDER *order, bool ignore);
+bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list);
+bool mysql_create_like_table(THD *thd, TABLE_LIST *table,
+ TABLE_LIST *src_table,
+ HA_CREATE_INFO *create_info);
+bool mysql_rename_table(handlerton *base, const char *old_db,
+ const char * old_name, const char *new_db,
+ const char * new_name, uint flags);
+
+bool mysql_backup_table(THD* thd, TABLE_LIST* table_list);
+bool mysql_restore_table(THD* thd, TABLE_LIST* table_list);
+
+bool mysql_checksum_table(THD* thd, TABLE_LIST* table_list,
+ HA_CHECK_OPT* check_opt);
+bool mysql_check_table(THD* thd, TABLE_LIST* table_list,
+ HA_CHECK_OPT* check_opt);
+bool mysql_repair_table(THD* thd, TABLE_LIST* table_list,
+ HA_CHECK_OPT* check_opt);
+bool mysql_analyze_table(THD* thd, TABLE_LIST* table_list,
+ HA_CHECK_OPT* check_opt);
+bool mysql_optimize_table(THD* thd, TABLE_LIST* table_list,
+ HA_CHECK_OPT* check_opt);
+bool mysql_assign_to_keycache(THD* thd, TABLE_LIST* table_list,
+ LEX_STRING *key_cache_name);
+bool mysql_preload_keys(THD* thd, TABLE_LIST* table_list);
+int reassign_keycache_tables(THD* thd, KEY_CACHE *src_cache,
+ KEY_CACHE *dst_cache);
+bool mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
+ my_bool drop_temporary);
+int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
+ bool drop_temporary, bool drop_view, bool log_query);
+bool quick_rm_table(handlerton *base,const char *db,
+ const char *table_name, uint flags);
+void close_cached_table(THD *thd, TABLE *table);
+void sp_prepare_create_field(THD *thd, Create_field *sql_field);
+int prepare_create_field(Create_field *sql_field,
+ uint *blob_columns,
+ int *timestamps, int *timestamps_with_niladic,
+ longlong table_flags);
+CHARSET_INFO* get_sql_field_charset(Create_field *sql_field,
+ HA_CREATE_INFO *create_info);
+bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags);
+int write_bin_log(THD *thd, bool clear_error,
+ char const *query, ulong query_length,
+ bool is_trans= FALSE);
+bool write_ddl_log_entry(DDL_LOG_ENTRY *ddl_log_entry,
+ DDL_LOG_MEMORY_ENTRY **active_entry);
+bool write_execute_ddl_log_entry(uint first_entry,
+ bool complete,
+ DDL_LOG_MEMORY_ENTRY **active_entry);
+bool deactivate_ddl_log_entry(uint entry_no);
+void release_ddl_log_memory_entry(DDL_LOG_MEMORY_ENTRY *log_entry);
+bool sync_ddl_log();
+void release_ddl_log();
+void execute_ddl_log_recovery();
+bool execute_ddl_log_entry(THD *thd, uint first_entry);
+bool check_duplicate_warning(THD *thd, char *msg, ulong length);
+
+/*
+ These prototypes where under INNODB_COMPATIBILITY_HOOKS.
+*/
+uint explain_filename(THD* thd, const char *from, char *to, uint to_length,
+ enum_explain_filename_mode explain_mode);
+
+
+extern MYSQL_PLUGIN_IMPORT const char *primary_key_name;
+extern int creating_table; // How many mysql_create_table() are running
+extern mysql_mutex_t LOCK_gdl;
+
+#endif /* SQL_TABLE_INCLUDED */
=== modified file 'sql/sql_tablespace.cc'
--- a/sql/sql_tablespace.cc 2010-03-15 15:08:35 +0000
+++ b/sql/sql_tablespace.cc 2010-04-09 08:22:10 +0000
@@ -15,7 +15,12 @@
/* drop and alter of tablespaces */
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h"
+#include "sql_tablespace.h"
+#include "sql_table.h" // write_bin_log
+#include "sql_class.h" // THD
static const char *str_ts_command_type[]=
=== added file 'sql/sql_tablespace.h'
--- a/sql/sql_tablespace.h 1970-01-01 00:00:00 +0000
+++ b/sql/sql_tablespace.h 2010-03-31 14:05:33 +0000
@@ -0,0 +1,24 @@
+/* Copyright 2006-2008 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef SQL_TABLESPACE_INCLUDED
+#define SQL_TABLESPACE_INCLUDED
+
+class THD;
+class st_alter_tablespace;
+
+int mysql_alter_tablespace(THD* thd, st_alter_tablespace *ts_info);
+
+#endif /* SQL_TABLESPACE_INCLUDED */
=== modified file 'sql/sql_test.cc'
--- a/sql/sql_test.cc 2010-02-10 21:11:06 +0000
+++ b/sql/sql_test.cc 2010-04-09 08:22:10 +0000
@@ -17,7 +17,12 @@
/* Write some debug info */
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h"
+#include "sql_test.h"
+#include "sql_base.h" // table_def_cache, table_cache_count, unused_tables
+#include "sql_show.h" // calc_sum_of_all_status
#include "sql_select.h"
#include "keycaches.h"
#include <hash.h>
=== added file 'sql/sql_test.h'
--- a/sql/sql_test.h 1970-01-01 00:00:00 +0000
+++ b/sql/sql_test.h 2010-04-08 10:50:40 +0000
@@ -0,0 +1,39 @@
+/* Copyright 2006-2008 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef SQL_TEST_INCLUDED
+#define SQL_TEST_INCLUDED
+
+#include "mysqld.h"
+
+class JOIN;
+struct TABLE_LIST;
+typedef class Item COND;
+typedef class st_select_lex SELECT_LEX;
+typedef struct st_sort_field SORT_FIELD;
+
+#ifndef DBUG_OFF
+void print_where(COND *cond,const char *info, enum_query_type query_type);
+void print_cached_tables(void);
+void TEST_filesort(SORT_FIELD *sortorder,uint s_length);
+void print_plan(JOIN* join,uint idx, double record_count, double read_time,
+ double current_read_time, const char *info);
+void print_keyuse_array(DYNAMIC_ARRAY *keyuse_array);
+void print_sjm(SJ_MATERIALIZATION_INFO *sjm);
+void dump_TABLE_LIST_graph(SELECT_LEX *select_lex, TABLE_LIST* tl);
+#endif
+void mysql_print_status();
+
+#endif /* SQL_TEST_INCLUDED */
=== renamed file 'sql/time.cc' => 'sql/sql_time.cc'
--- a/sql/time.cc 2010-02-15 08:09:44 +0000
+++ b/sql/sql_time.cc 2010-04-09 08:22:10 +0000
@@ -16,7 +16,12 @@
/* Functions to handle date and time */
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h" // REQUIRED by other includes
+#include "sql_time.h"
+#include "tztime.h" // struct Time_zone
+#include "sql_class.h" // THD, MODE_INVALID_DATES, MODE_NO_ZERO_DATE
#include <m_ctype.h>
=== added file 'sql/sql_time.h'
--- a/sql/sql_time.h 1970-01-01 00:00:00 +0000
+++ b/sql/sql_time.h 2010-03-31 14:05:33 +0000
@@ -0,0 +1,101 @@
+/* Copyright 2006-2008 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef SQL_TIME_INCLUDED
+#define SQL_TIME_INCLUDED
+
+#include "my_global.h" /* ulong */
+#include "my_time.h"
+#include "mysql_time.h" /* timestamp_type */
+#include "sql_error.h" /* MYSQL_ERROR */
+#include "structs.h" /* INTERVAL */
+
+typedef enum enum_mysql_timestamp_type timestamp_type;
+typedef struct st_date_time_format DATE_TIME_FORMAT;
+typedef struct st_known_date_time_format KNOWN_DATE_TIME_FORMAT;
+
+/* Flags for calc_week() function. */
+#define WEEK_MONDAY_FIRST 1
+#define WEEK_YEAR 2
+#define WEEK_FIRST_WEEKDAY 4
+
+ulong convert_period_to_month(ulong period);
+ulong convert_month_to_period(ulong month);
+void get_date_from_daynr(long daynr,uint *year, uint *month, uint *day);
+my_time_t TIME_to_timestamp(THD *thd, const MYSQL_TIME *t, my_bool *not_exist);
+bool str_to_time_with_warn(CHARSET_INFO *cs, const char *str, uint length,
+ MYSQL_TIME *l_time);
+timestamp_type str_to_datetime_with_warn(CHARSET_INFO *cs, const char *str,
+ uint length, MYSQL_TIME *l_time,
+ uint flags);
+void make_truncated_value_warning(THD *thd,
+ MYSQL_ERROR::enum_warning_level level,
+ const char *str_val, uint str_length,
+ timestamp_type time_type,
+ const char *field_name);
+extern DATE_TIME_FORMAT *date_time_format_make(timestamp_type format_type,
+ const char *format_str,
+ uint format_length);
+extern DATE_TIME_FORMAT *date_time_format_copy(THD *thd,
+ DATE_TIME_FORMAT *format);
+const char *get_date_time_format_str(KNOWN_DATE_TIME_FORMAT *format,
+ timestamp_type type);
+void make_date(const DATE_TIME_FORMAT *format, const MYSQL_TIME *l_time,
+ String *str);
+void make_time(const DATE_TIME_FORMAT *format, const MYSQL_TIME *l_time,
+ String *str);
+void make_datetime(const DATE_TIME_FORMAT *format, const MYSQL_TIME *l_time,
+ String *str);
+
+/* MYSQL_TIME operations */
+bool date_add_interval(MYSQL_TIME *ltime, interval_type int_type,
+ INTERVAL interval);
+bool calc_time_diff(MYSQL_TIME *l_time1, MYSQL_TIME *l_time2, int l_sign,
+ longlong *seconds_out, long *microseconds_out);
+int my_time_compare(MYSQL_TIME *a, MYSQL_TIME *b);
+void localtime_to_TIME(MYSQL_TIME *to, struct tm *from);
+void calc_time_from_sec(MYSQL_TIME *to, long seconds, long microseconds);
+uint calc_week(MYSQL_TIME *l_time, uint week_behaviour, uint *year);
+
+int calc_weekday(long daynr,bool sunday_first_day_of_week);
+bool parse_date_time_format(timestamp_type format_type,
+ const char *format, uint format_length,
+ DATE_TIME_FORMAT *date_time_format);
+/* Character set-aware version of str_to_time() */
+bool str_to_time(CHARSET_INFO *cs, const char *str,uint length,
+ MYSQL_TIME *l_time, int *warning);
+/* Character set-aware version of str_to_datetime() */
+timestamp_type str_to_datetime(CHARSET_INFO *cs,
+ const char *str, uint length,
+ MYSQL_TIME *l_time, uint flags, int *was_cut);
+
+/* convenience wrapper */
+inline bool parse_date_time_format(timestamp_type format_type,
+ DATE_TIME_FORMAT *date_time_format)
+{
+ return parse_date_time_format(format_type,
+ date_time_format->format.str,
+ date_time_format->format.length,
+ date_time_format);
+}
+
+
+extern DATE_TIME_FORMAT global_date_format;
+extern DATE_TIME_FORMAT global_datetime_format;
+extern DATE_TIME_FORMAT global_time_format;
+extern KNOWN_DATE_TIME_FORMAT known_date_time_formats[];
+extern LEX_STRING interval_type_to_name[];
+
+#endif /* SQL_TIME_INCLUDED */
=== modified file 'sql/sql_trigger.cc'
--- a/sql/sql_trigger.cc 2010-02-25 13:55:28 +0000
+++ b/sql/sql_trigger.cc 2010-04-10 09:11:47 +0000
@@ -15,11 +15,23 @@
#define MYSQL_LEX 1
-#include "mysql_priv.h"
+#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
+#include "sql_priv.h"
+#include "unireg.h"
#include "sp_head.h"
#include "sql_trigger.h"
+#include "sql_parse.h" // parse_sql
#include "parse_file.h"
#include "sp.h"
+#include "sql_base.h" // find_temporary_table
+#include "lock.h" // wait_if_global_read_lock,
+ // start_waiting_global_read_lock
+#include "sql_show.h" // append_definer, append_identifier
+#include "sql_table.h" // build_table_filename,
+ // check_n_cut_mysql50_prefix
+#include "sql_db.h" // get_default_db_collation
+#include "sql_acl.h" // *_ACL, is_acl_user
+#include "sql_handler.h" // mysql_ha_rm_tables
/*************************************************************************/
=== modified file 'sql/sql_trigger.h'
--- a/sql/sql_trigger.h 2009-12-11 15:44:05 +0000
+++ b/sql/sql_trigger.h 2010-04-08 10:50:40 +0000
@@ -16,6 +16,38 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+/* Forward declarations */
+
+class Item_trigger_field;
+class sp_head;
+class sp_name;
+class Query_tables_list;
+struct TABLE_LIST;
+class Query_tables_list;
+
+/** Event on which trigger is invoked. */
+enum trg_event_type
+{
+ TRG_EVENT_INSERT= 0,
+ TRG_EVENT_UPDATE= 1,
+ TRG_EVENT_DELETE= 2,
+ TRG_EVENT_MAX
+};
+
+#include "table.h" /* GRANT_INFO */
+
+/*
+ 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, TRG_ACTION_MAX
+};
+
/**
This class holds all information about triggers of table.
@@ -178,5 +210,9 @@ bool load_table_name_for_trigger(THD *th
const sp_name *trg_name,
const LEX_STRING *trn_path,
LEX_STRING *tbl_name);
+bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create);
+
+extern const char * const TRG_EXT;
+extern const char * const TRN_EXT;
#endif /* SQL_TRIGGER_INCLUDED */
=== modified file 'sql/sql_udf.cc'
--- a/sql/sql_udf.cc 2010-03-23 09:14:15 +0000
+++ b/sql/sql_udf.cc 2010-04-09 08:22:10 +0000
@@ -31,8 +31,15 @@
#pragma implementation // gcc: Class implementation
#endif
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h"
+#include "sql_base.h" // close_thread_tables
+#include "sql_parse.h" // check_identifier_name
+#include "sql_table.h" // write_bin_log
+#include "records.h" // init_read_record, end_read_record
#include <my_pthread.h>
+#include "lock.h" // MYSQL_LOCK_IGNORE_TIMEOUT
#ifdef HAVE_DLOPEN
extern "C"
=== modified file 'sql/sql_union.cc'
--- a/sql/sql_union.cc 2010-02-04 10:55:39 +0000
+++ b/sql/sql_union.cc 2010-04-09 08:22:10 +0000
@@ -20,9 +20,14 @@
*/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h"
+#include "sql_union.h"
#include "sql_select.h"
#include "sql_cursor.h"
+#include "sql_base.h" // fill_record
+#include "filesort.h" // filesort_free_buffers
bool mysql_union(THD *thd, LEX *lex, select_result *result,
SELECT_LEX_UNIT *unit, ulong setup_tables_done_option)
=== added file 'sql/sql_union.h'
--- a/sql/sql_union.h 1970-01-01 00:00:00 +0000
+++ b/sql/sql_union.h 2010-03-31 14:05:33 +0000
@@ -0,0 +1,31 @@
+/* Copyright 2006-2008 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef SQL_UNION_INCLUDED
+#define SQL_UNION_INCLUDED
+
+#include "my_global.h" /* ulong */
+
+class THD;
+class select_result;
+struct LEX;
+
+typedef class st_select_lex_unit SELECT_LEX_UNIT;
+
+bool mysql_union(THD *thd, LEX *lex, select_result *result,
+ SELECT_LEX_UNIT *unit, ulong setup_tables_done_option);
+
+
+#endif /* SQL_UNION_INCLUDED */
=== modified file 'sql/sql_update.cc'
--- a/sql/sql_update.cc 2010-03-23 09:14:15 +0000
+++ b/sql/sql_update.cc 2010-04-10 09:11:47 +0000
@@ -19,11 +19,28 @@
Multi-table updates were introduced by Sinisa & Monty
*/
-#include "mysql_priv.h"
+#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
+#include "sql_priv.h"
+#include "unireg.h" // REQUIRED: for other includes
+#include "sql_update.h"
+#include "sql_cache.h" // query_cache_*
+#include "sql_base.h" // close_tables_for_reopen
+#include "sql_parse.h" // cleanup_items
+#include "sql_partition.h" // partition_key_modified
#include "sql_select.h"
+#include "sql_view.h" // check_key_in_view
#include "sp_head.h"
#include "sql_trigger.h"
#include "debug_sync.h"
+#include "probes_mysql.h"
+#include "key.h" // is_key_used
+#include "sql_acl.h" // *_ACL, check_grant
+#include "records.h" // init_read_record,
+ // end_read_record
+#include "filesort.h" // filesort
+#include "sql_derived.h" // mysql_derived_prepare,
+ // mysql_handle_derived,
+ // mysql_derived_filling
/* Return 0 if row hasn't changed */
=== added file 'sql/sql_update.h'
--- a/sql/sql_update.h 1970-01-01 00:00:00 +0000
+++ b/sql/sql_update.h 2010-04-12 13:17:37 +0000
@@ -0,0 +1,43 @@
+/* Copyright 2006-2008 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef SQL_UPDATE_INCLUDED
+#define SQL_UPDATE_INCLUDED
+
+#include "sql_class.h" /* enum_duplicates */
+
+class Item;
+struct TABLE_LIST;
+class THD;
+
+typedef class st_select_lex SELECT_LEX;
+typedef class st_select_lex_unit SELECT_LEX_UNIT;
+
+bool mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
+ Item **conds, uint order_num, ORDER *order);
+int mysql_update(THD *thd,TABLE_LIST *tables,List<Item> &fields,
+ List<Item> &values,COND *conds,
+ uint order_num, ORDER *order, ha_rows limit,
+ enum enum_duplicates handle_duplicates, bool ignore,
+ ha_rows *found_return, ha_rows *updated_return);
+bool mysql_multi_update(THD *thd, TABLE_LIST *table_list,
+ List<Item> *fields, List<Item> *values,
+ COND *conds, ulonglong options,
+ enum enum_duplicates handle_duplicates, bool ignore,
+ SELECT_LEX_UNIT *unit, SELECT_LEX *select_lex,
+ multi_update **result);
+bool compare_record(TABLE *table);
+
+#endif /* SQL_UPDATE_INCLUDED */
=== modified file 'sql/sql_view.cc'
--- a/sql/sql_view.cc 2010-03-25 09:02:07 +0000
+++ b/sql/sql_view.cc 2010-04-10 09:11:47 +0000
@@ -15,7 +15,18 @@
*/
#define MYSQL_LEX 1
-#include "mysql_priv.h"
+#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
+#include "sql_priv.h"
+#include "unireg.h"
+#include "sql_view.h"
+#include "sql_base.h" // find_table_in_global_list
+#include "sql_parse.h" // sql_parse
+#include "sql_cache.h" // query_cache_*
+#include "lock.h" // wait_if_global_read_lock, lock_table_names
+#include "sql_show.h" // append_identifier
+#include "sql_table.h" // build_table_filename
+#include "sql_db.h" // mysql_opt_change_db, mysql_change_db
+#include "sql_acl.h" // *_ACL, check_grant
#include "sql_select.h"
#include "parse_file.h"
#include "sp.h"
=== modified file 'sql/sql_view.h'
--- a/sql/sql_view.h 2009-10-26 14:02:26 +0000
+++ b/sql/sql_view.h 2010-04-08 10:50:40 +0000
@@ -18,6 +18,16 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include "sql_class.h" /* Required by sql_lex.h */
+#include "sql_lex.h" /* enum_view_create_mode, enum_drop_mode */
+
+/* Forward declarations */
+
+class File_parser;
+
+
+/* Function declarations */
+
bool create_view_precheck(THD *thd, TABLE_LIST *tables, TABLE_LIST *view,
enum_view_create_mode mode);
@@ -45,4 +55,6 @@ bool mysql_rename_view(THD *thd, const c
#define VIEW_ANY_ACL (SELECT_ACL | UPDATE_ACL | INSERT_ACL | DELETE_ACL)
+extern const LEX_STRING view_type;
+
#endif /* SQL_VIEW_INCLUDED */
=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy 2010-03-25 09:02:07 +0000
+++ b/sql/sql_yacc.yy 2010-04-08 10:50:40 +0000
@@ -35,7 +35,15 @@
#define YYMAXDEPTH 3200 /* Because of 64K stack */
#define Lex (YYTHD->lex)
#define Select Lex->current_select
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h" // REQUIRED: for other includes
+#include "sql_parse.h" /* comp_*_creator */
+#include "sql_table.h" /* primary_key_name */
+#include "sql_partition.h" /* mem_alloc_error, partition_info, HASH_PARTITION */
+#include "sql_acl.h" /* *_ACL */
+#include "password.h" /* my_make_scrambled_password_323, my_make_scrambled_password */
+#include "sql_class.h" /* Key_part_spec, enum_filetype, Diag_condition_item_name */
#include "slave.h"
#include "lex_symbol.h"
#include "item_create.h"
=== modified file 'sql/strfunc.cc'
--- a/sql/strfunc.cc 2009-12-22 09:35:56 +0000
+++ b/sql/strfunc.cc 2010-04-09 08:22:10 +0000
@@ -15,7 +15,14 @@
/* Some useful string utility functions used by the MySQL server */
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h"
+#include "strfunc.h"
+#include "sql_class.h"
+#include "typelib.h" // TYPELIB
+#include "m_ctype.h" // my_charset_latin1
+#include "mysqld.h" // system_charset_info
/*
Return bitmap for strings used in a set
=== added file 'sql/strfunc.h'
--- a/sql/strfunc.h 1970-01-01 00:00:00 +0000
+++ b/sql/strfunc.h 2010-03-31 14:05:33 +0000
@@ -0,0 +1,51 @@
+/* Copyright 2006-2008 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef STRFUNC_INCLUDED
+#define STRFUNC_INCLUDED
+
+#include "my_global.h" /* ulonglong, uint */
+
+typedef struct charset_info_st CHARSET_INFO;
+typedef struct st_mysql_lex_string LEX_STRING;
+typedef struct st_typelib TYPELIB;
+
+ulonglong find_set(TYPELIB *lib, const char *x, uint length, CHARSET_INFO *cs,
+ char **err_pos, uint *err_len, bool *set_warning);
+ulonglong find_set_from_flags(TYPELIB *lib, uint default_name,
+ ulonglong cur_set, ulonglong default_set,
+ const char *str, uint length, CHARSET_INFO *cs,
+ char **err_pos, uint *err_len, bool *set_warning);
+uint find_type(const TYPELIB *lib, const char *find, uint length,
+ bool part_match);
+uint find_type2(const TYPELIB *lib, const char *find, uint length,
+ CHARSET_INFO *cs);
+void unhex_type2(TYPELIB *lib);
+uint check_word(TYPELIB *lib, const char *val, const char *end,
+ const char **end_of_word);
+int find_string_in_array(LEX_STRING * const haystack, LEX_STRING * const needle,
+ CHARSET_INFO * const cs);
+char *flagset_to_string(THD *thd, LEX_STRING *result, ulonglong set,
+ const char *lib[]);
+char *set_to_string(THD *thd, LEX_STRING *result, ulonglong set,
+ const char *lib[]);
+
+/*
+ These functions were protected by INNODB_COMPATIBILITY_HOOKS
+ */
+uint strconvert(CHARSET_INFO *from_cs, const char *from,
+ CHARSET_INFO *to_cs, char *to, uint to_length, uint *errors);
+
+#endif /* STRFUNC_INCLUDED */
=== modified file 'sql/structs.h'
--- a/sql/structs.h 2010-03-23 09:14:15 +0000
+++ b/sql/structs.h 2010-04-08 10:50:40 +0000
@@ -17,10 +17,18 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
/* The old structures from unireg */
+#include "sql_plugin.h" /* plugin_ref */
+#include "sql_const.h" /* MAX_REFLENGTH */
+#include "my_time.h" /* enum_mysql_timestamp_type */
+#include "thr_lock.h" /* thr_lock_type */
+#include "my_base.h" /* ha_rows, ha_key_alg */
+
struct TABLE;
class Field;
+
class THD;
typedef struct st_date_time_format {
=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc 2010-03-25 07:20:34 +0000
+++ b/sql/sys_vars.cc 2010-04-10 09:11:47 +0000
@@ -27,19 +27,37 @@
(for example in storage/myisam/ha_myisam.cc) !
*/
+#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
+#include "sql_priv.h"
+#include "sql_class.h" // set_var.h: THD
#include "sys_vars.h"
+#include "mysqld.h"
#include "events.h"
#include <thr_alarm.h>
#include "slave.h"
#include "rpl_mi.h"
#include "transaction.h"
+#include "mysqld.h"
+#include "lock.h"
+#include "sql_time.h" // known_date_time_formats
+#include "sql_acl.h" // SUPER_ACL,
+ // mysql_user_table_is_in_short_password_format
+#include "derror.h" // read_texts
+#include "sql_base.h" // close_cached_tables
#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
#include "../storage/perfschema/pfs_server.h"
#endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
/*
+ This forward declaration is needed because including sql_base.h
+ causes further includes. [TODO] Eliminate this forward declaration
+ and include a file with the prototype instead.
+*/
+extern void close_thread_tables(THD *thd);
+
+/*
The rule for this file: everything should be 'static'. When a sys_var
variable or a function from this file is - in very rare cases - needed
elsewhere it should be explicitly declared 'export' here to show that it's
=== modified file 'sql/sys_vars.h'
--- a/sql/sys_vars.h 2010-01-07 05:48:46 +0000
+++ b/sql/sys_vars.h 2010-04-08 10:50:40 +0000
@@ -26,6 +26,8 @@
#include <my_bit.h>
#include <my_dir.h>
#include "keycaches.h"
+#include "strfunc.h"
+#include "tztime.h" // my_tz_find, my_tz_SYSTEM, struct Time_zone
/*
a set of mostly trivial (as in f(X)=X) defines below to make system variable
=== modified file 'sql/sys_vars_shared.h'
--- a/sql/sys_vars_shared.h 2010-01-07 05:48:46 +0000
+++ b/sql/sys_vars_shared.h 2010-04-09 08:22:10 +0000
@@ -1,4 +1,7 @@
-/* Copyright (C) 2002-2006 MySQL AB, 2009 Sun Microsystems, Inc.
+#ifndef SYS_VARS_SHARED_INCLUDED
+#define SYS_VARS_SHARED_INCLUDED
+
+/* Copyright (C) 2002-2006 MySQL AB, 2009-2010 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
@@ -22,7 +25,8 @@
classes in the sys_var hierarchy (sql_plugin.cc)
*/
-#include <mysql_priv.h>
+#include "my_global.h"
+#include <sql_priv.h>
#include "set_var.h"
extern bool throw_bounds_warning(THD *thd, const char *name,
@@ -79,3 +83,5 @@ public:
~AutoRLock() { if (lock) lock->unlock(); }
};
+
+#endif /* SYS_VARS_SHARED_INCLUDED */
=== modified file 'sql/table.cc'
--- a/sql/table.cc 2010-03-25 09:02:07 +0000
+++ b/sql/table.cc 2010-04-10 09:11:47 +0000
@@ -16,8 +16,21 @@
/* Some general useful functions */
-#include "mysql_priv.h"
+#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
+#include "sql_priv.h"
+#include "unireg.h" // REQUIRED: for other includes
+#include "table.h"
+#include "frm_crypt.h" // get_crypt_for_frm
+#include "key.h" // find_ref_key
+#include "sql_table.h" // build_table_filename,
+ // primary_key_name
#include "sql_trigger.h"
+#include "sql_parse.h" // free_items
+#include "strfunc.h" // unhex_type2
+#include "sql_partition.h" // mysql_unpack_partition,
+ // fix_partition_func, partition_info
+#include "sql_acl.h" // *_ACL, acl_getroot_no_password
+#include "sql_base.h" // release_table_share
#include <m_ctype.h>
#include "my_md5.h"
=== modified file 'sql/table.h'
--- a/sql/table.h 2010-03-23 09:14:15 +0000
+++ b/sql/table.h 2010-04-12 13:18:53 +0000
@@ -16,9 +16,18 @@
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" /* NO_EMBEDDED_ACCESS_CHECKS */
#include "sql_plist.h"
+#include "sql_list.h" /* Sql_alloc */
#include "mdl.h"
+#ifndef MYSQL_CLIENT
+
+#include "hash.h" /* HASH */
+#include "handler.h" /* row_type, ha_choice, handler */
+#include "mysql_com.h" /* enum_field_types */
+#include "thr_lock.h" /* thr_lock_type */
+
/* Structs that defines the TABLE */
class Item; /* Needed by ORDER */
@@ -30,12 +39,145 @@ class st_select_lex;
class partition_info;
class COND_EQUAL;
class Security_context;
+struct TABLE_LIST;
class ACL_internal_schema_access;
class ACL_internal_table_access;
+struct TABLE_LIST;
+class Field;
+
+/*
+ Used to identify NESTED_JOIN structures within a join (applicable only to
+ structures that have not been simplified away and embed more the one
+ element)
+*/
+typedef ulonglong nested_join_map;
+
+
+#define tmp_file_prefix "#sql" /**< Prefix for tmp tables */
+#define tmp_file_prefix_length 4
+#define TMP_TABLE_KEY_EXTRA 8
+
+/**
+ Enumerate possible types of a table from re-execution
+ standpoint.
+ TABLE_LIST class has a member of this type.
+ At prepared statement prepare, this member is assigned a value
+ as of the current state of the database. Before (re-)execution
+ of a prepared statement, we check that the value recorded at
+ prepare matches the type of the object we obtained from the
+ table definition cache.
+
+ @sa check_and_update_table_version()
+ @sa Execute_observer
+ @sa Prepared_statement::reprepare()
+*/
+
+enum enum_table_ref_type
+{
+ /** Initial value set by the parser */
+ TABLE_REF_NULL= 0,
+ TABLE_REF_VIEW,
+ TABLE_REF_BASE_TABLE,
+ TABLE_REF_I_S_TABLE,
+ TABLE_REF_TMP_TABLE
+};
+
+
+/**
+ Opening modes for open_temporary_table and open_table_from_share
+*/
+
+enum open_table_mode
+{
+ OTM_OPEN= 0,
+ OTM_CREATE= 1,
+ OTM_ALTER= 2
+};
+
/*************************************************************************/
/**
+ Object_creation_ctx -- interface for creation context of database objects
+ (views, stored routines, events, triggers). Creation context -- is a set
+ of attributes, that should be fixed at the creation time and then be used
+ each time the object is parsed or executed.
+*/
+
+class Object_creation_ctx
+{
+public:
+ Object_creation_ctx *set_n_backup(THD *thd);
+
+ void restore_env(THD *thd, Object_creation_ctx *backup_ctx);
+
+protected:
+ Object_creation_ctx() {}
+ virtual Object_creation_ctx *create_backup_ctx(THD *thd) const = 0;
+
+ virtual void change_env(THD *thd) const = 0;
+
+public:
+ virtual ~Object_creation_ctx()
+ { }
+};
+
+/*************************************************************************/
+
+/**
+ Default_object_creation_ctx -- default implementation of
+ Object_creation_ctx.
+*/
+
+class Default_object_creation_ctx : public Object_creation_ctx
+{
+public:
+ CHARSET_INFO *get_client_cs()
+ {
+ return m_client_cs;
+ }
+
+ CHARSET_INFO *get_connection_cl()
+ {
+ return m_connection_cl;
+ }
+
+protected:
+ Default_object_creation_ctx(THD *thd);
+
+ Default_object_creation_ctx(CHARSET_INFO *client_cs,
+ CHARSET_INFO *connection_cl);
+
+protected:
+ virtual Object_creation_ctx *create_backup_ctx(THD *thd) const;
+
+ virtual void change_env(THD *thd) const;
+
+protected:
+ /**
+ client_cs stores the value of character_set_client session variable.
+ The only character set attribute is used.
+
+ Client character set is included into query context, because we save
+ query in the original character set, which is client character set. So,
+ in order to parse the query properly we have to switch client character
+ set on parsing.
+ */
+ CHARSET_INFO *m_client_cs;
+
+ /**
+ connection_cl stores the value of collation_connection session
+ variable. Both character set and collation attributes are used.
+
+ Connection collation is included into query context, becase it defines
+ the character set and collation of text literals in internal
+ representation of query (item-objects).
+ */
+ CHARSET_INFO *m_connection_cl;
+};
+
+
+/**
View_creation_ctx -- creation context of view objects.
*/
@@ -164,15 +306,6 @@ enum tmp_table_type
INTERNAL_TMP_TABLE, SYSTEM_TMP_TABLE, TMP_TABLE_FRM_FILE_ONLY
};
-/** Event on which trigger is invoked. */
-enum trg_event_type
-{
- TRG_EVENT_INSERT= 0,
- TRG_EVENT_UPDATE= 1,
- TRG_EVENT_DELETE= 2,
- TRG_EVENT_MAX
-};
-
enum frm_type_enum
{
FRMTYPE_ERROR= 0,
@@ -1890,4 +2023,87 @@ size_t max_row_length(TABLE *table, cons
void init_mdl_requests(TABLE_LIST *table_list);
+int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias,
+ uint db_stat, uint prgflag, uint ha_open_flags,
+ TABLE *outparam, open_table_mode open_mode);
+TABLE_SHARE *alloc_table_share(TABLE_LIST *table_list, char *key,
+ uint key_length);
+void init_tmp_table_share(THD *thd, TABLE_SHARE *share, const char *key,
+ uint key_length,
+ const char *table_name, const char *path);
+void free_table_share(TABLE_SHARE *share);
+int open_table_def(THD *thd, TABLE_SHARE *share, uint db_flags);
+void open_table_error(TABLE_SHARE *share, int error, int db_errno, int errarg);
+void update_create_info_from_table(HA_CREATE_INFO *info, TABLE *form);
+bool check_and_convert_db_name(LEX_STRING *db, bool preserve_lettercase);
+bool check_db_name(LEX_STRING *db);
+bool check_column_name(const char *name);
+bool check_table_name(const char *name, uint length);
+int rename_file_ext(const char * from,const char * to,const char * ext);
+char *get_field(MEM_ROOT *mem, Field *field);
+bool get_field(MEM_ROOT *mem, Field *field, class String *res);
+
+int closefrm(TABLE *table, bool free_share);
+int read_string(File file, uchar* *to, size_t length);
+void free_blobs(TABLE *table);
+void free_field_buffers_larger_than(TABLE *table, uint32 size);
+int set_zone(int nr,int min_zone,int max_zone);
+ulong get_form_pos(File file, uchar *head, TYPELIB *save_names);
+ulong make_new_entry(File file,uchar *fileinfo,TYPELIB *formnames,
+ const char *newname);
+ulong next_io_size(ulong pos);
+void append_unescaped(String *res, const char *pos, uint length);
+File create_frm(THD *thd, const char *name, const char *db,
+ const char *table, uint reclength, uchar *fileinfo,
+ HA_CREATE_INFO *create_info, uint keys, KEY *key_info);
+char *fn_rext(char *name);
+
+/* performance schema */
+extern LEX_STRING PERFORMANCE_SCHEMA_DB_NAME;
+
+extern LEX_STRING GENERAL_LOG_NAME;
+extern LEX_STRING SLOW_LOG_NAME;
+
+/* information schema */
+extern LEX_STRING INFORMATION_SCHEMA_NAME;
+extern LEX_STRING MYSQL_SCHEMA_NAME;
+
+/* backup history */
+extern LEX_STRING BACKUP_HISTORY_LOG_NAME;
+extern LEX_STRING BACKUP_PROGRESS_LOG_NAME;
+extern LEX_STRING BACKUP_SETTINGS_NAME;
+
+inline bool is_infoschema_db(const char *name, size_t len)
+{
+ return (INFORMATION_SCHEMA_NAME.length == len &&
+ !my_strcasecmp(system_charset_info,
+ INFORMATION_SCHEMA_NAME.str, name));
+}
+
+inline bool is_infoschema_db(const char *name)
+{
+ return !my_strcasecmp(system_charset_info,
+ INFORMATION_SCHEMA_NAME.str, name);
+}
+
+TYPELIB *typelib(MEM_ROOT *mem_root, List<String> &strings);
+
+/**
+ return true if the table was created explicitly.
+*/
+inline bool is_user_table(TABLE * table)
+{
+ const char *name= table->s->table_name.str;
+ return strncmp(name, tmp_file_prefix, tmp_file_prefix_length);
+}
+
+inline void mark_as_null_row(TABLE *table)
+{
+ table->null_row=1;
+ table->status|=STATUS_NULL_ROW;
+ bfill(table->null_flags,table->s->null_bytes,255);
+}
+
+#endif /* MYSQL_CLIENT */
+
#endif /* TABLE_INCLUDED */
=== modified file 'sql/thr_malloc.cc'
--- a/sql/thr_malloc.cc 2009-09-25 14:15:30 +0000
+++ b/sql/thr_malloc.cc 2010-04-09 08:22:10 +0000
@@ -16,7 +16,11 @@
/* Mallocs for used in threads */
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h"
+#include "thr_malloc.h"
+#include "sql_class.h"
extern "C" {
void sql_alloc_error_handler(void)
=== added file 'sql/thr_malloc.h'
--- a/sql/thr_malloc.h 1970-01-01 00:00:00 +0000
+++ b/sql/thr_malloc.h 2010-03-31 14:05:33 +0000
@@ -0,0 +1,36 @@
+/* Copyright 2006-2008 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef THR_MALLOC_INCLUDED
+#define THR_MALLOC_INCLUDED
+
+#include "my_global.h" // uint, size_t
+
+typedef struct charset_info_st CHARSET_INFO;
+typedef struct st_mem_root MEM_ROOT;
+
+void init_sql_alloc(MEM_ROOT *root, uint block_size, uint pre_alloc_size);
+void *sql_alloc(size_t);
+void *sql_calloc(size_t);
+char *sql_strdup(const char *str);
+char *sql_strmake(const char *str, size_t len);
+void *sql_memdup(const void * ptr, size_t size);
+void sql_element_free(void *ptr);
+char *sql_strmake_with_convert(const char *str, size_t arg_length,
+ CHARSET_INFO *from_cs,
+ size_t max_res_length,
+ CHARSET_INFO *to_cs, size_t *result_length);
+
+#endif /* THR_MALLOC_INCLUDED */
=== modified file 'sql/transaction.cc'
--- a/sql/transaction.cc 2010-02-10 21:11:06 +0000
+++ b/sql/transaction.cc 2010-04-09 08:22:10 +0000
@@ -18,7 +18,8 @@
#pragma implementation // gcc: Class implementation
#endif
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#include "transaction.h"
#include "rpl_handler.h"
=== modified file 'sql/tztime.cc'
--- a/sql/tztime.cc 2010-03-16 13:50:50 +0000
+++ b/sql/tztime.cc 2010-04-09 08:22:10 +0000
@@ -20,7 +20,7 @@
*/
/*
- We should not include mysql_priv.h in mysql_tzinfo_to_sql utility since
+ We should not include sql_priv.h in mysql_tzinfo_to_sql utility since
it creates unsolved link dependencies on some platforms.
*/
@@ -30,7 +30,13 @@
#include <my_global.h>
#if !defined(TZINFO2SQL) && !defined(TESTTIME)
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h"
+#include "tztime.h"
+#include "sql_time.h" // localtime_to_TIME
+#include "sql_base.h" // open_system_tables_for_read,
+ // close_system_tables
#else
#include <my_time.h>
#include "tztime.h"
@@ -41,6 +47,15 @@
#include <m_string.h>
#include <my_dir.h>
#include <mysql/psi/mysql_file.h>
+#include "lock.h" // MYSQL_LOCK_IGNORE_FLUSH,
+ // MYSQL_LOCK_IGNORE_TIMEOUT
+
+/*
+ This forward declaration is needed because including sql_base.h
+ causes further includes. [TODO] Eliminate this forward declaration
+ and include a file with the prototype instead.
+*/
+extern void close_thread_tables(THD *thd);
/*
Now we don't use abbreviations in server but we will do this in future.
=== modified file 'sql/tztime.h'
--- a/sql/tztime.h 2009-10-26 14:02:26 +0000
+++ b/sql/tztime.h 2010-04-08 10:50:40 +0000
@@ -21,8 +21,17 @@
#pragma interface /* gcc class interface */
#endif
+#include "my_time.h" /* my_time_t */
+#include "mysql_time.h" /* MYSQL_TIME */
+#include "sql_list.h" /* Sql_alloc */
+#include "sql_string.h" /* String */
+
+class THD;
+
#if !defined(TESTTIME) && !defined(TZINFO2SQL)
+class THD;
+
/**
This class represents abstract time zone and provides
basic interface for MYSQL_TIME <-> my_time_t conversion.
=== modified file 'sql/uniques.cc'
--- a/sql/uniques.cc 2009-11-24 19:46:33 +0000
+++ b/sql/uniques.cc 2010-04-09 08:22:10 +0000
@@ -30,9 +30,13 @@
deletes in disk order.
*/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h"
#include "sql_sort.h"
-
+#include "queues.h" // QUEUE
+#include "my_tree.h" // element_count
+#include "sql_class.h" // Unique
int unique_write_to_file(uchar* key, element_count count, Unique *unique)
{
=== modified file 'sql/unireg.cc'
--- a/sql/unireg.cc 2010-02-21 18:25:29 +0000
+++ b/sql/unireg.cc 2010-04-09 08:22:10 +0000
@@ -23,7 +23,12 @@
str is a (long) to record position where 0 is the first position.
*/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h"
+#include "sql_partition.h" // struct partition_info
+#include "sql_table.h" // check_duplicate_warning
+#include "sql_class.h" // THD, Internal_error_handler
#include <m_ctype.h>
#include <assert.h>
=== modified file 'sql/unireg.h'
--- a/sql/unireg.h 2010-02-10 11:06:55 +0000
+++ b/sql/unireg.h 2010-04-08 10:50:40 +0000
@@ -17,8 +17,13 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include "my_global.h" /* ulonglong */
+#include "mysql_version.h" /* FRM_VER */
+
/* Extra functions used by unireg library */
+typedef struct st_ha_create_information HA_CREATE_INFO;
+
#ifndef NO_ALARM_LOOP
#define NO_ALARM_LOOP /* lib5 and popen can't use alarm */
#endif
@@ -52,72 +57,6 @@
#define ERRMAPP 1 /* Errormap f|r my_error */
-#define LIBLEN FN_REFLEN-FN_LEN /* Max l{ngd p} dev */
-/* extra 4+4 bytes for slave tmp tables */
-#define MAX_DBKEY_LENGTH (NAME_LEN*2+1+1+4+4)
-#define MAX_ALIAS_NAME 256
-#define MAX_FIELD_NAME 34 /* Max colum name length +2 */
-#define MAX_SYS_VAR_LENGTH 32
-#define MAX_KEY MAX_INDEXES /* Max used keys */
-#define MAX_REF_PARTS 16 /* Max parts used as ref */
-#define MAX_KEY_LENGTH 4096 /* max possible key */
-#define MAX_KEY_LENGTH_DECIMAL_WIDTH 4 /* strlen("4096") */
-#if SIZEOF_OFF_T > 4
-#define MAX_REFLENGTH 8 /* Max length for record ref */
-#else
-#define MAX_REFLENGTH 4 /* Max length for record ref */
-#endif
-#define MAX_HOSTNAME 61 /* len+1 in mysql.user */
-
-#define MAX_MBWIDTH 4 /* Max multibyte sequence */
-#define MAX_FIELD_CHARLENGTH 255
-#define MAX_FIELD_VARCHARLENGTH 65535
-#define MAX_FIELD_BLOBLENGTH UINT_MAX32 /* cf field_blob::get_length() */
-#define CONVERT_IF_BIGGER_TO_BLOB 512 /* Used for CREATE ... SELECT */
-
-/* Max column width +1 */
-#define MAX_FIELD_WIDTH (MAX_FIELD_CHARLENGTH*MAX_MBWIDTH+1)
-
-#define MAX_BIT_FIELD_LENGTH 64 /* Max length in bits for bit fields */
-
-#define MAX_DATE_WIDTH 10 /* YYYY-MM-DD */
-#define MAX_TIME_WIDTH 23 /* -DDDDDD HH:MM:SS.###### */
-#define MAX_DATETIME_FULL_WIDTH 29 /* YYYY-MM-DD HH:MM:SS.###### AM */
-#define MAX_DATETIME_WIDTH 19 /* YYYY-MM-DD HH:MM:SS */
-#define MAX_DATETIME_COMPRESSED_WIDTH 14 /* YYYYMMDDHHMMSS */
-
-#define MAX_TABLES (sizeof(table_map)*8-3) /* Max tables in join */
-#define PARAM_TABLE_BIT (((table_map) 1) << (sizeof(table_map)*8-3))
-#define OUTER_REF_TABLE_BIT (((table_map) 1) << (sizeof(table_map)*8-2))
-#define RAND_TABLE_BIT (((table_map) 1) << (sizeof(table_map)*8-1))
-#define PSEUDO_TABLE_BITS (PARAM_TABLE_BIT | OUTER_REF_TABLE_BIT | \
- RAND_TABLE_BIT)
-#define MAX_FIELDS 4096 /* Limit in the .frm file */
-#define MAX_PARTITIONS 1024
-
-#define MAX_SELECT_NESTING (sizeof(nesting_map)*8-1)
-
-#define MAX_SORT_MEMORY 2048*1024
-#define MIN_SORT_MEMORY 32*1024
-
-/* Memory allocated when parsing a statement / saving a statement */
-#define MEM_ROOT_BLOCK_SIZE 8192
-#define MEM_ROOT_PREALLOC 8192
-#define TRANS_MEM_ROOT_BLOCK_SIZE 4096
-#define TRANS_MEM_ROOT_PREALLOC 4096
-
-#define DEFAULT_ERROR_COUNT 64
-#define EXTRA_RECORDS 10 /* Extra records in sort */
-#define SCROLL_EXTRA 5 /* Extra scroll-rows. */
-#define FIELD_NAME_USED ((uint) 32768) /* Bit set if fieldname used */
-#define FORM_NAME_USED ((uint) 16384) /* Bit set if formname used */
-#define FIELD_NR_MASK 16383 /* To get fieldnumber */
-#define FERR -1 /* Error from my_functions */
-#define CREATE_MODE 0 /* Default mode on new files */
-#define NAMES_SEP_CHAR '\377' /* Char to sep. names */
-
-#define READ_RECORD_BUFFER (uint) (IO_SIZE*8) /* Pointer_buffer_size */
-#define DISK_BUFFER_SIZE (uint) (IO_SIZE*16) /* Size of diskbuffer */
#define ME_INFO (ME_HOLDTANG+ME_OLDWIN+ME_NOREFRESH)
#define ME_ERROR (ME_BELL+ME_OLDWIN+ME_NOREFRESH)
@@ -207,11 +146,6 @@
#define TE_INFO_LENGTH 3
#define MTYP_NOEMPTY_BIT 128
-#define FRM_VER_TRUE_VARCHAR (FRM_VER+4) /* 10 */
-#define MYSQL_VERSION_TABLESPACE_IN_FRM_CGE 50120
-#define MYSQL_VERSION_TABLESPACE_IN_FRM 50205
-#define MYSQL_VERSION_TABLESPACE_IN_FRM_STR "50205"
-
/*
Minimum length pattern before Turbo Boyer-Moore is used
for SELECT "text" LIKE "%pattern%", excluding the two
@@ -237,5 +171,18 @@
#include "mysqld_error.h"
#include "structs.h" /* All structs we need */
+#include "sql_list.h" /* List<> */
+#include "field.h" /* Create_field */
+bool mysql_create_frm(THD *thd, const char *file_name,
+ const char *db, const char *table,
+ HA_CREATE_INFO *create_info,
+ List<Create_field> &create_field,
+ uint key_count,KEY *key_info,handler *db_type);
+int rea_create_table(THD *thd, const char *path,
+ const char *db, const char *table_name,
+ HA_CREATE_INFO *create_info,
+ List<Create_field> &create_field,
+ uint key_count,KEY *key_info,
+ handler *file);
#endif
=== modified file 'storage/archive/ha_archive.cc'
--- a/storage/archive/ha_archive.cc 2010-02-25 13:55:28 +0000
+++ b/storage/archive/ha_archive.cc 2010-04-09 08:22:10 +0000
@@ -17,8 +17,10 @@
#pragma implementation // gcc: Class implementation
#endif
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#include "probes_mysql.h"
+#include "sql_class.h" // SSV
#include <myisam.h>
#include "ha_archive.h"
=== modified file 'storage/blackhole/ha_blackhole.cc'
--- a/storage/blackhole/ha_blackhole.cc 2009-12-09 07:44:39 +0000
+++ b/storage/blackhole/ha_blackhole.cc 2010-04-09 08:22:10 +0000
@@ -19,9 +19,12 @@
#endif
#define MYSQL_SERVER 1
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h"
#include "probes_mysql.h"
#include "ha_blackhole.h"
+#include "sql_class.h" // THD, SYSTEM_THREAD_SLAVE_SQL
/* Static declarations for handlerton */
=== modified file 'storage/blackhole/ha_blackhole.h'
--- a/storage/blackhole/ha_blackhole.h 2008-11-10 20:21:49 +0000
+++ b/storage/blackhole/ha_blackhole.h 2010-03-31 14:05:33 +0000
@@ -17,6 +17,10 @@
#pragma interface /* gcc class implementation */
#endif
+#include "thr_lock.h" /* THR_LOCK */
+#include "handler.h" /* handler */
+#include "table.h" /* TABLE_SHARE */
+
/*
Shared structure for correct LOCK operation
*/
=== modified file 'storage/csv/ha_tina.cc'
--- a/storage/csv/ha_tina.cc 2010-02-25 13:55:28 +0000
+++ b/storage/csv/ha_tina.cc 2010-04-08 10:50:40 +0000
@@ -45,8 +45,11 @@ TODO:
#pragma implementation // gcc: Class implementation
#endif
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "sql_class.h" // SSV
#include <mysql/plugin.h>
+#include <mysql/psi/mysql_file.h>
#include "ha_tina.h"
#include "probes_mysql.h"
=== modified file 'storage/csv/transparent_file.cc'
--- a/storage/csv/transparent_file.cc 2009-12-09 07:44:39 +0000
+++ b/storage/csv/transparent_file.cc 2010-04-09 08:22:10 +0000
@@ -17,8 +17,11 @@
#pragma implementation // gcc: Class implementation
#endif
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include <mysql/psi/mysql_file.h>
#include "transparent_file.h"
+#include "my_sys.h" // MY_WME, MY_ALLOW_ZERO_PTR, MY_SEEK_SET
Transparent_file::Transparent_file() : lower_bound(0), buff_size(IO_SIZE)
{
=== modified file 'storage/example/ha_example.cc'
--- a/storage/example/ha_example.cc 2010-01-13 06:34:01 +0000
+++ b/storage/example/ha_example.cc 2010-04-09 08:22:10 +0000
@@ -91,11 +91,12 @@
#pragma implementation // gcc: Class implementation
#endif
-#define MYSQL_SERVER 1
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "sql_class.h" // MYSQL_HANDLERTON_INTERFACE_VERSION
#include "ha_example.h"
#include "probes_mysql.h"
-#include <mysql/plugin.h>
+#include "sql_plugin.h"
static handler *example_create_handler(handlerton *hton,
TABLE_SHARE *table,
=== modified file 'storage/example/ha_example.h'
--- a/storage/example/ha_example.h 2010-03-25 09:02:07 +0000
+++ b/storage/example/ha_example.h 2010-04-08 10:50:40 +0000
@@ -35,6 +35,11 @@
#pragma interface /* gcc class implementation */
#endif
+#include "my_global.h" /* ulonglong */
+#include "thr_lock.h" /* THR_LOCK, THR_LOCK_DATA */
+#include "handler.h" /* handler */
+#include "my_base.h" /* ha_rows */
+
/** @brief
EXAMPLE_SHARE is a structure that will be shared among all open handlers.
This example implements the minimum of what you will probably need.
=== modified file 'storage/federated/ha_federated.cc'
--- a/storage/federated/ha_federated.cc 2010-03-25 09:02:07 +0000
+++ b/storage/federated/ha_federated.cc 2010-04-09 08:22:10 +0000
@@ -372,7 +372,11 @@
#define MYSQL_SERVER 1
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "sql_servers.h" // FOREIGN_SERVER, get_server_by_name
+#include "sql_class.h" // SSV
+#include "sql_analyse.h" // append_escaped
#include <mysql/plugin.h>
#ifdef USE_PRAGMA_IMPLEMENTATION
@@ -383,6 +387,7 @@
#include "probes_mysql.h"
#include "m_string.h"
+#include "key.h" // key_copy
#include <mysql/plugin.h>
=== modified file 'storage/heap/ha_heap.cc'
--- a/storage/heap/ha_heap.cc 2010-02-27 08:31:24 +0000
+++ b/storage/heap/ha_heap.cc 2010-04-09 08:22:10 +0000
@@ -19,11 +19,13 @@
#endif
#define MYSQL_SERVER 1
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#include "probes_mysql.h"
-#include <mysql/plugin.h>
+#include "sql_plugin.h"
#include "ha_heap.h"
#include "heapdef.h"
+#include "sql_base.h" // enum_tdc_remove_table_type
static handler *heap_create_handler(handlerton *hton,
TABLE_SHARE *table,
=== modified file 'storage/heap/ha_heap.h'
--- a/storage/heap/ha_heap.h 2009-07-08 12:11:34 +0000
+++ b/storage/heap/ha_heap.h 2010-03-31 14:05:33 +0000
@@ -21,6 +21,7 @@
/* class for the the heap handler */
#include <heap.h>
+#include "sql_class.h" /* THD */
class ha_heap: public handler
{
=== modified file 'storage/ibmdb2i/db2i_charsetSupport.h'
--- a/storage/ibmdb2i/db2i_charsetSupport.h 2009-02-15 02:18:30 +0000
+++ b/storage/ibmdb2i/db2i_charsetSupport.h 2010-04-09 08:22:10 +0000
@@ -37,8 +37,9 @@ OF SUCH DAMAGE.
#ifndef DB2I_CHARSETSUPPORT_H
#define DB2I_CHARSETSUPPORT_H
+#include "my_global.h"
#include "db2i_global.h"
-#include "mysql_priv.h"
+#include "sql_priv.h"
#include <mysql/plugin.h>
#include "db2i_iconv.h"
=== modified file 'storage/ibmdb2i/db2i_collationSupport.h'
--- a/storage/ibmdb2i/db2i_collationSupport.h 2009-03-09 21:20:14 +0000
+++ b/storage/ibmdb2i/db2i_collationSupport.h 2010-04-09 08:22:10 +0000
@@ -37,8 +37,9 @@ OF SUCH DAMAGE.
#ifndef DB2I_COLLATIONSUPPORT_H
#define DB2I_COLLATIONSUPPORT_H
+#include "my_global.h"
#include "db2i_global.h"
-#include "mysql_priv.h"
+#include "sql_priv.h"
int32 updateAssociatedSortSequence(const CHARSET_INFO* charset,
char* fileSortSequenceType,
=== modified file 'storage/ibmdb2i/db2i_conversion.cc'
--- a/storage/ibmdb2i/db2i_conversion.cc 2009-07-06 08:49:32 +0000
+++ b/storage/ibmdb2i/db2i_conversion.cc 2010-04-09 08:22:10 +0000
@@ -35,8 +35,9 @@ OF SUCH DAMAGE.
+#include "my_global.h"
#include "db2i_ileBridge.h"
-#include "mysql_priv.h"
+#include "sql_priv.h"
#include "db2i_charsetSupport.h"
#include "ctype.h"
#include "ha_ibmdb2i.h"
=== modified file 'storage/ibmdb2i/db2i_errors.cc'
--- a/storage/ibmdb2i/db2i_errors.cc 2009-05-05 09:33:52 +0000
+++ b/storage/ibmdb2i/db2i_errors.cc 2010-04-09 08:22:10 +0000
@@ -34,10 +34,11 @@ OF SUCH DAMAGE.
*/
+#include "my_global.h"
#include "db2i_errors.h"
#include "db2i_ileBridge.h"
#include "db2i_charsetSupport.h"
-#include "mysql_priv.h"
+#include "sql_priv.h"
#include "stdarg.h"
#define MAX_MSGSTRING 109
=== modified file 'storage/ibmdb2i/db2i_ileBridge.h'
--- a/storage/ibmdb2i/db2i_ileBridge.h 2009-03-09 21:20:14 +0000
+++ b/storage/ibmdb2i/db2i_ileBridge.h 2010-04-09 08:22:10 +0000
@@ -37,8 +37,9 @@ OF SUCH DAMAGE.
#ifndef DB2I_ILEBRIDGE_H
#define DB2I_ILEBRIDGE_H
+#include "my_global.h"
#include "db2i_global.h"
-#include "mysql_priv.h"
+#include "sql_priv.h"
#include "as400_types.h"
#include "as400_protos.h"
#include "qmyse.h"
=== modified file 'storage/ibmdb2i/db2i_ioBuffers.h'
--- a/storage/ibmdb2i/db2i_ioBuffers.h 2009-03-09 21:20:14 +0000
+++ b/storage/ibmdb2i/db2i_ioBuffers.h 2010-04-09 08:22:10 +0000
@@ -42,8 +42,9 @@ OF SUCH DAMAGE.
*/
+#include "my_global.h"
#include "db2i_validatedPointer.h"
-#include "mysql_priv.h"
+#include "sql_priv.h"
#include <sys/stat.h>
#include <fcntl.h>
#include <as400_types.h>
=== modified file 'storage/ibmdb2i/ha_ibmdb2i.cc'
--- a/storage/ibmdb2i/ha_ibmdb2i.cc 2009-12-25 14:20:11 +0000
+++ b/storage/ibmdb2i/ha_ibmdb2i.cc 2010-04-09 08:22:10 +0000
@@ -46,8 +46,9 @@ OF SUCH DAMAGE.
#pragma implementation // gcc: Class implementation
#endif
+#include "my_global.h"
#include "ha_ibmdb2i.h"
-#include "mysql_priv.h"
+#include "sql_priv.h"
#include <mysql/plugin.h>
#include "db2i_ileBridge.h"
#include "db2i_charsetSupport.h"
=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc 2010-03-24 19:14:02 +0000
+++ b/storage/innobase/handler/ha_innodb.cc 2010-04-09 08:22:10 +0000
@@ -29,8 +29,13 @@ have disabled the InnoDB inlining in thi
#pragma implementation // gcc: Class implementation
#endif
-#include <mysql_priv.h>
+#include <my_global.h>
+#include <sql_priv.h>
#include <mysqld_error.h>
+#include <sql_table.h> // explain_filename, nz2, EXPLAIN_PARTITIONS_AS_COMMENT,
+ // EXPLAIN_FILENAME_MAX_EXTRA_LENGTH
+
+#include <sql_acl.h> // PROCESS_ACL
#include <m_ctype.h>
#include <hash.h>
@@ -39,6 +44,7 @@ have disabled the InnoDB inlining in thi
#include <my_sys.h>
#include "ha_innodb.h"
#include <mysql/plugin.h>
+#include <mysql/innodb_priv.h>
/** to protect innobase_open_files */
static pthread_mutex_t innobase_share_mutex;
=== modified file 'storage/myisam/ha_myisam.cc'
--- a/storage/myisam/ha_myisam.cc 2010-03-25 09:02:07 +0000
+++ b/storage/myisam/ha_myisam.cc 2010-04-09 08:22:10 +0000
@@ -19,9 +19,11 @@
#endif
#define MYSQL_SERVER 1
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#include "probes_mysql.h"
-#include <mysql/plugin.h>
+#include "key.h" // key_copy
+#include "sql_plugin.h"
#include <m_ctype.h>
#include <my_bit.h>
#include <myisampack.h>
@@ -29,6 +31,8 @@
#include <stdarg.h>
#include "myisamdef.h"
#include "rt_index.h"
+#include "sql_table.h" // tablename_to_filename
+#include "sql_class.h" // THD
ulonglong myisam_recover_options;
static ulong opt_myisam_block_size;
=== modified file 'storage/myisam/ha_myisam.h'
--- a/storage/myisam/ha_myisam.h 2009-12-24 16:38:19 +0000
+++ b/storage/myisam/ha_myisam.h 2010-04-08 10:50:40 +0000
@@ -23,6 +23,11 @@
#include <myisam.h>
#include <myisamchk.h>
#include <ft_global.h>
+#include "handler.h" /* handler */
+#include "table.h" /* TABLE_SHARE */
+
+struct TABLE_SHARE;
+typedef struct st_ha_create_information HA_CREATE_INFO;
#define HA_RECOVER_DEFAULT 1 /* Automatic recover active */
#define HA_RECOVER_BACKUP 2 /* Make a backupfile on recover */
=== modified file 'storage/myisam/myisam_backup_engine.cc'
--- a/storage/myisam/myisam_backup_engine.cc 2010-02-26 14:25:52 +0000
+++ b/storage/myisam/myisam_backup_engine.cc 2010-04-09 08:22:10 +0000
@@ -22,7 +22,12 @@
*/
#define MYSQL_SERVER 1 // need it to have mysql_tmpdir defined
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "sql_class.h" // THD
+#include "sql_parse.h" // mysql_reset_thd_for_next_command
+#include "sql_base.h" // open_and_lock_tables, close_thread_tables
+#include "sql_table.h" // build_table_filename
#include "ha_myisam.h"
#include "myisamdef.h" // to access dfile and kfile
#include "backup/backup_engine.h"
=== modified file 'storage/myisammrg/ha_myisammrg.cc'
--- a/storage/myisammrg/ha_myisammrg.cc 2010-03-25 09:02:07 +0000
+++ b/storage/myisammrg/ha_myisammrg.cc 2010-04-09 08:22:10 +0000
@@ -90,7 +90,12 @@
#endif
#define MYSQL_SERVER 1
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "unireg.h"
+#include "sql_cache.h" // query_cache_*
+#include "sql_show.h" // append_identifier
+#include "sql_table.h" // build_table_filename
#include "probes_mysql.h"
#include <mysql/plugin.h>
#include <m_ctype.h>
@@ -98,6 +103,8 @@
#include "ha_myisammrg.h"
#include "myrg_def.h"
#include "debug_sync.h"
+#include "thr_malloc.h" // int_sql_alloc
+#include "sql_class.h" // THD
static handler *myisammrg_create_handler(handlerton *hton,
TABLE_SHARE *table,
=== modified file 'storage/perfschema/ha_perfschema.cc'
--- a/storage/perfschema/ha_perfschema.cc 2010-01-12 01:48:52 +0000
+++ b/storage/perfschema/ha_perfschema.cc 2010-04-08 10:50:40 +0000
@@ -18,7 +18,10 @@
Performance schema storage engine (implementation).
*/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "sql_plugin.h"
+#include "mysql_com.h"
#include "ha_perfschema.h"
#include "mysql/plugin.h"
#include "pfs_engine_table.h"
=== modified file 'storage/perfschema/ha_perfschema.h'
--- a/storage/perfschema/ha_perfschema.h 2010-03-14 16:19:24 +0000
+++ b/storage/perfschema/ha_perfschema.h 2010-04-08 10:50:40 +0000
@@ -16,6 +16,8 @@
#ifndef HA_PERFSCHEMA_H
#define HA_PERFSCHEMA_H
+#include "handler.h"
+
#ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */
#endif
=== modified file 'storage/perfschema/pfs.cc'
--- a/storage/perfschema/pfs.cc 2010-01-27 00:01:36 +0000
+++ b/storage/perfschema/pfs.cc 2010-04-08 15:48:00 +0000
@@ -19,6 +19,7 @@
*/
#include "my_global.h"
+#include "my_pthread.h"
#include "pfs.h"
#include "pfs_instr_class.h"
#include "pfs_instr.h"
=== modified file 'storage/perfschema/pfs.h'
--- a/storage/perfschema/pfs.h 2010-01-12 01:48:52 +0000
+++ b/storage/perfschema/pfs.h 2010-04-09 08:22:10 +0000
@@ -16,6 +16,8 @@
#ifndef PFS_H
#define PFS_H
+#include <my_pthread.h>
+
/**
@file storage/perfschema/pfs.h
Performance schema instrumentation (declarations).
@@ -23,7 +25,9 @@
#define HAVE_PSI_1
-#include <mysql_priv.h>
+#include <my_global.h>
+#include <sql_priv.h>
+#include <my_pthread.h>
#include <mysql/psi/psi.h>
extern struct PSI_bootstrap PFS_bootstrap;
=== modified file 'storage/perfschema/pfs_check.cc'
--- a/storage/perfschema/pfs_check.cc 2010-01-12 01:48:52 +0000
+++ b/storage/perfschema/pfs_check.cc 2010-04-08 10:50:40 +0000
@@ -23,7 +23,7 @@
*/
#include "my_global.h"
-#include "mysql_priv.h"
+#include "sql_priv.h"
#include "pfs_server.h"
#include "pfs_engine_table.h"
=== modified file 'storage/perfschema/pfs_column_values.cc'
--- a/storage/perfschema/pfs_column_values.cc 2010-01-12 01:48:52 +0000
+++ b/storage/perfschema/pfs_column_values.cc 2010-04-09 08:22:10 +0000
@@ -19,7 +19,8 @@
schema tables (implementation).
*/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#include "pfs_column_values.h"
LEX_STRING PERFORMANCE_SCHEMA_str=
=== modified file 'storage/perfschema/pfs_column_values.h'
--- a/storage/perfschema/pfs_column_values.h 2010-01-12 01:48:52 +0000
+++ b/storage/perfschema/pfs_column_values.h 2010-04-08 10:50:40 +0000
@@ -16,6 +16,8 @@
#ifndef PFS_COLUMN_VALUES_H
#define PFS_COLUMN_VALUES_H
+#include <m_string.h>
+
/**
@file storage/perfschema/pfs_column_values.h
Literal values for columns used in the
=== modified file 'storage/perfschema/pfs_engine_table.cc'
--- a/storage/perfschema/pfs_engine_table.cc 2010-03-02 00:17:51 +0000
+++ b/storage/perfschema/pfs_engine_table.cc 2010-04-08 10:50:40 +0000
@@ -18,8 +18,11 @@
Performance schema tables (implementation).
*/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#include "pfs_engine_table.h"
+#include "sql_base.h"
+#include "lock.h"
#include "table_events_waits.h"
#include "table_setup_consumers.h"
=== modified file 'storage/perfschema/pfs_engine_table.h'
--- a/storage/perfschema/pfs_engine_table.h 2010-01-12 01:48:52 +0000
+++ b/storage/perfschema/pfs_engine_table.h 2010-04-08 10:50:40 +0000
@@ -16,13 +16,21 @@
#ifndef PFS_ENGINE_TABLE_H
#define PFS_ENGINE_TABLE_H
+#include "my_base.h" /* ha_rows */
+#include "m_string.h"
+#include "sql_acl.h"
+
/**
@file storage/perfschema/pfs_engine_table.h
Performance schema tables (declarations).
*/
class Field;
+class TABLE;
+class THD;
struct PFS_engine_table_share;
+typedef struct st_table_field_def TABLE_FIELD_DEF;
+typedef struct st_thr_lock THR_LOCK;
/**
@addtogroup Performance_schema_engine
=== modified file 'storage/perfschema/pfs_instr.cc'
--- a/storage/perfschema/pfs_instr.cc 2010-03-22 13:12:28 +0000
+++ b/storage/perfschema/pfs_instr.cc 2010-04-08 10:50:40 +0000
@@ -19,7 +19,8 @@
*/
#include "my_global.h"
-#include "mysql_priv.h"
+#include "m_string.h"
+#include "sql_priv.h"
#include "my_sys.h"
#include "pfs_stat.h"
#include "pfs_instr.h"
=== modified file 'storage/perfschema/pfs_instr.h'
--- a/storage/perfschema/pfs_instr.h 2010-01-12 01:48:52 +0000
+++ b/storage/perfschema/pfs_instr.h 2010-04-09 08:22:10 +0000
@@ -21,7 +21,8 @@
Performance schema instruments (declarations).
*/
-#include <mysql_priv.h>
+#include <my_global.h>
+#include <sql_priv.h>
#include "pfs_lock.h"
#include "pfs_instr_class.h"
#include "pfs_events_waits.h"
=== modified file 'storage/perfschema/pfs_instr_class.h'
--- a/storage/perfschema/pfs_instr_class.h 2010-01-12 01:48:52 +0000
+++ b/storage/perfschema/pfs_instr_class.h 2010-04-09 08:22:10 +0000
@@ -16,6 +16,8 @@
#ifndef PFS_INSTR_CLASS_H
#define PFS_INSTR_CLASS_H
+#include <mysql_com.h> /* NAME_LEN */
+
/**
@file storage/perfschema/pfs_instr_class.h
Performance schema instruments meta data (declarations).
@@ -36,7 +38,9 @@
*/
#define PFS_MAX_FULL_PREFIX_NAME_LENGTH 32
-#include <mysql_priv.h>
+#include <my_global.h>
+#include <sql_priv.h>
+#include <my_pthread.h>
#include <mysql/psi/psi.h>
#include "pfs_lock.h"
#include "pfs_stat.h"
=== modified file 'storage/perfschema/pfs_server.cc'
--- a/storage/perfschema/pfs_server.cc 2010-01-12 01:48:52 +0000
+++ b/storage/perfschema/pfs_server.cc 2010-04-08 10:50:40 +0000
@@ -21,7 +21,7 @@
#include "my_global.h"
#include "my_sys.h"
#include "mysys_err.h"
-#include "mysql_priv.h"
+#include "sql_priv.h"
#include "pfs_server.h"
#include "pfs.h"
#include "pfs_global.h"
=== modified file 'storage/perfschema/table_all_instr.cc'
--- a/storage/perfschema/table_all_instr.cc 2010-01-12 01:48:52 +0000
+++ b/storage/perfschema/table_all_instr.cc 2010-04-08 10:50:40 +0000
@@ -18,7 +18,8 @@
Abstract tables for all instruments (implementation).
*/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#include "table_all_instr.h"
#include "pfs_global.h"
=== modified file 'storage/perfschema/table_events_waits.cc'
--- a/storage/perfschema/table_events_waits.cc 2010-01-12 01:48:52 +0000
+++ b/storage/perfschema/table_events_waits.cc 2010-04-08 10:50:40 +0000
@@ -18,7 +18,8 @@
Table EVENTS_WAITS_xxx (implementation).
*/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#include "table_events_waits.h"
#include "pfs_instr_class.h"
#include "pfs_instr.h"
=== modified file 'storage/perfschema/table_events_waits_summary.cc'
--- a/storage/perfschema/table_events_waits_summary.cc 2010-01-12 01:48:52 +0000
+++ b/storage/perfschema/table_events_waits_summary.cc 2010-04-08 10:50:40 +0000
@@ -18,7 +18,8 @@
Table EVENTS_WAITS_SUMMARY_BY_xxx (implementation).
*/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#include "pfs_instr_class.h"
#include "pfs_column_types.h"
#include "pfs_column_values.h"
=== modified file 'storage/perfschema/table_file_instances.cc'
--- a/storage/perfschema/table_file_instances.cc 2010-01-12 01:48:52 +0000
+++ b/storage/perfschema/table_file_instances.cc 2010-04-08 10:50:40 +0000
@@ -18,7 +18,8 @@
Table FILE_INSTANCES (implementation).
*/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#include "pfs_instr.h"
#include "pfs_column_types.h"
#include "pfs_column_values.h"
=== modified file 'storage/perfschema/table_file_summary.cc'
--- a/storage/perfschema/table_file_summary.cc 2010-01-12 01:48:52 +0000
+++ b/storage/perfschema/table_file_summary.cc 2010-04-08 10:50:40 +0000
@@ -18,7 +18,8 @@
Table FILE_SUMMARY_BY_xxx (implementation).
*/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#include "pfs_instr_class.h"
#include "pfs_column_types.h"
#include "pfs_column_values.h"
=== modified file 'storage/perfschema/table_performance_timers.cc'
--- a/storage/perfschema/table_performance_timers.cc 2010-01-12 01:48:52 +0000
+++ b/storage/perfschema/table_performance_timers.cc 2010-04-08 10:50:40 +0000
@@ -18,7 +18,8 @@
Table PERFORMANCE_TIMERS (implementation).
*/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#include "table_performance_timers.h"
#include "pfs_timer.h"
#include "pfs_global.h"
=== modified file 'storage/perfschema/table_processlist.cc'
--- a/storage/perfschema/table_processlist.cc 2010-01-12 01:48:52 +0000
+++ b/storage/perfschema/table_processlist.cc 2010-04-08 10:50:40 +0000
@@ -18,7 +18,8 @@
Table PROCESSLIST (implementation).
*/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#include "table_processlist.h"
#include "pfs_instr_class.h"
#include "pfs_instr.h"
=== modified file 'storage/perfschema/table_setup_consumers.cc'
--- a/storage/perfschema/table_setup_consumers.cc 2010-01-12 01:48:52 +0000
+++ b/storage/perfschema/table_setup_consumers.cc 2010-04-08 10:50:40 +0000
@@ -18,7 +18,8 @@
Table SETUP_CONSUMERS (implementation).
*/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#include "table_setup_consumers.h"
#include "pfs_instr.h"
#include "pfs_events_waits.h"
=== modified file 'storage/perfschema/table_setup_instruments.cc'
--- a/storage/perfschema/table_setup_instruments.cc 2010-01-12 01:48:52 +0000
+++ b/storage/perfschema/table_setup_instruments.cc 2010-04-08 10:50:40 +0000
@@ -18,7 +18,8 @@
Table SETUP_INSTRUMENTS (implementation).
*/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#include "pfs_instr_class.h"
#include "pfs_column_types.h"
#include "pfs_column_values.h"
=== modified file 'storage/perfschema/table_setup_objects.cc'
--- a/storage/perfschema/table_setup_objects.cc 2010-01-12 01:48:52 +0000
+++ b/storage/perfschema/table_setup_objects.cc 2010-04-08 10:50:40 +0000
@@ -18,7 +18,8 @@
Table SETUP_OBJECTS (implementation).
*/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#include "pfs_instr_class.h"
#include "pfs_column_types.h"
#include "pfs_column_values.h"
=== modified file 'storage/perfschema/table_setup_timers.cc'
--- a/storage/perfschema/table_setup_timers.cc 2010-01-12 01:48:52 +0000
+++ b/storage/perfschema/table_setup_timers.cc 2010-04-08 10:50:40 +0000
@@ -18,7 +18,8 @@
Table SETUP_TIMERS (implementation).
*/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#include "table_setup_timers.h"
#include "pfs_column_values.h"
#include "pfs_timer.h"
=== modified file 'storage/perfschema/table_sync_instances.cc'
--- a/storage/perfschema/table_sync_instances.cc 2010-01-12 01:48:52 +0000
+++ b/storage/perfschema/table_sync_instances.cc 2010-04-08 10:50:40 +0000
@@ -19,7 +19,8 @@
and COND_INSTANCES (implementation).
*/
-#include "mysql_priv.h"
+#include "my_global.h"
+#include "sql_priv.h"
#include "pfs_instr.h"
#include "pfs_column_types.h"
#include "pfs_column_values.h"
=== modified file 'storage/perfschema/unittest/pfs-t.cc'
--- a/storage/perfschema/unittest/pfs-t.cc 2010-03-07 18:54:05 +0000
+++ b/storage/perfschema/unittest/pfs-t.cc 2010-04-08 10:50:40 +0000
@@ -13,7 +13,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <mysql_priv.h>
+#include <my_global.h>
+#include <sql_priv.h>
#include <pfs_server.h>
#include <pfs_instr_class.h>
#include <pfs_instr.h>
=== modified file 'storage/perfschema/unittest/pfs_instr-oom-t.cc'
--- a/storage/perfschema/unittest/pfs_instr-oom-t.cc 2010-01-12 01:48:52 +0000
+++ b/storage/perfschema/unittest/pfs_instr-oom-t.cc 2010-04-08 10:50:40 +0000
@@ -13,7 +13,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <mysql_priv.h>
+#include <my_global.h>
+#include <sql_priv.h>
#include <pfs_instr.h>
#include <pfs_stat.h>
#include <pfs_global.h>
=== modified file 'storage/perfschema/unittest/pfs_instr-t.cc'
--- a/storage/perfschema/unittest/pfs_instr-t.cc 2010-01-12 01:48:52 +0000
+++ b/storage/perfschema/unittest/pfs_instr-t.cc 2010-04-08 10:50:40 +0000
@@ -13,7 +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 */
-#include <mysql_priv.h>
+#include <my_global.h>
+#include <sql_priv.h>
+#include <m_string.h>
#include <pfs_instr.h>
#include <pfs_stat.h>
#include <pfs_global.h>
=== modified file 'storage/perfschema/unittest/pfs_instr_class-oom-t.cc'
--- a/storage/perfschema/unittest/pfs_instr_class-oom-t.cc 2010-01-12 01:48:52 +0000
+++ b/storage/perfschema/unittest/pfs_instr_class-oom-t.cc 2010-04-08 10:50:40 +0000
@@ -13,7 +13,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <mysql_priv.h>
+#include <my_global.h>
+#include <sql_priv.h>
#include <pfs_instr_class.h>
#include <pfs_global.h>
#include <tap.h>
=== modified file 'storage/perfschema/unittest/pfs_instr_class-t.cc'
--- a/storage/perfschema/unittest/pfs_instr_class-t.cc 2010-01-12 01:48:52 +0000
+++ b/storage/perfschema/unittest/pfs_instr_class-t.cc 2010-04-08 10:50:40 +0000
@@ -13,7 +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 */
-#include <mysql_priv.h>
+#include <my_global.h>
+#include <sql_priv.h>
+#include <m_string.h>
#include <pfs_instr_class.h>
#include <pfs_instr.h>
#include <pfs_global.h>
=== modified file 'storage/perfschema/unittest/pfs_timer-t.cc'
--- a/storage/perfschema/unittest/pfs_timer-t.cc 2010-01-12 01:48:52 +0000
+++ b/storage/perfschema/unittest/pfs_timer-t.cc 2010-04-09 08:22:10 +0000
@@ -13,7 +13,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <mysql_priv.h>
+#include <my_global.h>
+#include <sql_priv.h>
#include <pfs_timer.h>
#include <tap.h>
=== modified file 'storage/perfschema/unittest/stub_print_error.h'
--- a/storage/perfschema/unittest/stub_print_error.h 2010-01-12 01:48:52 +0000
+++ b/storage/perfschema/unittest/stub_print_error.h 2010-04-08 10:50:40 +0000
@@ -16,6 +16,7 @@
#include <my_global.h>
#include <my_sys.h>
#include <pfs_global.h>
+#include <m_string.h>
bool pfs_initialized= false;
Attachment: [text/bzr-bundle] bzr/bjorn.munch@sun.com-20100413090059-9v7y8euicpi9hokw.bundle
| Thread |
|---|
| • bzr commit into mysql-6.0-codebase-mtr branch (Bjorn.Munch:2939) | Bjorn Munch | 13 Apr |