--- a/sql/sql_cache.cc Thu Jan 25 17:10:30 2007 +++ b/sql/sql_cache.cc Thu Apr 12 21:17:13 2007 @@ -865,9 +865,13 @@ flags.max_sort_length= thd->variables.max_sort_length; flags.lc_time_names= thd->variables.lc_time_names; flags.group_concat_max_len= thd->variables.group_concat_max_len; + flags.div_precision_increment= thd->variables.div_precincrement; + flags.default_week_format= thd->variables.default_week_format; + memcpy(&flags.qc_ft_boolean_syntax, &ft_boolean_syntax, sizeof(ft_boolean_syntax)); DBUG_PRINT("qcache", ("long %d, 4.1: %d, more results %d, pkt_nr: %d, \ CS client: %u, CS result: %u, CS conn: %u, limit: %lu, TZ: 0x%lx, \ -sql mode: 0x%lx, sort len: %lu, conncat len: %lu", +sql mode: 0x%lx, sort len: %lu, conncat len: %lu, div_precision: %lu, \ +def_week_frmt: %lu", (int)flags.client_long_flag, (int)flags.client_protocol_41, (int)flags.more_results_exists, @@ -879,7 +883,9 @@ (ulong) flags.time_zone, flags.sql_mode, flags.max_sort_length, - flags.group_concat_max_len)); + flags.group_concat_max_len, + flags.div_precision_increment, + flags.default_week_format)); /* Make InnoDB to release the adaptive hash index latch before acquiring the query cache mutex. @@ -1107,10 +1113,14 @@ flags.sql_mode= thd->variables.sql_mode; flags.max_sort_length= thd->variables.max_sort_length; flags.group_concat_max_len= thd->variables.group_concat_max_len; + flags.div_precision_increment= thd->variables.div_precincrement; + flags.default_week_format= thd->variables.default_week_format; flags.lc_time_names= thd->variables.lc_time_names; + memcpy(&flags.qc_ft_boolean_syntax, &ft_boolean_syntax, sizeof(ft_boolean_syntax)); DBUG_PRINT("qcache", ("long %d, 4.1: %d, more results %d, pkt_nr: %d, \ CS client: %u, CS result: %u, CS conn: %u, limit: %lu, TZ: 0x%lx, \ -sql mode: 0x%lx, sort len: %lu, conncat len: %lu", +sql mode: 0x%lx, sort len: %lu, conncat len: %lu, div_precision: %lu, \ +def_week_frmt: %lu", (int)flags.client_long_flag, (int)flags.client_protocol_41, (int)flags.more_results_exists, @@ -1122,7 +1132,9 @@ (ulong) flags.time_zone, flags.sql_mode, flags.max_sort_length, - flags.group_concat_max_len)); + flags.group_concat_max_len, + flags.div_precision_increment, + flags.default_week_format)); memcpy((void *)(sql + (tot_length - QUERY_CACHE_FLAGS_SIZE)), &flags, QUERY_CACHE_FLAGS_SIZE); query_block = (Query_cache_block *) hash_search(&queries, (byte*) sql, --- a/sql/mysql_priv.h Sat Apr 7 12:23:32 2007 +++ b/sql/mysql_priv.h Thu Apr 12 20:59:49 2007 @@ -644,6 +644,9 @@ ulong sql_mode; ulong max_sort_length; ulong group_concat_max_len; + ulong div_precision_increment; + ulong default_week_format; + char qc_ft_boolean_syntax[sizeof(ft_boolean_syntax)]; MY_LOCALE *lc_time_names; }; #define QUERY_CACHE_FLAGS_SIZE sizeof(Query_cache_query_flags) --- a/mysql-test/t/query_cache.test Wed Feb 14 13:44:30 2007 +++ b/mysql-test/t/query_cache.test Thu Apr 12 21:11:47 2007 @@ -899,3 +899,55 @@ drop table t1, t2, t3; drop view v1; set global query_cache_size=0; + +# +# Query cache and changes to system variables +# + +create table t1 (a int); +insert into t1 values (1),(2),(3); +set GLOBAL query_cache_type=1; +set GLOBAL query_cache_limit=10000; +set GLOBAL query_cache_min_res_unit=0; +set GLOBAL query_cache_size= 100000; + +# default_week_format +reset query cache; +set LOCAL default_week_format = 0; +select week('2007-01-04'); +select week('2007-01-04') from t1; +select extract(WEEK FROM '2007-01-04') from t1; + +set LOCAL default_week_format = 2; +select week('2007-01-04'); +select week('2007-01-04') from t1; +select extract(WEEK FROM '2007-01-04') from t1; + +# div_precision_increment +reset query cache; +set LOCAL div_precision_increment=2; +select 1/7; +select 1/7 from t1; + +set LOCAL div_precision_increment=4; +select 1/7; +select 1/7 from t1; + +drop table t1; + +CREATE TABLE t1 (a VARCHAR(200), b TEXT, FULLTEXT (a,b)); +INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'), + ('Full-text indexes', 'are called collections'), + ('Only MyISAM tables','support collections'), + ('Function MATCH ... AGAINST()','is used to do a search'), + ('Full-text search in MySQL', 'implements vector space model'); + + +set GLOBAL ft_boolean_syntax='+ -><()~*:""&|'; + +select *, MATCH(a,b) AGAINST("+called +collections" IN BOOLEAN MODE) as x from t1; + +# swap +/- +set GLOBAL ft_boolean_syntax='- +><()~*:""&|'; + +select *, MATCH(a,b) AGAINST("+called +collections" IN BOOLEAN MODE) as x from t1; --- a/mysql-test/r/query_cache.result Wed Feb 14 13:44:30 2007 +++ b/mysql-test/r/query_cache.result Thu Apr 12 21:20:07 2007 @@ -1321,3 +1321,80 @@ drop table t1, t2, t3; drop view v1; set global query_cache_size=0; +create table t1 (a int); +insert into t1 values (1),(2),(3); +set GLOBAL query_cache_type=1; +set GLOBAL query_cache_limit=10000; +set GLOBAL query_cache_min_res_unit=0; +set GLOBAL query_cache_size= 100000; +reset query cache; +set LOCAL default_week_format = 0; +select week('2007-01-04'); +week('2007-01-04') +0 +select week('2007-01-04') from t1; +week('2007-01-04') +0 +0 +0 +select extract(WEEK FROM '2007-01-04') from t1; +extract(WEEK FROM '2007-01-04') +0 +0 +0 +set LOCAL default_week_format = 2; +select week('2007-01-04'); +week('2007-01-04') +53 +select week('2007-01-04') from t1; +week('2007-01-04') +53 +53 +53 +select extract(WEEK FROM '2007-01-04') from t1; +extract(WEEK FROM '2007-01-04') +53 +53 +53 +reset query cache; +set LOCAL div_precision_increment=2; +select 1/7; +1/7 +0.14 +select 1/7 from t1; +1/7 +0.14 +0.14 +0.14 +set LOCAL div_precision_increment=4; +select 1/7; +1/7 +0.1429 +select 1/7 from t1; +1/7 +0.1429 +0.1429 +0.1429 +drop table t1; +CREATE TABLE t1 (a VARCHAR(200), b TEXT, FULLTEXT (a,b)); +INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'), +('Full-text indexes', 'are called collections'), +('Only MyISAM tables','support collections'), +('Function MATCH ... AGAINST()','is used to do a search'), +('Full-text search in MySQL', 'implements vector space model'); +set GLOBAL ft_boolean_syntax='+ -><()~*:""&|'; +select *, MATCH(a,b) AGAINST("+called +collections" IN BOOLEAN MODE) as x from t1; +a b x +MySQL has now support for full-text search 0 +Full-text indexes are called collections 1 +Only MyISAM tables support collections 0 +Function MATCH ... AGAINST() is used to do a search 0 +Full-text search in MySQL implements vector space model 0 +set GLOBAL ft_boolean_syntax='- +><()~*:""&|'; +select *, MATCH(a,b) AGAINST("+called +collections" IN BOOLEAN MODE) as x from t1; +a b x +MySQL has now support for full-text search 0 +Full-text indexes are called collections 0 +Only MyISAM tables support collections 0 +Function MATCH ... AGAINST() is used to do a search 0 +Full-text search in MySQL implements vector space model 0 --- a/mysql-test/t/query_cache_notembedded.test Tue Dec 19 14:28:26 2006 +++ b/mysql-test/t/query_cache_notembedded.test Thu Apr 12 21:41:54 2007 @@ -5,6 +5,7 @@ # Tests with query cache # set GLOBAL query_cache_size=1355776; +set GLOBAL query_cache_limit=default; # Reset query cache variables. --- a/mysql-test/r/query_cache_notembedded.result Tue Mar 27 18:16:43 2007 +++ b/mysql-test/r/query_cache_notembedded.result Thu Apr 12 21:42:58 2007 @@ -1,4 +1,5 @@ set GLOBAL query_cache_size=1355776; +set GLOBAL query_cache_limit=default; flush query cache; flush query cache; reset query cache;