diff options
author | monty@donna.mysql.fi <> | 2001-04-09 21:08:56 +0300 |
---|---|---|
committer | monty@donna.mysql.fi <> | 2001-04-09 21:08:56 +0300 |
commit | 7f21a7a6daff97675749db987b12a080bb4c3799 (patch) | |
tree | 8f547099445a7673d67da016f7a567772cd5552c /sql | |
parent | 3d19a5d4bb3bc3ab55574000ee014d3d65d17b12 (diff) | |
download | mariadb-git-7f21a7a6daff97675749db987b12a080bb4c3799.tar.gz |
Fixed INSERT DELAYED with Innobase
Fix for shutdown on NT
Fixed bug when using wrong dates from blob field.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/ha_innobase.cc | 21 | ||||
-rw-r--r-- | sql/mysqld.cc | 2 | ||||
-rw-r--r-- | sql/sql_insert.cc | 9 | ||||
-rw-r--r-- | sql/sql_udf.cc | 29 | ||||
-rw-r--r-- | sql/time.cc | 10 |
5 files changed, 51 insertions, 20 deletions
diff --git a/sql/ha_innobase.cc b/sql/ha_innobase.cc index 62fa6627ae8..00d773fc1f9 100644 --- a/sql/ha_innobase.cc +++ b/sql/ha_innobase.cc @@ -35,6 +35,9 @@ Innobase */ #define MAX_ULONG_BIT ((ulong) 1 << (sizeof(ulong)*8-1)) +/* The following must be declared here so that we can handle SAFE_MUTEX */ +pthread_mutex_t innobase_mutex; + #include "ha_innobase.h" /* Store MySQL definition of 'byte': in Linux it is char while Innobase @@ -42,6 +45,9 @@ uses unsigned char */ typedef byte mysql_byte; #define INSIDE_HA_INNOBASE_CC +#ifdef SAFE_MUTEX +#undef pthread_mutex_t +#endif /* Include necessary Innobase headers */ extern "C" { @@ -91,8 +97,6 @@ ulong innobase_active_counter = 0; char* innobase_home = NULL; -pthread_mutex_t innobase_mutex; - static HASH innobase_open_tables; static mysql_byte* innobase_get_key(INNOBASE_SHARE *share,uint *length, @@ -2601,14 +2605,19 @@ ha_innobase::update_table_comment( { uint length=strlen(comment); - char *str=my_malloc(length + 100,MYF(0)); + char *str=my_malloc(length + 100,MYF(0)), *pos; if (!str) return (char*)comment; - sprintf(str, - "%s; Innobase free: %lu kB", - comment, (ulong) innobase_get_free_space()); + pos=str; + if (length) + { + pos=strmov(str,comment); + *pos++=';'; + *pos++=' '; + } + sprintf(pos, "Innobase free: %lu kB", (ulong) innobase_get_free_space()); return(str); } diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 67e4bee934d..d09ad7513e0 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -437,7 +437,7 @@ static void close_connections(void) #ifdef __NT__ if ( hPipe != INVALID_HANDLE_VALUE ) { - HANDLE hTempPipe = hPipe; + HANDLE hTempPipe = &hPipe; DBUG_PRINT( "quit", ("Closing named pipes") ); hPipe = INVALID_HANDLE_VALUE; CancelIo( hTempPipe ); diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index d2e7c98333d..3be195b8984 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -225,7 +225,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields, break; } } - if (lock_type == TL_WRITE_DELAYED && ! table->file->has_transactions()) + if (lock_type == TL_WRITE_DELAYED) { error=write_delayed(thd,table,duplic,query, thd->query_length, log_on); query=0; @@ -888,6 +888,7 @@ static pthread_handler_decl(handle_delayed_insert,arg) my_pthread_setspecific_ptr(THR_THD, thd) || my_pthread_setspecific_ptr(THR_NET, &thd->net)) { + thd->fatal_error=1; strmov(thd->net.last_error,ER(thd->net.last_errno=ER_OUT_OF_RESOURCES)); goto end; } @@ -906,6 +907,12 @@ static pthread_handler_decl(handle_delayed_insert,arg) thd->fatal_error=1; // Abort waiting inserts goto end; } + if (di->table->file->has_transactions()) + { + thd->fatal_error=1; + my_error(ER_ILLEGAL_HA, MYF(0), di->table_list->real_name); + goto end; + } di->table->copy_blobs=1; /* One can now use this */ diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc index e5a0f6a40b6..2ba937be50a 100644 --- a/sql/sql_udf.cc +++ b/sql/sql_udf.cc @@ -35,10 +35,28 @@ #endif #include "mysql_priv.h" + #ifdef HAVE_DLOPEN extern "C" { +#if defined(__WIN__) + void* dlsym(void* lib,const char* name) + { + return GetProcAddress((HMODULE)lib,name); + } + void* dlopen(const char* libname,int unused) + { + return LoadLibraryEx(libname,NULL,0); + } + void dlclose(void* lib) + { + FreeLibrary((HMODULE)lib); + } + +#else #include <dlfcn.h> +#endif + #include <stdarg.h> #include <hash.h> } @@ -62,6 +80,7 @@ static udf_func *add_udf(char *name, Item_result ret, char *dl, static void del_udf(udf_func *udf); static void *find_udf_dl(const char *dl); + static void init_syms(udf_func *tmp) { char nm[MAX_FIELD_NAME+16],*end; @@ -232,7 +251,7 @@ static void del_udf(udf_func *udf) uint name_length=udf->name_length; udf->name=(char*) "*"; udf->name_length=1; - hash_update(&udf_hash,(byte*) udf,name,name_length); + hash_update(&udf_hash,(byte*) udf,(byte*) name,name_length); } DBUG_VOID_RETURN; } @@ -262,7 +281,7 @@ udf_func *find_udf(const char *name,uint length,bool mark_used) /* TODO: This should be changed to reader locks someday! */ pthread_mutex_lock(&THR_LOCK_udf); - udf=(udf_func*) hash_search(&udf_hash,name, + udf=(udf_func*) hash_search(&udf_hash,(byte*) name, length ? length : (uint) strlen(name)); if (mark_used) udf->usage_count++; @@ -304,7 +323,7 @@ static udf_func *add_udf(char *name, Item_result ret, char *dl, tmp->returns = ret; tmp->type = type; tmp->usage_count=1; - if (hash_insert(&udf_hash,(char*) tmp)) + if (hash_insert(&udf_hash,(byte*) tmp)) return 0; using_udf_functions=1; return tmp; @@ -344,7 +363,7 @@ int mysql_create_function(THD *thd,udf_func *udf) } pthread_mutex_lock(&THR_LOCK_udf); - if (hash_search(&udf_hash,udf->name, udf->name_length)) + if (hash_search(&udf_hash,(byte*) udf->name, udf->name_length)) { net_printf(&thd->net, ER_UDF_EXISTS, udf->name); goto err; @@ -430,7 +449,7 @@ int mysql_drop_function(THD *thd,const char *udf_name) DBUG_RETURN(1); } pthread_mutex_lock(&THR_LOCK_udf); - if (!(udf=(udf_func*) hash_search(&udf_hash,udf_name, (uint) strlen(udf_name)))) + if (!(udf=(udf_func*) hash_search(&udf_hash,(byte*) udf_name, (uint) strlen(udf_name)))) { net_printf(&thd->net, ER_FUNCTION_NOT_DEFINED, udf_name); goto err; diff --git a/sql/time.cc b/sql/time.cc index b40047cb381..086977af72f 100644 --- a/sql/time.cc +++ b/sql/time.cc @@ -428,15 +428,11 @@ str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date) uint field_length,year_length,digits,i,number_of_fields,date[7]; bool date_used=0; const char *pos; + const char *end=str+length; DBUG_ENTER("str_to_TIME"); DBUG_PRINT("enter",("str: %.*s",length,str)); - if(!str) - DBUG_RETURN(TIMESTAMP_NONE); - - const char *end=str+length; - - for (; !isdigit(*str) && str != end ; str++) ; // Skip garbage + for (; str != end && !isdigit(*str) ; str++) ; // Skipp garbage if (str == end) DBUG_RETURN(TIMESTAMP_NONE); /* @@ -562,7 +558,7 @@ bool str_to_time(const char *str,uint length,TIME *l_time) uint state; l_time->neg=0; - for (; !isdigit(*str) && *str != '-' && str != end ; str++) + for (; str != end && !isdigit(*str) && *str != '-' ; str++) length--; if (str != end && *str == '-') { |