diff options
author | serg@serg.mylan <> | 2005-10-09 19:10:19 +0200 |
---|---|---|
committer | serg@serg.mylan <> | 2005-10-09 19:10:19 +0200 |
commit | 2e2d18b7cfb797c4b7bf9be240b1c338039f26b4 (patch) | |
tree | 77b39ce261df192477ba9a78f82bed28feb11e3e /sql | |
parent | f22fddd1aaedc410200407affaab8a474c2925e9 (diff) | |
parent | 2c7505b2638d13511db6eb27fc84dc1c37d6efde (diff) | |
download | mariadb-git-2e2d18b7cfb797c4b7bf9be240b1c338039f26b4.tar.gz |
Merge serg.mylan:/usr/home/serg/Abk/mysql-5.0
into serg.mylan:/usr/home/serg/Abk/mysql-5.1
Diffstat (limited to 'sql')
-rw-r--r-- | sql/ha_innodb.cc | 2 | ||||
-rw-r--r-- | sql/ha_ndbcluster.cc | 5 | ||||
-rw-r--r-- | sql/mysql_priv.h | 6 | ||||
-rw-r--r-- | sql/mysqld.cc | 32 | ||||
-rw-r--r-- | sql/protocol_cursor.cc | 148 | ||||
-rw-r--r-- | sql/repl_failsafe.cc | 2 | ||||
-rw-r--r-- | sql/repl_failsafe.h | 2 | ||||
-rw-r--r-- | sql/slave.cc | 10 | ||||
-rw-r--r-- | sql/slave.h | 4 | ||||
-rw-r--r-- | sql/sql_class.h | 4 | ||||
-rw-r--r-- | sql/sql_insert.cc | 4 | ||||
-rw-r--r-- | sql/sql_manager.cc | 2 | ||||
-rw-r--r-- | sql/sql_parse.cc | 8 |
13 files changed, 39 insertions, 190 deletions
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index f238a5d2532..12f8b984971 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -7044,7 +7044,7 @@ ha_innobase::cmp_ref( (const char*)ref1, len1, (const char*)ref2, len2); } else { - result = field->cmp((const char*)ref1, + result = field->key_cmp((const char*)ref1, (const char*)ref2); } diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 490d00c55d0..50d9f5b701a 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -132,7 +132,7 @@ static int ndb_get_table_statistics(Ndb*, const char *, static pthread_t ndb_util_thread; pthread_mutex_t LOCK_ndb_util_thread; pthread_cond_t COND_ndb_util_thread; -extern "C" pthread_handler_decl(ndb_util_thread_func, arg); +pthread_handler_t ndb_util_thread_func(void *arg); ulong ndb_cache_check_time; /* @@ -6004,8 +6004,7 @@ ha_ndbcluster::update_table_comment( // Utility thread main loop -extern "C" pthread_handler_decl(ndb_util_thread_func, - arg __attribute__((unused))) +pthread_handler_t ndb_util_thread_func(void *arg __attribute__((unused))) { THD *thd; /* needs to be first for thread_stack */ Ndb* ndb; diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index d46d0bd1e81..0110cb70892 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -617,8 +617,8 @@ bool multi_delete_set_locks_and_link_aux_tables(LEX *lex); void init_max_user_conn(void); void init_update_queries(void); void free_max_user_conn(void); -extern "C" pthread_handler_decl(handle_one_connection,arg); -extern "C" pthread_handler_decl(handle_bootstrap,arg); +pthread_handler_t handle_one_connection(void *arg); +pthread_handler_t handle_bootstrap(void *arg); void end_thread(THD *thd,bool put_in_cache); void flush_thread_cache(); bool mysql_execute_command(THD *thd); @@ -1062,7 +1062,7 @@ int write_record(THD *thd, TABLE *table, COPY_INFO *info); extern ulong volatile manager_status; extern bool volatile manager_thread_in_use, mqh_used; extern pthread_t manager_thread; -extern "C" pthread_handler_decl(handle_manager, arg); +pthread_handler_t handle_manager(void *arg); /* sql_test.cc */ #ifndef DBUG_OFF diff --git a/sql/mysqld.cc b/sql/mysqld.cc index e79bce9cd9e..47184a577ee 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -593,25 +593,25 @@ struct st_VioSSLAcceptorFd *ssl_acceptor_fd; /* Function declarations */ static void start_signal_handler(void); -static pthread_handler_decl(signal_hand, arg); +pthread_handler_t signal_hand(void *arg); static void mysql_init_variables(void); static void get_options(int argc,char **argv); static void set_server_version(void); static int init_thread_environment(); static char *get_relative_path(const char *path); static void fix_paths(void); -extern "C" pthread_handler_decl(handle_connections_sockets,arg); -extern "C" pthread_handler_decl(kill_server_thread,arg); +pthread_handler_t handle_connections_sockets(void *arg); +pthread_handler_t kill_server_thread(void *arg); static void bootstrap(FILE *file); static void close_server_sock(); static bool read_init_file(char *file_name); #ifdef __NT__ -extern "C" pthread_handler_decl(handle_connections_namedpipes,arg); +pthread_handler_t handle_connections_namedpipes(void *arg); #endif #ifdef HAVE_SMEM -static pthread_handler_decl(handle_connections_shared_memory,arg); +pthread_handler_t handle_connections_shared_memory(void *arg); #endif -extern "C" pthread_handler_decl(handle_slave,arg); +pthread_handler_t handle_slave(void *arg); static ulong find_bit_type(const char *x, TYPELIB *bit_lib); static void clean_up(bool print_message); static void clean_up_mutexes(void); @@ -960,7 +960,7 @@ static void __cdecl kill_server(int sig_ptr) #if defined(USE_ONE_SIGNAL_HAND) || (defined(__NETWARE__) && defined(SIGNALS_DONT_BREAK_READ)) -extern "C" pthread_handler_decl(kill_server_thread,arg __attribute__((unused))) +pthread_handler_t kill_server_thread(void *arg __attribute__((unused))) { my_thread_init(); // Initialize new thread kill_server(0); @@ -2170,7 +2170,7 @@ static void start_signal_handler(void) /* This threads handles all signals and alarms */ /* ARGSUSED */ -static void *signal_hand(void *arg __attribute__((unused))) +pthread_handler_t signal_hand(void *arg __attribute__((unused))) { sigset_t set; int sig; @@ -2391,7 +2391,7 @@ int uname(struct utsname *a) } -extern "C" pthread_handler_decl(handle_shutdown,arg) +pthread_handler_t handle_shutdown(void *arg) { MSG msg; my_thread_init(); @@ -2420,7 +2420,7 @@ int STDCALL handle_kill(ulong ctrl_type) #ifdef OS2 -extern "C" pthread_handler_decl(handle_shutdown,arg) +pthread_handler_t handle_shutdown(void *arg) { my_thread_init(); @@ -3742,8 +3742,7 @@ inline void kill_broken_server() /* Handle new connections and spawn new process to handle them */ #ifndef EMBEDDED_LIBRARY -extern "C" pthread_handler_decl(handle_connections_sockets, - arg __attribute__((unused))) +pthread_handler_t handle_connections_sockets(void *arg __attribute__((unused))) { my_socket sock,new_sock; uint error_count=0; @@ -3957,7 +3956,7 @@ extern "C" pthread_handler_decl(handle_connections_sockets, #ifdef __NT__ -extern "C" pthread_handler_decl(handle_connections_namedpipes,arg) +pthread_handler_t handle_connections_namedpipes(void *arg) { HANDLE hConnectedPipe; BOOL fConnected; @@ -4043,17 +4042,16 @@ extern "C" pthread_handler_decl(handle_connections_namedpipes,arg) Thread of shared memory's service SYNOPSIS - pthread_handler_decl() - handle_connections_shared_memory Thread handle + handle_connections_shared_memory() arg Arguments of thread */ #ifdef HAVE_SMEM -pthread_handler_decl(handle_connections_shared_memory,arg) +pthread_handler_t handle_connections_shared_memory(void *arg) { /* file-mapping object, use for create shared memory */ HANDLE handle_connect_file_map= 0; - char *handle_connect_map= 0; // pointer on shared memory + char *handle_connect_map= 0; // pointer on shared memory HANDLE event_connect_answer= 0; ulong smem_buffer_length= shared_memory_buffer_length + 4; ulong connect_number= 1; diff --git a/sql/protocol_cursor.cc b/sql/protocol_cursor.cc deleted file mode 100644 index 093a2bf2b90..00000000000 --- a/sql/protocol_cursor.cc +++ /dev/null @@ -1,148 +0,0 @@ -/* Copyright (C) 2000-2003 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/* - Low level functions for storing data to be send to the MySQL client - The actual communction is handled by the net_xxx functions in net_serv.cc -*/ - -#ifdef USE_PRAGMA_IMPLEMENTATION -#pragma implementation // gcc: Class implementation -#endif - -#include "mysql_priv.h" -#include <mysql.h> - -bool Protocol_cursor::send_fields(List<Item> *list, uint flags) -{ - List_iterator_fast<Item> it(*list); - Item *item; - MYSQL_FIELD *client_field; - DBUG_ENTER("Protocol_cursor::send_fields"); - - if (prepare_for_send(list)) - return FALSE; - - fields= (MYSQL_FIELD *)alloc_root(alloc, sizeof(MYSQL_FIELD) * field_count); - if (!fields) - goto err; - - for (client_field= fields; (item= it++) ; client_field++) - { - Send_field server_field; - item->make_field(&server_field); - - client_field->db= strdup_root(alloc, server_field.db_name); - client_field->table= strdup_root(alloc, server_field.table_name); - client_field->name= strdup_root(alloc, server_field.col_name); - client_field->org_table= strdup_root(alloc, server_field.org_table_name); - client_field->org_name= strdup_root(alloc, server_field.org_col_name); - client_field->catalog= strdup_root(alloc, ""); - client_field->length= server_field.length; - client_field->type= server_field.type; - client_field->flags= server_field.flags; - client_field->decimals= server_field.decimals; - client_field->db_length= strlen(client_field->db); - client_field->table_length= strlen(client_field->table); - client_field->name_length= strlen(client_field->name); - client_field->org_name_length= strlen(client_field->org_name); - client_field->org_table_length= strlen(client_field->org_table); - client_field->catalog_length= 0; - client_field->charsetnr= server_field.charsetnr; - - if (INTERNAL_NUM_FIELD(client_field)) - client_field->flags|= NUM_FLAG; - - if (flags & (uint) Protocol::SEND_DEFAULTS) - { - char buff[80]; - String tmp(buff, sizeof(buff), default_charset_info), *res; - - if (!(res=item->val_str(&tmp))) - client_field->def= (char*) ""; - else - client_field->def= strmake_root(alloc, res->ptr(), res->length()); - } - else - client_field->def=0; - client_field->max_length= 0; - } - - DBUG_RETURN(FALSE); - -err: - my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), - MYF(0)); /* purecov: inspected */ - DBUG_RETURN(TRUE); /* purecov: inspected */ -} - - -/* Get the length of next field. Change parameter to point at fieldstart */ - -bool Protocol_cursor::write() -{ - byte *cp= (byte *)packet->ptr(); - byte *end_pos= (byte *)packet->ptr() + packet->length(); - ulong len; - MYSQL_FIELD *cur_field= fields; - MYSQL_FIELD *fields_end= fields + field_count; - MYSQL_ROWS *new_record; - byte **data_tmp; - byte *to; - - new_record= (MYSQL_ROWS *)alloc_root(alloc, - sizeof(MYSQL_ROWS) + (field_count + 2)*sizeof(char *) + packet->length()); - if (!new_record) - goto err; - data_tmp= (byte **)(new_record + 1); - new_record->data= (char **)data_tmp; - - to= (byte *)data_tmp + (field_count + 2)*sizeof(char *); - - for (; cur_field < fields_end; cur_field++, data_tmp++) - { - if ((len= net_field_length((uchar **)&cp)) == NULL_LENGTH) - { - *data_tmp= 0; - } - else - { - if ((long)len > (end_pos - cp)) - { - // TODO error signal send_error(thd, CR_MALFORMED_PACKET); - return TRUE; - } - *data_tmp= to; - memcpy(to,(char*) cp,len); - to[len]=0; - to+=len+1; - cp+=len; - if (cur_field->max_length < len) - cur_field->max_length=len; - } - } - data_tmp[0]= to; // Pointer to last used byte - data_tmp[1]= 0; - - *prev_record= new_record; - prev_record= &new_record->next; - new_record->next= NULL; - row_count++; - return FALSE; - err: - // TODO error signal send_error(thd, ER_OUT_OF_RESOURCES); - return TRUE; -} diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc index 93aafbdc0e0..35035a8b5a5 100644 --- a/sql/repl_failsafe.cc +++ b/sql/repl_failsafe.cc @@ -579,7 +579,7 @@ int find_recovery_captain(THD* thd, MYSQL* mysql) } -pthread_handler_decl(handle_failsafe_rpl,arg) +pthread_handler_t handle_failsafe_rpl(void *arg) { DBUG_ENTER("handle_failsafe_rpl"); THD *thd = new THD; diff --git a/sql/repl_failsafe.h b/sql/repl_failsafe.h index dfaacf557e8..19849e63af9 100644 --- a/sql/repl_failsafe.h +++ b/sql/repl_failsafe.h @@ -31,7 +31,7 @@ extern pthread_cond_t COND_rpl_status; extern TYPELIB rpl_role_typelib, rpl_status_typelib; extern const char* rpl_role_type[], *rpl_status_type[]; -pthread_handler_decl(handle_failsafe_rpl,arg); +pthread_handler_t handle_failsafe_rpl(void *arg); void change_rpl_status(RPL_STATUS from_status, RPL_STATUS to_status); int find_recovery_captain(THD* thd, MYSQL* mysql); int update_slave_list(MYSQL* mysql, MASTER_INFO* mi); diff --git a/sql/slave.cc b/sql/slave.cc index fb7b9275d0d..279be4d9c8c 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -2949,7 +2949,7 @@ on this slave.\ /* Slave I/O Thread entry point */ -extern "C" pthread_handler_decl(handle_slave_io,arg) +pthread_handler_t handle_slave_io(void *arg) { THD *thd; // needs to be first for thread_stack MYSQL *mysql; @@ -3258,7 +3258,7 @@ err: #ifndef DBUG_OFF if (abort_slave_event_count && !events_till_abort) goto slave_begin; -#endif +#endif my_thread_end(); pthread_exit(0); DBUG_RETURN(0); // Can't return anything here @@ -3267,11 +3267,11 @@ err: /* Slave SQL Thread entry point */ -extern "C" pthread_handler_decl(handle_slave_sql,arg) +pthread_handler_t handle_slave_sql(void *arg) { THD *thd; /* needs to be first for thread_stack */ char llbuff[22],llbuff1[22]; - RELAY_LOG_INFO* rli = &((MASTER_INFO*)arg)->rli; + RELAY_LOG_INFO* rli = &((MASTER_INFO*)arg)->rli; const char *errmsg; // needs to call my_thread_init(), otherwise we get a coredump in DBUG_ stuff @@ -3279,7 +3279,7 @@ extern "C" pthread_handler_decl(handle_slave_sql,arg) DBUG_ENTER("handle_slave_sql"); #ifndef DBUG_OFF -slave_begin: +slave_begin: #endif DBUG_ASSERT(rli->inited); diff --git a/sql/slave.h b/sql/slave.h index 486bb3055f5..d99145cbe47 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -547,8 +547,8 @@ void set_slave_thread_options(THD* thd); void set_slave_thread_default_charset(THD* thd, RELAY_LOG_INFO *rli); void rotate_relay_log(MASTER_INFO* mi); -extern "C" pthread_handler_decl(handle_slave_io,arg); -extern "C" pthread_handler_decl(handle_slave_sql,arg); +pthread_handler_t handle_slave_io(void *arg); +pthread_handler_t handle_slave_sql(void *arg); extern bool volatile abort_loop; extern MASTER_INFO main_mi, *active_mi; /* active_mi for multi-master */ extern LIST master_list; diff --git a/sql/sql_class.h b/sql/sql_class.h index 727ed282836..9e751c37608 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1158,8 +1158,8 @@ public: thread is (and must remain, for now) the only responsible for freeing these 3 members. If you add members here, and you add code to set them in replication, don't forget to free_them_and_set_them_to_0 in replication - properly. For details see the 'err:' label of the pthread_handler_decl of - the slave SQL thread, in sql/slave.cc. + properly. For details see the 'err:' label of the handle_slave_sql() + in sql/slave.cc. */ char *db, *catalog; Security_context main_security_ctx; diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index d1122cf2ac4..beca9842e6d 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -28,7 +28,7 @@ static TABLE *delayed_get_table(THD *thd,TABLE_LIST *table_list); static int write_delayed(THD *thd,TABLE *table, enum_duplicates dup, bool ignore, char *query, uint query_length, bool log_on); static void end_delayed_insert(THD *thd); -extern "C" pthread_handler_decl(handle_delayed_insert,arg); +pthread_handler_t handle_delayed_insert(void *arg); static void unlink_blobs(register TABLE *table); #endif static bool check_view_insertability(THD *thd, TABLE_LIST *view); @@ -1704,7 +1704,7 @@ void kill_delayed_threads(void) * Create a new delayed insert thread */ -extern "C" pthread_handler_decl(handle_delayed_insert,arg) +pthread_handler_t handle_delayed_insert(void *arg) { delayed_insert *di=(delayed_insert*) arg; THD *thd= &di->thd; diff --git a/sql/sql_manager.cc b/sql/sql_manager.cc index 0af6a80d4c2..34334d3a01d 100644 --- a/sql/sql_manager.cc +++ b/sql/sql_manager.cc @@ -32,7 +32,7 @@ pthread_t manager_thread; pthread_mutex_t LOCK_manager; pthread_cond_t COND_manager; -extern "C" pthread_handler_decl(handle_manager,arg __attribute__((unused))) +pthread_handler_t handle_manager(void *arg __attribute__((unused))) { int error = 0; ulong status; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 48dc8f68707..f5391cd546d 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1048,7 +1048,7 @@ void execute_init_command(THD *thd, sys_var_str *init_command_var, } -pthread_handler_decl(handle_one_connection,arg) +pthread_handler_t handle_one_connection(void *arg) { THD *thd=(THD*) arg; uint launch_time = @@ -1184,7 +1184,7 @@ end_thread: Used when creating the initial grant tables */ -extern "C" pthread_handler_decl(handle_bootstrap,arg) +pthread_handler_t handle_bootstrap(void *arg) { THD *thd=(THD*) arg; FILE *file=bootstrap_file; @@ -2946,7 +2946,7 @@ end_with_restore_list: To prevent that, refuse SLAVE STOP if the client thread has locked tables */ - if (thd->locked_tables || thd->active_transaction()) + if (thd->locked_tables || thd->active_transaction() || thd->global_read_lock) { my_message(ER_LOCK_OR_ACTIVE_TRANSACTION, ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0)); @@ -5004,7 +5004,7 @@ check_table_access(THD *thd, ulong want_access,TABLE_LIST *tables, for (; tables; tables= tables->next_global) { if (tables->schema_table && - (want_access & ~(SELECT_ACL | EXTRA_ACL))) + (want_access & ~(SELECT_ACL | EXTRA_ACL | FILE_ACL))) { if (!no_errors) my_error(ER_DBACCESS_DENIED_ERROR, MYF(0), |