summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/item_cmpfunc.h3
-rw-r--r--sql/mysql_priv.h2
-rw-r--r--sql/mysqld.cc46
-rw-r--r--sql/net_pkg.cc15
-rw-r--r--sql/records.cc9
-rw-r--r--sql/sql_delete.cc10
-rw-r--r--sql/sql_handler.cc9
-rw-r--r--sql/sql_table.cc2
-rw-r--r--sql/structs.h2
9 files changed, 32 insertions, 66 deletions
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index 5efda9ce88c..f7ade97940c 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -475,8 +475,7 @@ public:
if (!(used_tables_cache=args[0]->used_tables()))
{
/* Remember if the value is always NULL or never NULL */
- args[0]->val();
- cached_value= args[0]->null_value ? (longlong) 1 : (longlong) 0;
+ cached_value= (longlong) args[0]->is_null();
}
}
}
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index d9a4302ce0c..83b41359192 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -494,7 +494,7 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables,
/* sql_handler.cc */
int mysql_ha_open(THD *thd, TABLE_LIST *tables);
int mysql_ha_close(THD *thd, TABLE_LIST *tables, bool dont_send_ok=0);
-int mysql_ha_closeall(THD *thd, TABLE_LIST *tables, bool dont_send_ok=0);
+int mysql_ha_closeall(THD *thd, TABLE_LIST *tables);
int mysql_ha_read(THD *, TABLE_LIST *,enum enum_ha_read_modes,char *,
List<Item> *,enum ha_rkey_function,Item *,ha_rows,ha_rows);
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 98cb5159e93..324355e6f17 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -760,7 +760,7 @@ void kill_mysql(void)
#if defined(OS2) || defined(__NETWARE__)
extern "C" void kill_server(int sig_ptr)
-#define RETURN_FROM_KILL_SERVER DBUG_RETURN
+#define RETURN_FROM_KILL_SERVER DBUG_VOID_RETURN
#elif !defined(__WIN__)
static void *kill_server(void *sig_ptr)
#define RETURN_FROM_KILL_SERVER DBUG_RETURN(0)
@@ -777,9 +777,6 @@ static void __cdecl kill_server(int sig_ptr)
RETURN_FROM_KILL_SERVER;
kill_in_progress=TRUE;
abort_loop=1; // This should be set
-#ifdef __NETWARE__
- ActivateScreen(getscreenhandle()); // Show the screen going down
-#endif
signal(sig,SIG_IGN);
if (sig == MYSQL_KILL_SIGNAL || sig == 0)
sql_print_error(ER(ER_NORMAL_SHUTDOWN),my_progname);
@@ -1392,7 +1389,6 @@ static void check_data_home(const char *path)
// down server event callback
void mysql_down_server_cb(void *, void *)
{
- setscreenmode(SCR_AUTOCLOSE_ON_EXIT); // auto close the screen
kill_server(0);
}
@@ -1448,26 +1444,6 @@ static void start_signal_handler(void)
static void check_data_home(const char *path)
{
- struct volume_info vol;
- char buff[PATH_MAX], *pos;
-
- bzero((char*) &vol, sizeof(vol)); // clear struct
-
- // find volume name
- if ((pos= strchr(path, ':')))
- {
- uint length= (uint) (pos-path);
- strmake(buff, path, min(length, sizeof(buff)-1));
- }
- else
- strmov(buff, "SYS"); // assume SYS volume
-
- netware_vol_info_from_name(&vol, buff); // retrieve information
- if ((vol.flags & VOL_NSS_PRESENT) == 0)
- {
- sql_print_error("Error: %s is not on an NSS volume!", path);
- unireg_abort(-1);
- }
}
#elif defined(__EMX__)
@@ -2005,11 +1981,6 @@ int main(int argc, char **argv)
start_time=time((time_t*) 0);
-#ifdef __NETWARE__
- printf("MySQL Server %s, for %s (%s)\n", VERSION, SYSTEM_TYPE, MACHINE_TYPE);
- fflush(stdout);
-#endif /* __NETWARE__ */
-
#ifdef OS2
{
// fix timezone for daylight saving
@@ -2764,7 +2735,11 @@ inline void kill_broken_server()
(!opt_disable_networking && ip_sock == INVALID_SOCKET))
{
select_thread_in_use = 0;
+#ifdef __NETWARE__
+ kill_server(MYSQL_KILL_SIGNAL); /* never returns */
+#else
kill_server((void*)MYSQL_KILL_SIGNAL); /* never returns */
+#endif /* __NETWARE__ */
}
}
#define MAYBE_BROKEN_SYSCALL kill_broken_server();
@@ -3181,8 +3156,7 @@ enum options {
OPT_BDB_CACHE_SIZE,
OPT_BDB_LOG_BUFFER_SIZE,
OPT_BDB_MAX_LOCK,
- OPT_ERROR_LOG_FILE,
- OPT_AUTOCLOSE
+ OPT_ERROR_LOG_FILE
};
@@ -3192,9 +3166,6 @@ struct my_option my_long_options[] =
{
{"ansi", 'a', "Use ANSI SQL syntax instead of MySQL syntax", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
-#ifdef __NETWARE__
- {"autoclose", OPT_AUTOCLOSE, "Auto close screen. (NetWare only)", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
-#endif /* __NETWARE__ */
{"basedir", 'b',
"Path to installation directory. All paths are usually resolved relative to this.",
(gptr*) &mysql_home_ptr, (gptr*) &mysql_home_ptr, 0, GET_STR, REQUIRED_ARG,
@@ -4526,11 +4497,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
if (opt_console)
opt_error_log= 0; // Force logs to stdout
break;
-#ifdef __NETWARE__
- case (int) OPT_AUTOCLOSE:
- setscreenmode(SCR_AUTOCLOSE_ON_EXIT);
- break;
-#endif
case (int) OPT_FLUSH:
#ifdef HAVE_ISAM
nisam_flush=1;
diff --git a/sql/net_pkg.cc b/sql/net_pkg.cc
index 2ce811157af..315cad5ca6d 100644
--- a/sql/net_pkg.cc
+++ b/sql/net_pkg.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
+/* 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
@@ -283,11 +283,6 @@ bool
net_store_data(String *packet,const char *from,uint length)
{
ulong packet_length=packet->length();
-/*
- We have added net5store in net_store_length.
- Before that largest size was int3store.
- Therefore +5 is changed to +9
-*/
if (packet_length+9+length > packet->alloced_length() &&
packet->realloc(packet_length+9+length))
return 1;
@@ -305,8 +300,12 @@ net_store_data(String *packet,const char *from)
{
uint length=(uint) strlen(from);
uint packet_length=packet->length();
- if (packet_length+9+length > packet->alloced_length() &&
- packet->realloc(packet_length+9+length))
+ /*
+ 3 is the longest coding for storing a string with the used
+ net_store_length() function. We use 5 here 'just in case'
+ */
+ if (packet_length+5+length > packet->alloced_length() &&
+ packet->realloc(packet_length+5+length))
return 1;
char *to=(char*) net_store_length((char*) packet->ptr()+packet_length,
length);
diff --git a/sql/records.cc b/sql/records.cc
index 7c3bd1110bb..22c4d54550c 100644
--- a/sql/records.cc
+++ b/sql/records.cc
@@ -45,7 +45,8 @@ void init_read_record(READ_RECORD *info,THD *thd, TABLE *table,
info->ref_length=table->file->ref_length;
info->select=select;
info->print_error=print_error;
- table->status=0; /* And it's allways found */
+ info->ignore_not_found_rows= 0;
+ table->status=0; /* And it's always found */
if (select && my_b_inited(&select->file))
tempfile= &select->file;
@@ -184,7 +185,8 @@ tryNext:
{
if (tmp == HA_ERR_END_OF_FILE)
tmp= -1;
- else if (tmp == HA_ERR_RECORD_DELETED)
+ else if (tmp == HA_ERR_RECORD_DELETED ||
+ (tmp == HA_ERR_KEY_NOT_FOUND && info->ignore_not_found_rows))
goto tryNext;
else
{
@@ -212,7 +214,8 @@ tryNext:
{
if (tmp == HA_ERR_END_OF_FILE)
tmp= -1;
- else if (tmp == HA_ERR_RECORD_DELETED)
+ else if (tmp == HA_ERR_RECORD_DELETED ||
+ (tmp == HA_ERR_KEY_NOT_FOUND && info->ignore_not_found_rows))
goto tryNext;
else
{
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 4997305de6b..1507d49ebd6 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -393,6 +393,7 @@ void multi_delete::send_error(uint errcode,const char *err)
int multi_delete::do_deletes(bool from_send_error)
{
int local_error= 0, counter= 0;
+ DBUG_ENTER("do_deletes");
if (from_send_error)
{
@@ -418,7 +419,12 @@ int multi_delete::do_deletes(bool from_send_error)
}
READ_RECORD info;
- init_read_record(&info,thd,table,NULL,0,0);
+ init_read_record(&info,thd,table,NULL,0,1);
+ /*
+ Ignore any rows not found in reference tables as they may already have
+ been deleted by foreign key handling
+ */
+ info.ignore_not_found_rows= 1;
while (!(local_error=info.read_record(&info)) && !thd->killed)
{
if ((local_error=table->file->delete_row(table->record[0])))
@@ -432,7 +438,7 @@ int multi_delete::do_deletes(bool from_send_error)
if (local_error == -1) // End of file
local_error = 0;
}
- return local_error;
+ DBUG_RETURN(local_error);
}
diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc
index eeaa574c69d..12e8c9e227a 100644
--- a/sql/sql_handler.cc
+++ b/sql/sql_handler.cc
@@ -87,18 +87,11 @@ int mysql_ha_close(THD *thd, TABLE_LIST *tables, bool dont_send_ok)
return 0;
}
-int mysql_ha_closeall(THD *thd, TABLE_LIST *tables, bool dont_send_ok)
+int mysql_ha_closeall(THD *thd, TABLE_LIST *tables)
{
TABLE **ptr=find_table_ptr_by_name(thd, tables->db, tables->real_name, 0);
-
- DBUG_ASSERT(dont_send_ok);
if (*ptr)
- {
-// if (!dont_send_ok) VOID(pthread_mutex_lock(&LOCK_open));
close_thread_table(thd, ptr);
-// if (!dont_send_ok) VOID(pthread_mutex_unlock(&LOCK_open));
- }
-// if (!dont_send_ok) send_ok(&thd->net);
return 0;
}
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index e8857a7faeb..31fcb0be8e3 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -174,7 +174,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
for (table=tables ; table ; table=table->next)
{
char *db=table->db ? table->db : thd->db;
- mysql_ha_closeall(thd, table, 1);
+ mysql_ha_closeall(thd, table);
if (!close_temporary_table(thd, db, table->real_name))
{
tmp_table_deleted=1;
diff --git a/sql/structs.h b/sql/structs.h
index be50c8fc24d..77fed422d21 100644
--- a/sql/structs.h
+++ b/sql/structs.h
@@ -106,7 +106,7 @@ typedef struct st_read_record { /* Parameter to read_record */
byte *record;
byte *cache,*cache_pos,*cache_end,*read_positions;
IO_CACHE *io_cache;
- bool print_error;
+ bool print_error, ignore_not_found_rows;
} READ_RECORD;
enum timestamp_type { TIMESTAMP_NONE, TIMESTAMP_DATE, TIMESTAMP_FULL,