summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libmysql/libmysql.def140
-rw-r--r--libmysqld/lib_load.cc5
-rw-r--r--libmysqld/lib_sql.cc6
-rw-r--r--libmysqld/libmysqld.def72
-rw-r--r--sql/mysqld.cc13
-rw-r--r--sql/net_serv.cc33
-rw-r--r--sql/sql_cache.cc5
7 files changed, 207 insertions, 67 deletions
diff --git a/libmysql/libmysql.def b/libmysql/libmysql.def
index 47e182b6de4..9405ecd58ff 100644
--- a/libmysql/libmysql.def
+++ b/libmysql/libmysql.def
@@ -2,33 +2,95 @@ LIBRARY LIBMYSQL
DESCRIPTION 'MySQL 4.0 Client Library'
VERSION 4.0
EXPORTS
-
- mysql_num_rows
- mysql_num_fields
+ mysql_affected_rows
+ mysql_close
+ mysql_connect
+ mysql_create_db
+ mysql_data_seek
+ mysql_debug
+ mysql_drop_db
+ mysql_dump_debug_info
mysql_eof
+ mysql_errno
+ mysql_error
+ mysql_escape_string
+ mysql_fetch_field
mysql_fetch_field_direct
mysql_fetch_fields
- mysql_row_tell
- mysql_field_tell
+ mysql_fetch_lengths
+ mysql_fetch_row
mysql_field_count
- mysql_affected_rows
- mysql_insert_id
- mysql_errno
- mysql_error
+ mysql_field_seek
+ mysql_field_tell
+ mysql_free_result
+ mysql_get_client_info
+ mysql_get_host_info
+ mysql_get_proto_info
+ mysql_get_server_info
mysql_info
- mysql_thread_id
- mysql_character_set_name
mysql_init
- mysql_ssl_set
- mysql_ssl_clear
- mysql_change_user
+ mysql_insert_id
+ mysql_kill
+ mysql_list_dbs
+ mysql_list_fields
+ mysql_list_processes
+ mysql_list_tables
+ mysql_num_fields
+ mysql_num_rows
+ mysql_odbc_escape_string
+ mysql_options
+ mysql_ping
+ mysql_query
mysql_real_connect
- mysql_close
+ mysql_real_query
+ mysql_refresh
+ mysql_row_seek
+ mysql_row_tell
mysql_select_db
- mysql_query
+ mysql_shutdown
+ mysql_stat
+ mysql_store_result
+ mysql_thread_id
+ mysql_use_result
+ bmove_upp
+ delete_dynamic
+ _dig_vec
+ init_dynamic_array
+ insert_dynamic
+ int2str
+ is_prefix
+ list_add
+ list_delete
+ max_allowed_packet
+ my_casecmp
+ my_init
+ my_end
+ my_strdup
+ my_malloc
+ my_memdup
+ my_no_flags_free
+ my_realloc
+ my_thread_end
+ my_thread_init
+ net_buffer_length
+ set_dynamic
+ strcend
+ strdup_root
+ strfill
+ strinstr
+ strmake
+ strmov
+ strxmov
+ myodbc_remove_escape
+ mysql_thread_safe
+ mysql_character_set_name
+ mysql_change_user
mysql_send_query
mysql_read_query_result
- mysql_real_query
+ mysql_real_escape_string
+ mysql_ssl_set
+ mysql_ssl_clear
+ mysql_real_connect
mysql_master_query
mysql_master_send_query
mysql_slave_query
@@ -43,34 +105,18 @@ EXPORTS
mysql_rpl_probe
mysql_set_master
mysql_add_slave
- mysql_shutdown
- mysql_dump_debug_info
- mysql_refresh
- mysql_kill
- mysql_ping
- mysql_stat
- mysql_get_server_info
- mysql_get_client_info
- mysql_get_host_info
- mysql_get_proto_info
- mysql_list_dbs
- mysql_list_tables
- mysql_list_fields
- mysql_list_processes
- mysql_store_result
- mysql_use_result
- mysql_options
- mysql_free_result
- mysql_data_seek
- mysql_row_seek
- mysql_field_seek
- mysql_fetch_row
- mysql_fetch_lengths
- mysql_fetch_field
- mysql_escape_string
- mysql_real_escape_string
- mysql_debug
- mysql_odbc_escape_string
- myodbc_remove_escape
- mysql_thread_safe
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/libmysqld/lib_load.cc b/libmysqld/lib_load.cc
index 37bd611b483..3db5a2488d1 100644
--- a/libmysqld/lib_load.cc
+++ b/libmysqld/lib_load.cc
@@ -36,4 +36,9 @@ mysql_load(THD * thd, sql_exchange * ex, TABLE_LIST * table_list,
#define mysql_load mysql_load_internal
+
+#if defined (__WIN__)
+#include "../sql/sql_load.cpp"
+#else
#include "../sql/sql_load.cc"
+#endif
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index ed666659af1..1e3ed54ac88 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -24,8 +24,10 @@
#define main main1
#define mysql_unix_port mysql_inix_port1
#define mysql_port mysql_port1
+#if !defined(__WIN__)
#define net_read_timeout net_read_timeout1
#define net_write_timeout net_write_timeout1
+#endif
#define changeable_vars changeable_vars1
extern "C"
@@ -45,7 +47,11 @@ static bool check_user(THD *thd, enum_server_command command,
void free_defaults_internal(char ** argv) {if (argv) free_defaults(argv);}
#define free_defaults free_defaults_internal
+#if defined (__WIN__)
+#include "../sql/mysqld.cpp"
+#else
#include "../sql/mysqld.cc"
+#endif
#define SCRAMBLE_LENGTH 8
C_MODE_START
diff --git a/libmysqld/libmysqld.def b/libmysqld/libmysqld.def
new file mode 100644
index 00000000000..0e126aa9ceb
--- /dev/null
+++ b/libmysqld/libmysqld.def
@@ -0,0 +1,72 @@
+LIBRARY LIBMYSQLD
+DESCRIPTION 'MySQL 4.0 Embedded Server Library'
+VERSION 4.0
+EXPORTS
+ mysql_server_end
+ mysql_server_init
+ mysql_use_result
+ mysql_thread_safe
+ mysql_thread_id
+ mysql_store_result
+ mysql_stat
+ mysql_shutdown
+ mysql_select_db
+ mysql_row_tell
+ mysql_row_seek
+ mysql_real_query
+ mysql_real_connect
+ mysql_query
+ mysql_ping
+ mysql_options
+ mysql_num_rows
+ mysql_num_fields
+ mysql_list_tables
+ mysql_list_processes
+ mysql_list_fields
+ mysql_list_dbs
+ mysql_kill
+ mysql_insert_id
+ mysql_init
+ mysql_info
+ mysql_get_server_info
+ mysql_get_proto_info
+ mysql_get_host_info
+ mysql_get_client_info
+ mysql_free_result
+ mysql_field_tell
+ mysql_field_count
+ mysql_field_seek
+ mysql_fetch_row
+ mysql_fetch_lengths
+ mysql_fetch_fields
+ mysql_fetch_field_direct
+ mysql_fetch_field
+ mysql_escape_string
+ mysql_real_escape_string
+ mysql_error
+ mysql_errno
+ mysql_eof
+ mysql_dump_debug_info
+ mysql_drop_db
+ mysql_debug
+ mysql_data_seek
+ mysql_create_db
+ mysql_character_set_name
+ mysql_change_user
+ mysql_connect
+ mysql_close
+ mysql_affected_rows
+ mysql_thread_init
+ mysql_thread_end
+ mysql_send_query
+ mysql_read_query_result
+ mysql_refresh
+ mysql_odbc_escape_string
+ myodbc_remove_escape
+
+
+
+
+
+
+
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 8e9ff17387c..01fc23cdd38 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -380,10 +380,12 @@ enum db_type default_table_type=DB_TYPE_MYISAM;
#ifdef __WIN__
#undef getpid
#include <process.h>
+#if !defined(EMBEDDED_LIBRARY)
HANDLE hEventShutdown;
#include "nt_servc.h"
static NTService Service; // Service object for WinNT
#endif
+#endif
#ifdef OS2
pthread_cond_t eventShutdown;
@@ -609,6 +611,7 @@ void kill_mysql(void)
#endif
#if defined(__WIN__)
+#if !defined(EMBEDDED_LIBRARY)
{
if (!SetEvent(hEventShutdown))
{
@@ -621,6 +624,7 @@ void kill_mysql(void)
CloseHandle(hEvent);
*/
}
+#endif
#elif defined(OS2)
pthread_cond_signal( &eventShutdown); // post semaphore
#elif defined(HAVE_PTHREAD_KILL)
@@ -1558,8 +1562,9 @@ pthread_handler_decl(handle_shutdown,arg)
/* this call should create the message queue for this thread */
PeekMessage(&msg, NULL, 1, 65534,PM_NOREMOVE);
-
+#if !defined(EMBEDDED_LIBRARY)
if (WaitForSingleObject(hEventShutdown,INFINITE)==WAIT_OBJECT_0)
+#endif
kill_server(MYSQL_KILL_SIGNAL);
return 0;
}
@@ -1976,7 +1981,7 @@ The server will not act as a slave.");
}
}
(void) thr_setconcurrency(concurrency); // 10 by default
-#ifdef __WIN__ //IRENA
+#if defined(__WIN__) && !defined(EMBEDDED_LIBRARY) //IRENA
{
hEventShutdown=CreateEvent(0, FALSE, FALSE, "MySqlShutdown");
pthread_t hThread;
@@ -2084,6 +2089,7 @@ The server will not act as a slave.");
sql_print_error("After lock_thread_count");
#endif
#else
+#if !defined(EMBEDDED_LIBRARY)
if (Service.IsNT())
{
if(start_mode)
@@ -2103,6 +2109,7 @@ The server will not act as a slave.");
if(hEventShutdown) CloseHandle(hEventShutdown);
}
#endif
+#endif
#ifdef HAVE_OPENSSL
my_free((gptr)ssl_acceptor_fd,MYF(MY_ALLOW_ZERO_PTR));
#endif /* HAVE_OPENSSL */
@@ -2123,7 +2130,7 @@ The server will not act as a slave.");
}
-#ifdef __WIN__
+#if defined(__WIN__) && !defined(EMBEDDED_LIBRARY)
/* ------------------------------------------------------------------------
main and thread entry function for Win32
(all this is needed only to run mysqld as a service on WinNT)
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index 22d89386516..7a1d25e980d 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -62,12 +62,12 @@ ulong net_read_timeout= NET_READ_TIMEOUT;
ulong net_write_timeout= NET_WRITE_TIMEOUT;
#endif
-#ifdef __WIN__
-/* The following is because alarms doesn't work on windows. */
-#undef MYSQL_SERVER
+#if defined(__WIN__) || !defined(MYSQL_SERVER)
+ /* The following is because alarms doesn't work on windows. */
+#define NO_ALARM
#endif
-
-#ifdef MYSQL_SERVER
+
+#ifndef NO_ALARM
#include "my_pthread.h"
void sql_print_error(const char *format,...);
#define RETRY_COUNT mysqld_net_retry_count
@@ -79,7 +79,7 @@ extern pthread_mutex_t LOCK_bytes_sent , LOCK_bytes_received;
#define statistic_add(A,B,C)
#define DONT_USE_THR_ALARM
#define RETRY_COUNT 1
-#endif /* MYSQL_SERVER */
+#endif /* NO_ALARM */
#include "thr_alarm.h"
@@ -322,14 +322,14 @@ net_real_write(NET *net,const char *packet,ulong len)
long int length;
char *pos,*end;
thr_alarm_t alarmed;
-#if defined(MYSQL_SERVER)
+#ifndef NO_ALARM
ALARM alarm_buff;
#endif
uint retry_count=0;
my_bool net_blocking = vio_is_blocking(net->vio);
DBUG_ENTER("net_real_write");
-#ifdef USE_QUERY_CACHE
+#ifdef MYSQL_SERVER
if (net->query_cache_query != 0)
query_cache_insert(net, packet, len);
#endif
@@ -371,13 +371,13 @@ net_real_write(NET *net,const char *packet,ulong len)
#endif /* HAVE_COMPRESS */
/* DBUG_DUMP("net",packet,len); */
-#ifdef MYSQL_SERVER
+#ifndef NO_ALARM
thr_alarm_init(&alarmed);
if (net_blocking)
thr_alarm(&alarmed,(uint) net_write_timeout,&alarm_buff);
#else
alarmed=0;
-#endif /* MYSQL_SERVER */
+#endif /* NO_ALARM */
pos=(char*) packet; end=pos+len;
while (pos != end)
@@ -459,8 +459,7 @@ net_real_write(NET *net,const char *packet,ulong len)
** Read something from server/clinet
*****************************************************************************/
-#ifdef MYSQL_SERVER
-
+#ifndef NO_ALARM
/*
Help function to clear the commuication buffer when we get a too
big packet
@@ -493,7 +492,7 @@ static void my_net_skip_rest(NET *net, uint32 remain, thr_alarm_t *alarmed)
statistic_add(bytes_received,length,&LOCK_bytes_received);
}
}
-#endif /* MYSQL_SERVER */
+#endif /* NO_ALARM */
/*
@@ -510,7 +509,7 @@ my_real_read(NET *net, ulong *complen)
uint i,retry_count=0;
ulong len=packet_error;
thr_alarm_t alarmed;
-#if defined(MYSQL_SERVER)
+#ifndef NO_ALARM
ALARM alarm_buff;
#endif
my_bool net_blocking=vio_is_blocking(net->vio);
@@ -520,10 +519,10 @@ my_real_read(NET *net, ulong *complen)
net->reading_or_writing=1;
thr_alarm_init(&alarmed);
-#ifdef MYSQL_SERVER
+#ifndef NO_ALARM
if (net_blocking)
thr_alarm(&alarmed,net->timeout,&alarm_buff);
-#endif /* MYSQL_SERVER */
+#endif /* NO_ALARM */
pos = net->buff + net->where_b; /* net->packet -4 */
for (i=0 ; i < 2 ; i++)
@@ -646,7 +645,7 @@ my_real_read(NET *net, ulong *complen)
{
if (net_realloc(net,helping))
{
-#ifdef MYSQL_SERVER
+#ifndef NO_ALARM
if (i == 1)
my_net_skip_rest(net, (uint32) len, &alarmed);
#endif
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index 391fdc1abf4..759aeceea76 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -1167,6 +1167,11 @@ void Query_cache::pack(ulong join_limit, uint iteration_limit)
void Query_cache::destroy()
{
+ if ( !initialized )
+ {
+ DBUG_PRINT("qcache", ("Query Cache not initialized"));
+ return;
+ }
DBUG_ENTER("Query_cache::destroy");
free_cache(1);
pthread_mutex_destroy(&structure_guard_mutex);