From 409fb4895fd08e876b33c4d809919952871996a9 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 2 May 2006 18:00:44 +0500 Subject: Fix for bug #16546: DATETIME+0 not always coerced the same way mysql-test/r/func_time.result: Fix for bug #16546: DATETIME+0 not always coerced the same way - test case mysql-test/t/func_time.test: Fix for bug #16546: DATETIME+0 not always coerced the same way - test case sql/item_timefunc.cc: Fix for bug #16546: DATETIME+0 not always coerced the same way - set decimals to DATETIME_DEC sql/item_timefunc.h: Fix for bug #16546: DATETIME+0 not always coerced the same way - set decimals to DATETIME_DEC --- mysql-test/r/func_time.result | 12 ++++++++---- mysql-test/t/func_time.test | 8 ++++++++ sql/item_timefunc.cc | 6 +++--- sql/item_timefunc.h | 1 + 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index fc872285acb..d3375dee8b6 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -7,20 +7,20 @@ period_add("9602",-12) period_diff(199505,"9404") 199502 13 select now()-now(),weekday(curdate())-weekday(now()),unix_timestamp()-unix_timestamp(now()); now()-now() weekday(curdate())-weekday(now()) unix_timestamp()-unix_timestamp(now()) -0 0 0 +0.000000 0 0 select from_unixtime(unix_timestamp("1994-03-02 10:11:12")),from_unixtime(unix_timestamp("1994-03-02 10:11:12"),"%Y-%m-%d %h:%i:%s"),from_unixtime(unix_timestamp("1994-03-02 10:11:12"))+0; from_unixtime(unix_timestamp("1994-03-02 10:11:12")) from_unixtime(unix_timestamp("1994-03-02 10:11:12"),"%Y-%m-%d %h:%i:%s") from_unixtime(unix_timestamp("1994-03-02 10:11:12"))+0 -1994-03-02 10:11:12 1994-03-02 10:11:12 19940302101112 +1994-03-02 10:11:12 1994-03-02 10:11:12 19940302101112.000000 select sec_to_time(9001),sec_to_time(9001)+0,time_to_sec("15:12:22"), sec_to_time(time_to_sec("0:30:47")/6.21); sec_to_time(9001) sec_to_time(9001)+0 time_to_sec("15:12:22") sec_to_time(time_to_sec("0:30:47")/6.21) -02:30:01 23001 54742 00:04:57 +02:30:01 23001.000000 54742 00:04:57 select sec_to_time(time_to_sec('-838:59:59')); sec_to_time(time_to_sec('-838:59:59')) -838:59:59 select now()-curdate()*1000000-curtime(); now()-curdate()*1000000-curtime() -0 +0.000000 select strcmp(current_timestamp(),concat(current_date()," ",current_time())); strcmp(current_timestamp(),concat(current_date()," ",current_time())) 0 @@ -626,3 +626,7 @@ last_day('2005-01-00') NULL Warnings: Warning 1292 Truncated incorrect datetime value: '2005-01-00' +select now() - now() + 0, curtime() - curtime() + 0, +sec_to_time(1) + 0, from_unixtime(1) + 0; +now() - now() + 0 curtime() - curtime() + 0 sec_to_time(1) + 0 from_unixtime(1) + 0 +0.000000 0.000000 1.000000 19700101030001.000000 diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index 68a33afd85c..d9a8579ce0f 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -315,4 +315,12 @@ select last_day('2005-00-00'); select last_day('2005-00-01'); select last_day('2005-01-00'); +# +# Bug #16546 +# + +select now() - now() + 0, curtime() - curtime() + 0, + sec_to_time(1) + 0, from_unixtime(1) + 0; + + # End of 4.1 tests diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index f3d6858755c..34850d4efdd 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -1372,7 +1372,7 @@ void Item_func_curtime::fix_length_and_dec() { TIME ltime; - decimals=0; + decimals= DATETIME_DEC; collation.set(&my_charset_bin); store_now_in_TIME(<ime); value= TIME_to_ulonglong_time(<ime); @@ -1419,7 +1419,7 @@ String *Item_func_now::val_str(String *str) void Item_func_now::fix_length_and_dec() { - decimals=0; + decimals= DATETIME_DEC; collation.set(&my_charset_bin); store_now_in_TIME(<ime); @@ -1680,7 +1680,7 @@ void Item_func_from_unixtime::fix_length_and_dec() { thd= current_thd; collation.set(&my_charset_bin); - decimals=0; + decimals= DATETIME_DEC; max_length=MAX_DATETIME_WIDTH*MY_CHARSET_BIN_MB_MAXLEN; maybe_null= 1; thd->time_zone_used= 1; diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index 163b1591e52..ac26455371d 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -580,6 +580,7 @@ public: { collation.set(&my_charset_bin); maybe_null=1; + decimals= DATETIME_DEC; max_length=MAX_TIME_WIDTH*MY_CHARSET_BIN_MB_MAXLEN; } enum_field_types field_type() const { return MYSQL_TYPE_TIME; } -- cgit v1.2.1 From 445e828785da97c7292103f539835098b2dd67b0 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 31 May 2006 15:07:11 +0200 Subject: Removed dead code that had been commented out --- ndb/src/ndbapi/NdbDictionaryImpl.cpp | 2 +- ndb/src/ndbapi/NdbDictionaryImpl.hpp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.cpp b/ndb/src/ndbapi/NdbDictionaryImpl.cpp index 80a584651d1..c2604ebe682 100644 --- a/ndb/src/ndbapi/NdbDictionaryImpl.cpp +++ b/ndb/src/ndbapi/NdbDictionaryImpl.cpp @@ -2147,7 +2147,7 @@ NdbDictionaryImpl::dropIndex(const char * indexName, m_error.code = 4243; return -1; } - int ret = dropIndex(*idx); //, tableName); + int ret = dropIndex(*idx); // If index stored in cache is incompatible with the one in the kernel // we must clear the cache and try again if (ret == INCOMPATIBLE_VERSION) { diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.hpp b/ndb/src/ndbapi/NdbDictionaryImpl.hpp index 8763a444503..ad587a10e1d 100644 --- a/ndb/src/ndbapi/NdbDictionaryImpl.hpp +++ b/ndb/src/ndbapi/NdbDictionaryImpl.hpp @@ -379,7 +379,6 @@ public: int createIndex(NdbIndexImpl &ix); int dropIndex(const char * indexName, const char * tableName); - // int dropIndex(NdbIndexImpl &, const char * tableName); int dropIndex(NdbIndexImpl &); NdbTableImpl * getIndexTable(NdbIndexImpl * index, NdbTableImpl * table); -- cgit v1.2.1 From 5efb70d7771c905b61e5e01e2f0643a5953adb83 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 6 Jun 2006 09:59:45 -0700 Subject: Fixed some problems for Windows build VC++Files/client/mysql.dsp: Fixed omission of mysys\my_conio.c. VC++Files/client/mysql_ia64.dsp: Fixed omission of mysys\my_conio.c. client/mysqldump.c: VS compiler does not accept variable declarations within blocks. Such a behaviour complies with the Standard C. --- VC++Files/client/mysql.dsp | 4 ++++ VC++Files/client/mysql_ia64.dsp | 4 ++++ client/mysqldump.c | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/VC++Files/client/mysql.dsp b/VC++Files/client/mysql.dsp index 8298e62d8ad..c19e7b7d7fe 100644 --- a/VC++Files/client/mysql.dsp +++ b/VC++Files/client/mysql.dsp @@ -144,6 +144,10 @@ SOURCE=.\readline.cpp # End Source File # Begin Source File +SOURCE=..\mysys\my_conio.c +# End Source File +# Begin Source File + SOURCE=.\sql_string.cpp # End Source File # End Target diff --git a/VC++Files/client/mysql_ia64.dsp b/VC++Files/client/mysql_ia64.dsp index 3fe2e2a2328..8de283d1e0b 100644 --- a/VC++Files/client/mysql_ia64.dsp +++ b/VC++Files/client/mysql_ia64.dsp @@ -130,6 +130,10 @@ SOURCE=.\readline.cpp # End Source File # Begin Source File +SOURCE=..\mysys\my_conio.c +# End Source File +# Begin Source File + SOURCE=.\sql_string.cpp # End Source File # End Target diff --git a/client/mysqldump.c b/client/mysqldump.c index e8f96016153..3445a23eb5e 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -2222,6 +2222,7 @@ static int dump_all_tables_in_db(char *database) static char *get_actual_table_name(const char *old_table_name, MEM_ROOT *root) { char *name= 0; + ulong *lengths; MYSQL_RES *tableRes; MYSQL_ROW row; char query[50 + 2*NAME_LEN]; @@ -2246,7 +2247,7 @@ static char *get_actual_table_name(const char *old_table_name, MEM_ROOT *root) if (numRows > 0) { row= mysql_fetch_row( tableRes ); - ulong *lengths= mysql_fetch_lengths(tableRes); + lengths= mysql_fetch_lengths(tableRes); name= strmake_root(root, row[0], lengths[0]); } mysql_free_result(tableRes); -- cgit v1.2.1