From 82b7c54338a3465790e4e64a647e82b9d7ea59b6 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 9 May 2007 17:27:14 +0500 Subject: Bug #27957 cast as decimal does not check overflow, also inconsistent with group, subselect Missing check for overflow added to the Item_decimal_typecast::val_decimal include/decimal.h: Bug #27957 cast as decimal does not check overflow, also inconsistent with group, subselect decimal_intg() declaration mysql-test/r/cast.result: Bug #27957 cast as decimal does not check overflow, also inconsistent with group, subselect result fixed mysql-test/r/type_newdecimal.result: Bug #27957 cast as decimal does not check overflow, also inconsistent with group, subselect test result mysql-test/t/type_newdecimal.test: Bug #27957 cast as decimal does not check overflow, also inconsistent with group, subselect test case added sql/item_func.cc: Bug #27957 cast as decimal does not check overflow, also inconsistent with group, subselect now we check for possible ovreflow in Item_decimal_typecast::val_decimal sql/my_decimal.h: Bug #27957 cast as decimal does not check overflow, also inconsistent with group, subselect my_decimal_intg() implemented strings/decimal.c: Bug #27957 cast as decimal does not check overflow, also inconsistent with group, subselect decimal_intg() implemented --- include/decimal.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/decimal.h b/include/decimal.h index 56962009025..c5385b58658 100644 --- a/include/decimal.h +++ b/include/decimal.h @@ -47,6 +47,7 @@ int decimal_bin_size(int precision, int scale); int decimal_result_size(decimal_t *from1, decimal_t *from2, char op, int param); +int decimal_intg(decimal_t *from); int decimal_add(decimal_t *from1, decimal_t *from2, decimal_t *to); int decimal_sub(decimal_t *from1, decimal_t *from2, decimal_t *to); int decimal_cmp(decimal_t *from1, decimal_t *from2); -- cgit v1.2.1 From 9e1585ab8f487222a03e017079efadb570817657 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 16 May 2007 10:10:02 +0200 Subject: Fix for bug #28240: "isinf()" cannot be used in C++ for lack of prototype - Since isinf() portability across various platforms and compilers is a complicated question, we should not use it directly. Instead, the my_isinf() macro should be used, which is defined as an alias to the system-defined isinf() if it is safe to use, or a workaround implementation otherwise configure.in: Added a check to define HAVE_ISINF only if it can be used in C++ code as well. include/my_global.h: Define my_isinf() as an alias to isinf(), if it is available in both C and C++ code. Otherwise, define it to a workaround implementation. sql/item_func.cc: Replaced isinf() with my_isinf(). strings/strtod.c: Replaced isinf() with my_isinf(). --- include/my_global.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/my_global.h b/include/my_global.h index e9b371d8d30..f32a987ffb1 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -792,12 +792,11 @@ typedef SOCKET_SIZE_TYPE size_socket; #define isnan(x) ((x) != (x)) #endif -#if !defined(HAVE_ISINF) -/* The configure check for "isinf with math.h" has failed */ -#ifdef isinf -#undef isinf -#endif -#define isinf(X) (!finite(X) && !isnan(X)) +#ifdef HAVE_ISINF +/* isinf() can be used in both C and C++ code */ +#define my_isinf(X) isinf(X) +#else +#define my_isinf(X) (!finite(X) && !isnan(X)) #endif /* Define missing math constants. */ -- cgit v1.2.1 From b5e4f54a53d3bdb06af48956bbeabcefdb1447aa Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 16 May 2007 10:44:59 +0200 Subject: Backport of TIME->MYSQL_TIME / Y2K fixset Made year 2000 handling more uniform Removed year 2000 handling out from calc_days() The above removes some bugs in date/datetimes with year between 0 and 200 Now we get a note when we insert a datetime value into a date column For default values to CREATE, don't give errors for warning level NOTE Fixed some compiler failures Added library ws2_32 for windows compilation (needed if we want to compile with IOCP support) Removed duplicate typedef TIME and replaced it with MYSQL_TIME Better (more complete) fix for: Bug#21103 "DATE column not compared as DATE" Fixed properly Bug#18997 "DATE_ADD and DATE_SUB perform year2K autoconversion magic on 4-digit year value" Fixed Bug#23093 "Implicit conversion of 9912101 to date does not match cast(9912101 as date)" include/my_time.h: Removed not used define YY_MAGIC_BELOW Added prototype for year_2000_handling() mysql-test/r/date_formats.result: Updated results (fixed bug in date_format() with year < 99 mysql-test/r/func_sapdb.result: Added more testing of make_date() mysql-test/r/ps_2myisam.result: Now we get a note when we insert a datetime value into a date column mysql-test/r/ps_3innodb.result: Now we get a note when we insert a datetime value into a date column mysql-test/r/ps_4heap.result: Now we get a note when we insert a datetime value into a date column mysql-test/r/ps_5merge.result: Now we get a note when we insert a datetime value into a date column mysql-test/r/ps_7ndb.result: Now we get a note when we insert a datetime value into a date column mysql-test/r/strict.result: zero-year in str_to_date() throws warning in strict mysql-test/r/type_date.result: Added test for date conversions mysql-test/r/type_datetime.result: Added testcase for datetime to date conversion. mysql-test/t/date_formats.test: Added testing of dates < 200 mysql-test/t/func_sapdb.test: More testing of makedate() mysql-test/t/type_date.test: Added test for date conversions mysql-test/t/type_datetime.test: Added testcase for datetime to date conversion sql/field.cc: Give note if we insert a datetime value in a date field Don't give notes if we are doing internal test conversions (like from convert_constant_item()) More documentation (store functions can now return '3' to inform that the function did return a NOTE (not warning or error)) Revert some changes in Field_newdate::store() to get more optimal code Field::set_warning() will now ignore notes if CHECK_FIELD_IGNORE is set. New parameters to make_truncated_value_warning() sql/field.h: Give note if we insert a datetime value in a date field Don't give notes if we are doing internal test conversions (like from convert_constant_item()) More documentation (store functions can now return '3' to inform that the function did return a NOTE (not warning or error)) Revert some changes in Field_newdate::store() to get more optimal code Field::set_warning() will now ignore notes if CHECK_FIELD_IGNORE is set. New parameters to make_truncated_value_warning() sql/item.cc: Give note if we insert a datetime value in a date field Don't give notes if we are doing internal test conversions (like from convert_constant_item()) More documentation (store functions can now return '3' to inform that the function did return a NOTE (not warning or error)) Revert some changes in Field_newdate::store() to get more optimal code Field::set_warning() will now ignore notes if CHECK_FIELD_IGNORE is set. New parameters to make_truncated_value_warning() sql/item.h: TIME -> MYSQL_TIME sql/item_cmpfunc.cc: Don't print notes in convert_constant_item() sql/item_func.h: TIME -> MYSQL_TIME sql/item_timefunc.cc: New parameters to make_truncated_value_warning() Moved year 2000 handling out from calc_days() sql/item_timefunc.h: TIME -> MYSQL_TIME sql/my_decimal.cc: TIME -> MYSQL_TIME sql/my_decimal.h: TIME -> MYSQL_TIME sql/mysql_priv.h: Added error level to make_truncated_value_warning() sql/protocol.cc: TIME -> MYSQL_TIME sql/protocol.h: TIME -> MYSQL_TIME sql/sp.cc: TIME -> MYSQL_TIME sql/sql_base.cc: Make testing of result value of save_in_field() uniform sql/sql_class.h: TIME -> MYSQL_TIME sql/sql_show.cc: TIME -> MYSQL_TIME sql/structs.h: TIME -> MYSQL_TIME sql/time.cc: Added error level to make_truncated_value_warning() sql/tztime.cc: TIME -> MYSQL_TIME sql/tztime.h: TIME -> MYSQL_TIME sql/unireg.cc: For default values to CREATE, don't give errors for warning level NOTE (Fixed failed CREATE when we give a datetime value to a date field) sql-common/my_time.c: Added year_2000_handling() Removed year 2000 handling from calc_daynr() --- include/my_time.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/my_time.h b/include/my_time.h index 0e57b3d4af4..99eb5c36c6b 100644 --- a/include/my_time.h +++ b/include/my_time.h @@ -92,6 +92,7 @@ int check_time_range(struct st_mysql_time *, int *warning); long calc_daynr(uint year,uint month,uint day); uint calc_days_in_year(uint year); +uint year_2000_handling(uint year); void init_time(void); -- cgit v1.2.1 From 6e09887f5d4ef9c09c17af8dc4912201cc153b2b Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 17 May 2007 12:43:52 +0500 Subject: Addition to fix for BUG#25712 - insert delayed and check table run together report crashed tables Let MY_THREADSAFE have distinct value. Some functions call my_seek passing MyFlags argument directly to it. This may cause unnecessary locks, which may finally lead to a dead-lock (specifically see my_lock). include/my_sys.h: Addition to fix for BUG#25712 - insert delayed and check table run together report crashed tables Let MY_THREADSAFE have distinct value. Some functions call my_seek passing MyFlags argument directly to it. This may cause unnecessary locks, which may finally lead to a dead-lock (specifically see my_lock). Also it doesn't affect my_pread/my_pwrite in any way. So the comment was updated. --- include/my_sys.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/my_sys.h b/include/my_sys.h index 4c9a7a7964c..759531fa649 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -73,8 +73,8 @@ extern int NEAR my_errno; /* Last error in mysys */ #define MY_ALLOW_ZERO_PTR 64 /* my_realloc() ; zero ptr -> malloc */ #define MY_FREE_ON_ERROR 128 /* my_realloc() ; Free old ptr on error */ #define MY_HOLD_ON_ERROR 256 /* my_realloc() ; Return old ptr on error */ -#define MY_THREADSAFE 128 /* pread/pwrite: Don't allow interrupts */ #define MY_DONT_OVERWRITE_FILE 1024 /* my_copy; Don't overwrite file */ +#define MY_THREADSAFE 2048 /* my_seek(): lock fd mutex */ #define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */ #define MY_GIVE_INFO 2 /* Give time info about process*/ -- cgit v1.2.1 From 945f3c2cc827ca6acc06a1034538f4ec1388ac5b Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 24 May 2007 11:21:27 +0200 Subject: Bug#26664 test suite times out on OS X 64bit - The "mysql client in mysqld"(which is used by replication and federated) should use alarms instead of setting socket timeout value if the rest of the server uses alarm. By always calling 'my_net_set_write_timeout' or 'my_net_set_read_timeout' when changing the timeout value(s), the selection whether to use alarms or timeouts will be handled by ifdef's in those two functions. - Move declaration of 'vio_timeout' into "vio_priv.h" include/mysql_com.h: Move the net_set_*_timeout function declarations to mysql_com.h and rename to my_net_set_*_timeout to avoid name clashes include/violite.h: Move declaration of 'vio_timeout' to vio_priv.h (to make the function as private as possible) libmysql/libmysql.c: Use my_net_read_timeout or my_net_write_timeout when setting the timeouts. Move the global variables for my_net_read/my_write_timeout into the only place where they are used. Thus removing them... server-tools/instance-manager/mysql_connection.cc: Use my_net_read_timeout or my_net_write_timeout when setting the timeouts sql-common/client.c: Use my_net_read_timeout or my_net_write_timeout when setting the timeouts sql/mysql_priv.h: Move the net_set_*_timeout function declarations to mysql_com.h sql/net_serv.cc: No need to cast the net->write_timeout value from "uint" to "uint" sql/set_var.cc: Rename net_set_*_timeout to my_net_set_*_timeout sql/sql_client.cc: Use my_net_read_timeout or my_net_write_timeout when setting the timeouts sql/sql_parse.cc: Rename net_set_*_timeout to my_net_set_*_timeout sql/sql_repl.cc: Rename net_set_*_timeout to my_net_set_*_timeout vio/vio_priv.h: Move declaration of 'vio_timeout' to vio_priv.h vio/viosocket.c: Cleanup 'vio_timeout' - Use "const void*" on POSIX and "const char*" on windows for setsockopt - Add DBUG_PRINT's - Add comment about why we don't have an implementation of vio_timeout for platforms not supporting SO_SNDTIMEO or SO_RCVTIMEO --- include/mysql_com.h | 3 +++ include/violite.h | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/mysql_com.h b/include/mysql_com.h index 93409b2ea1d..cea3a0739e3 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -345,6 +345,9 @@ my_bool net_write_command(NET *net,unsigned char command, int net_real_write(NET *net,const char *packet,unsigned long len); unsigned long my_net_read(NET *net); +void my_net_set_write_timeout(NET *net, uint timeout); +void my_net_set_read_timeout(NET *net, uint timeout); + /* The following function is not meant for normal usage Currently it's used internally by manager.c diff --git a/include/violite.h b/include/violite.h index 63388c170c9..e0172008565 100644 --- a/include/violite.h +++ b/include/violite.h @@ -88,7 +88,6 @@ my_bool vio_peer_addr(Vio* vio, char *buf, uint16 *port); /* Remotes in_addr */ void vio_in_addr(Vio *vio, struct in_addr *in); my_bool vio_poll_read(Vio *vio,uint timeout); -void vio_timeout(Vio *vio,uint which, uint timeout); #ifdef HAVE_OPENSSL #include -- cgit v1.2.1 From d8f21a949ae42aba60bbfb667a7f4b34606db68b Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 25 May 2007 11:38:23 +0200 Subject: Bug #26664 test suite times out on OS X 64bit - Make the two "my_net_set*" function only visible when included from my_global.h include/mysql_com.h: Make the two "my_net_set*" functions only visible when included from my_global.h --- include/mysql_com.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/mysql_com.h b/include/mysql_com.h index cea3a0739e3..889579e3622 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -345,8 +345,10 @@ my_bool net_write_command(NET *net,unsigned char command, int net_real_write(NET *net,const char *packet,unsigned long len); unsigned long my_net_read(NET *net); +#ifdef _global_h void my_net_set_write_timeout(NET *net, uint timeout); void my_net_set_read_timeout(NET *net, uint timeout); +#endif /* The following function is not meant for normal usage -- cgit v1.2.1 From e3af3c2127132e327ea8dd21d942ef2e09d7f4d6 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 28 May 2007 12:44:59 +0400 Subject: Fix for bug #28121 "INSERT or UPDATE into DOUBLE(200,0) field being truncated to 31 digits" When storing a large number to a FLOAT or DOUBLE field with fixed length, it could be incorrectly truncated if the field's length was greater than 31. This patch also does some code cleanups to be able to reuse code which is common between Field_float::store() and Field_double::store(). include/m_string.h: Added declarations for log_10 and log_01 from strtod.c mysql-test/r/type_float.result: Added the testcase for bug #28121 "INSERT or UPDATE into DOUBLE(200,0) field being truncated to 31 digits" mysql-test/t/type_float.test: Added the testcase for bug #28121 "INSERT or UPDATE into DOUBLE(200,0) field being truncated to 31 digits" sql/field.cc: Moved common code from Field_float::store() and Field_double:store() to Field_real::truncate() Fixed the algorithm to not truncate large input numbers if the field length is greater than 31. Fixed rounding to not depend on FLT_MAX/DBL_MAX constants. sql/field.h: Moved not_fixed member from Field_double to Field_real to allow code reuse between Field_float::store() and Field_double::store() Added truncate() method to Field_real which is used by both Field_float and Field_double sql/init.cc: log_10[] and log_01[] are now defined as statical arrays in strtod.c, no need to pre-computed them. sql/item_cmpfunc.cc: log_01[] now starts from 1e0, not from 1e-1 for consistency. sql/mysql_priv.h: Moved log_10[] and log_01[] from mysqld.cc to libmystrings. sql/mysqld.cc: Moved log_10[] and log_01[] from mysqld.cc to libmystrings. strings/strtod.c: Define and use log_10[] and log_01[] as static arrays of constants instead of values pre-computed at startup. --- include/m_string.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/m_string.h b/include/m_string.h index 349084ab21e..773326e9b7d 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -105,6 +105,10 @@ extern char *stpcpy(char *, const char *); /* For AIX with gcc 2.95.3 */ extern char NEAR _dig_vec_upper[]; extern char NEAR _dig_vec_lower[]; +/* Defined in strtod.c */ +extern const double log_10[310]; +extern const double log_01[310]; + #ifdef BAD_STRING_COMPILER #define strmov(A,B) (memccpy(A,B,0,INT_MAX)-1) #else -- cgit v1.2.1 From 088cb9ddc41b7dfb8d6ff3c92d949c326dcaabb1 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 28 May 2007 15:33:22 +0400 Subject: Some Windows-related fixes to make Microsoft compilers happy. This is for bug #28128. include/m_string.h: Reduced the number of elements in log_10[] and log_01[] to not exceed DBL_MAX. sql/field.cc: Avoid the warning on Windows. strings/strtod.c: Reduced the number of elements in log_10[] and log_01[] to not exceed DBL_MAX. --- include/m_string.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/m_string.h b/include/m_string.h index 773326e9b7d..f28cda529f5 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -106,8 +106,8 @@ extern char NEAR _dig_vec_upper[]; extern char NEAR _dig_vec_lower[]; /* Defined in strtod.c */ -extern const double log_10[310]; -extern const double log_01[310]; +extern const double log_10[309]; +extern const double log_01[309]; #ifdef BAD_STRING_COMPILER #define strmov(A,B) (memccpy(A,B,0,INT_MAX)-1) -- cgit v1.2.1 From 9dc7a7b8344335b03a2162abcc7c1a61fa21fc1d Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 30 May 2007 22:47:52 +0400 Subject: Got rid of log_01[], because we don't really need it. Division and log_10[] can always be used instead, which is also a more precise way. This is for bug #28121. include/m_string.h: Got rid of log_01[], because we don't really need it. sql/item_cmpfunc.cc: Got rid of log_01[], because we don't really need it. strings/strtod.c: Got rid of log_01[], because we don't really need it. --- include/m_string.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/m_string.h b/include/m_string.h index f28cda529f5..981111b8718 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -107,7 +107,6 @@ extern char NEAR _dig_vec_lower[]; /* Defined in strtod.c */ extern const double log_10[309]; -extern const double log_01[309]; #ifdef BAD_STRING_COMPILER #define strmov(A,B) (memccpy(A,B,0,INT_MAX)-1) -- cgit v1.2.1 From f9a41f9f35b2ac1fd00e3a2d227ed5b96391bf1c Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 3 Jun 2007 09:40:00 +0300 Subject: Bug #26162: Trigger DML ignores low_priority_updates setting The value of "low-priority-updates" option and the LOW PRIORITY prefix was taken into account at parse time. This caused triggers (among others) to ignore this flag (if supplied for the DML statement). Moved reading of the LOW_PRIORITY flag at run time. Fixed an incosistency when handling SET GLOBAL LOW_PRIORITY_UPDATES : now it is in effect for delayed INSERTs. Tested by checking the effect of LOW_PRIORITY flag via a trigger. include/thr_lock.h: Bug #26162: moved reading of the LOW PRIORITY flag at run time mysql-test/r/trigger.result: Bug #26162: test case mysql-test/t/trigger.test: Bug #26162: test case sql/set_var.cc: Bug #26162: fixed the handling of the "low-priority-updates" option sql/sql_base.cc: Bug #26162: moved reading of the LOW PRIORITY flag at run time sql/sql_yacc.yy: Bug #26162: moved reading of the LOW PRIORITY flag at run time --- include/thr_lock.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include') diff --git a/include/thr_lock.h b/include/thr_lock.h index 966522fe3e3..aa5eb7426ae 100644 --- a/include/thr_lock.h +++ b/include/thr_lock.h @@ -54,6 +54,11 @@ enum thr_lock_type { TL_IGNORE=-1, TL_WRITE_CONCURRENT_INSERT, /* Write used by INSERT DELAYED. Allows READ locks */ TL_WRITE_DELAYED, + /* + parser only! Late bound low_priority flag. + At open_tables() becomes thd->update_lock_default. + */ + TL_WRITE_DEFAULT, /* WRITE lock that has lower priority than TL_READ */ TL_WRITE_LOW_PRIORITY, /* Normal WRITE lock */ -- cgit v1.2.1