diff options
-rw-r--r-- | Docs/manual.texi | 26 | ||||
-rw-r--r-- | sql/item_func.cc | 15 | ||||
-rw-r--r-- | sql/item_func.h | 2 | ||||
-rw-r--r-- | sql/mysql_priv.h | 13 | ||||
-rw-r--r-- | sql/mysqld.cc | 6 | ||||
-rw-r--r-- | sql/slave.cc | 3 | ||||
-rw-r--r-- | sql/slave.h | 2 | ||||
-rw-r--r-- | sql/sql_rename.cc | 6 |
8 files changed, 53 insertions, 20 deletions
diff --git a/Docs/manual.texi b/Docs/manual.texi index 4af176c794f..58d6ad96a7e 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -8133,15 +8133,17 @@ than it had in 3.23. @item The result of all bitwise operators @code{|}, @code{&}, @code{<<}, @code{>>} and @code{~} is now unsigned. This may cause problems if your -are using them in a context where you want an signed result. @xref{Cast -Functions}. +are using them in a context where you want an signed result. +@xref{Cast Functions}. @item @strong{NOTE:} When you use subtraction between integers values where one is of type @code{UNSIGNED}, the result will be unsigned! In other words, before upgrading to MySQL 4.0, you should check your application -for cases where you are subtracting a value from an unsigned entity -and want a negative answer or subtracting an unsigned value from a an -integer column. @xref{Cast Functions}. +for cases where you are subtracting a value from an unsigned entity and +want a negative answer or subtracting an unsigned value from a an +integer column. You can disable this behaviour by using the +@code{--sql-mode=NO_UNSIGNED_SUBTRACTION} option when starting +@code{mysqld}. @xref{Cast Functions}. @item To use @code{MATCH ... AGAINST (... IN BOOLEAN MODE)} with your tables, you need to rebuild them with @code{ALTER TABLE table_name TYPE=MyISAM}, @@ -19873,6 +19875,8 @@ Means that the thread is flushing the changed table data to disk and closing the used tables. This should be a fast operation. If not, then you should check that you don't have a full disk or that the disk is not in very heavy use. +@item @code{Connect Out} +Slave connecting to master. @item @code{Copying to tmp table on disk} The temporary result set was larger than @code{tmp_table_size} and the thread is now changing the in memory based temporary table to a disk @@ -32000,6 +32004,12 @@ SELECT (unsigned_column_1+0.0)-(unsigned_column_2+0.0); The idea is that the columns are converted to floating point before doing the subtraction. +If you get a problem with @code{UNSIGNED} columns in your old MySQL +application when porting to MySQL 4.0, you can use the +@code{--sql-mode=NO_UNSIGNED_SUBTRACTION} option when starting +@code{mysqld}. Note however that as long as you use this, you will not +be able to efficiently use the @code{UNSIGNED BIGINT} column type. + @node Other Functions, Group by functions, Cast Functions, Functions @subsection Other Functions @@ -48361,6 +48371,10 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}. @itemize @bullet @item +Added sql-mode flag @code{NO_UNSIGNED_SUBTRACTION} to disable unsigned +arithmetic rules when it comes to subtraction. (This will make MySQL 4.0 +behave more closely to 3.23 with @code{UNSIGNED} columns). +@item Added @code{WITH MAX_QUERIES_PER_HOUR=#} to @code{GRANT} command. @item The type returned for all bit functions (@code{|}, @code{<<} ...) are now of @@ -48473,7 +48487,7 @@ Added support for @code{MATCH ... AGAINST(... IN BOOLEAN MODE)}. @code{ALTER TABLE tablename TYPE=MyISAM} to be able to use boolean fulltext search}. @item -@code{LOCATE()} and @code{INSTR()} are case sensitive if neither +@code{LOCATE()} and @code{INSTR()} are now case sensitive if either argument is a binary string. @item Changed @code{RAND()} initialization so that @code{RAND(N)} and diff --git a/sql/item_func.cc b/sql/item_func.cc index 209fbea1674..5dcc638235f 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -280,6 +280,21 @@ longlong Item_func_plus::val_int() return (longlong) Item_func_plus::val(); } + +/* + The following function is here to allow the user to force + subtraction of UNSIGNED BIGINT to return negative values. +*/ + +void Item_func_minus::fix_length_and_dec() +{ + Item_num_op::fix_length_and_dec(); + if (unsigned_flag && + (current_thd->sql_mode & MODE_NO_UNSIGNED_SUBTRACTION)) + unsigned_flag=0; +} + + double Item_func_minus::val() { double value=args[0]->val() - args[1]->val(); diff --git a/sql/item_func.h b/sql/item_func.h index 578c3034b32..823bfb44a96 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -233,8 +233,10 @@ public: const char *func_name() const { return "-"; } double val(); longlong val_int(); + void fix_length_and_dec(); }; + class Item_func_mul :public Item_num_op { public: diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 8ccf0de27d6..81604a7ecfd 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -181,12 +181,13 @@ char* query_table_status(THD *thd,const char *db,const char *table_name); #define TMP_TABLE_ALL_COLUMNS (SELECT_NO_UNLOCK*2) -#define MODE_REAL_AS_FLOAT 1 -#define MODE_PIPES_AS_CONCAT 2 -#define MODE_ANSI_QUOTES 4 -#define MODE_IGNORE_SPACE 8 -#define MODE_SERIALIZABLE 16 -#define MODE_ONLY_FULL_GROUP_BY 32 +#define MODE_REAL_AS_FLOAT 1 +#define MODE_PIPES_AS_CONCAT 2 +#define MODE_ANSI_QUOTES 4 +#define MODE_IGNORE_SPACE 8 +#define MODE_SERIALIZABLE 16 +#define MODE_ONLY_FULL_GROUP_BY 32 +#define MODE_NO_UNSIGNED_SUBTRACTION 64 #define RAID_BLOCK_SIZE 1024 diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 983218e42d2..52a1206eab9 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -351,7 +351,7 @@ time_t start_time; ulong opt_sql_mode = 0L; const char *sql_mode_names[] = { "REAL_AS_FLOAT", "PIPES_AS_CONCAT", "ANSI_QUOTES", "IGNORE_SPACE", - "SERIALIZE","ONLY_FULL_GROUP_BY", NullS }; + "SERIALIZE","ONLY_FULL_GROUP_BY", "NO_UNSIGNED_SUBTRACTION",NullS }; TYPELIB sql_mode_typelib= {array_elements(sql_mode_names)-1,"", sql_mode_names}; @@ -486,7 +486,6 @@ static void close_connections(void) HANDLE hTempPipe = &hPipe; DBUG_PRINT( "quit", ("Closing named pipes") ); hPipe = INVALID_HANDLE_VALUE; - CancelIo( hTempPipe ); DisconnectNamedPipe( hTempPipe ); CloseHandle( hTempPipe ); } @@ -3411,7 +3410,8 @@ static void usage(void) -t, --tmpdir=path Path for temporary files\n\ --sql-mode=option[,option[,option...]] where option can be one of:\n\ REAL_AS_FLOAT, PIPES_AS_CONCAT, ANSI_QUOTES,\n\ - IGNORE_SPACE, SERIALIZE, ONLY_FULL_GROUP_BY.\n\ + IGNORE_SPACE, SERIALIZE, ONLY_FULL_GROUP_BY,\n\ + NO_UNSIGNED_SUBTRACTION.\n\ --transaction-isolation\n\ Default transaction isolation level\n\ --temp-pool Use a pool of temporary files\n\ diff --git a/sql/slave.cc b/sql/slave.cc index 16c6751f853..f9dbf4641e6 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1541,7 +1541,7 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli) */ /* TODO: I/O thread should not even log events with the same server id */ rli->inc_pos(ev->get_event_len(), - type_code != STOP_EVENT ? ev->log_pos : 0, + type_code != STOP_EVENT ? ev->log_pos : LL(0), 1/* skip lock*/); flush_relay_log_info(rli); if (rli->slave_skip_counter && /* protect against common user error of @@ -2297,7 +2297,6 @@ Log_event* next_event(RELAY_LOG_INFO* rli) DBUG_ASSERT(rli->cur_log_fd >= 0); my_close(rli->cur_log_fd, MYF(MY_WME)); rli->cur_log_fd = -1; - int error; // purge_first_log will properly set up relay log coordinates in rli if (rli->relay_log.purge_first_log(rli)) diff --git a/sql/slave.h b/sql/slave.h index db12ab91618..f60f2ce2954 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -176,7 +176,7 @@ typedef struct st_relay_log_info pending += val; } // TODO: this probably needs to be fixed - inline void inc_pos(ulonglong val, uint32 log_pos, bool skip_lock=0) + inline void inc_pos(ulonglong val, ulonglong log_pos, bool skip_lock=0) { if (!skip_lock) pthread_mutex_lock(&data_lock); diff --git a/sql/sql_rename.cc b/sql/sql_rename.cc index 2c4c6216ab7..f2a0351361b 100644 --- a/sql/sql_rename.cc +++ b/sql/sql_rename.cc @@ -35,8 +35,10 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list) TABLE_LIST *lock_table,*ren_table=0; DBUG_ENTER("mysql_rename_tables"); - /* Avoid problems with a rename on a table that we have locked or - if the user is trying to to do this in a transcation context */ + /* + Avoid problems with a rename on a table that we have locked or + if the user is trying to to do this in a transcation context + */ if (thd->locked_tables || thd->active_transaction()) { |