diff options
author | unknown <monty@hundin.mysql.fi> | 2001-12-02 14:34:01 +0200 |
---|---|---|
committer | unknown <monty@hundin.mysql.fi> | 2001-12-02 14:34:01 +0200 |
commit | 7c999bb03223114a4d07f23db2842363d32d1859 (patch) | |
tree | 8e30a64d5c7aaa0ba8554c4c316cc9b76a6724ca /sql/sql_parse.cc | |
parent | 95e94560eac0ee72bbc566517ca70f14128a01e8 (diff) | |
download | mariadb-git-7c999bb03223114a4d07f23db2842363d32d1859.tar.gz |
Query cache.
Remove some warnings
Docs/manual.texi:
Solaris and gcc
include/ft_global.h:
Remove warnings
include/myisam.h:
Query cache
include/myisammrg.h:
Query cache
include/mysql_com.h:
Query cache
libmysqld/lib_sql.cc:
Query cache
myisam/ft_boolean_search.c:
Remove warnings
myisam/ft_dump.c:
Remove warnings
myisam/ft_parser.c:
Remove warnings
myisam/ft_static.c:
Remove warnings
myisam/ft_update.c:
Remove warnings
myisam/ftdefs.h:
Remove warnings
myisam/mi_delete.c:
Query cache
myisam/mi_locking.c:
Query cache
myisam/mi_update.c:
Query cache
myisam/myisamdef.h:
Optimize for Ia64
myisammrg/myrg_extra.c:
Query cache
mysys/mf_keycache.c:
DBUG statements
regex/cclass.h:
Remove warnings
regex/cname.h:
Remove warnings
regex/main.c:
Remove warnings
regex/regcomp.c:
Remove warnings
regex/regcomp.ih:
Remove warnings
regex/regerror.c:
Remove warnings
regex/reginit.c:
Remove warnings
regex/split.c:
Remove warnings
sql-bench/test-connect.sh:
Make tests query-cache safe.
sql-bench/test-transactions.sh:
Fix for old perl versions
sql/convert.cc:
Query cache
sql/ha_myisammrg.cc:
Query cache
sql/ha_myisammrg.h:
Query cache
sql/handler.cc:
Query cache
sql/item_create.cc:
Query cache
sql/item_func.cc:
Remove warnings
sql/item_func.h:
Remove warnings
sql/lex.h:
Query cache
sql/mysql_priv.h:
Query cache
sql/mysqld.cc:
Query cache
sql/net_serv.cc:
Query cache
sql/sql_cache.cc:
Query cache
sql/sql_class.cc:
Query cache
sql/sql_class.h:
Query cache
sql/sql_db.cc:
Query cache
sql/sql_delete.cc:
Query cache
sql/sql_insert.cc:
Query cache
sql/sql_parse.cc:
Query cache
sql/sql_select.cc:
Query cache
sql/sql_table.cc:
Query cache
sql/sql_update.cc:
Query cache
sql/sql_yacc.yy:
Query cache
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r-- | sql/sql_parse.cc | 43 |
1 files changed, 37 insertions, 6 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 96185a174b5..ef06eaf9145 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1164,7 +1164,10 @@ mysql_execute_command(void) } if (!(res=open_and_lock_tables(thd,tables))) + { + query_cache.store_query(thd, tables); res=handle_select(thd, lex, result); + } else delete result; break; @@ -1420,6 +1423,7 @@ mysql_execute_command(void) if (end_active_trans(thd)) res= -1; else + { res= mysql_alter_table(thd, select_lex->db, lex->name, &lex->create_info, tables, lex->create_list, @@ -1427,6 +1431,8 @@ mysql_execute_command(void) (ORDER *) select_lex->order_list.first, lex->drop_primary, lex->duplicates, lex->alter_keys_onoff, lex->simple_alter); + query_cache.invalidate(tables); + } break; } #endif @@ -1455,6 +1461,7 @@ mysql_execute_command(void) goto error; } } + query_cache.invalidate(tables); if (end_active_trans(thd)) res= -1; else if (mysql_rename_tables(thd,tables)) @@ -1493,6 +1500,7 @@ mysql_execute_command(void) check_table_access(thd,SELECT_ACL | INSERT_ACL, tables)) goto error; /* purecov: inspected */ res = mysql_repair_table(thd, tables, &lex->check_opt); + query_cache.invalidate(tables); break; } case SQLCOM_CHECK: @@ -1501,6 +1509,7 @@ mysql_execute_command(void) check_table_access(thd, SELECT_ACL | EXTRA_ACL , tables)) goto error; /* purecov: inspected */ res = mysql_check_table(thd, tables, &lex->check_opt); + query_cache.invalidate(tables); break; } case SQLCOM_ANALYZE: @@ -2152,13 +2161,17 @@ mysql_execute_command(void) even if there is a problem with the OPTION_AUTO_COMMIT flag (Which of course should never happen...) */ + { thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE); thd->server_status&= ~SERVER_STATUS_IN_TRANS; if (!ha_commit(thd)) + { send_ok(&thd->net); + } else res= -1; break; + } case SQLCOM_ROLLBACK: thd->server_status&= ~SERVER_STATUS_IN_TRANS; if (!ha_rollback(thd)) @@ -2451,12 +2464,21 @@ mysql_parse(THD *thd,char *inBuf,uint length) mysql_init_query(thd); thd->query_length = length; - LEX *lex=lex_start(thd, (uchar*) inBuf, length); - if (!yyparse() && ! thd->fatal_error) - mysql_execute_command(); - thd->proc_info="freeing items"; - free_items(thd); /* Free strings used by items */ - lex_end(lex); + if (query_cache.send_result_to_client(thd, inBuf, length)) + { + thd->safe_to_cache_query=1; + LEX *lex=lex_start(thd, (uchar*) inBuf, length); + if (!yyparse() && ! thd->fatal_error) + { + mysql_execute_command(); + query_cache_end_of_result(&thd->net); + } + else + query_cache_abort(&thd->net); + thd->proc_info="freeing items"; + free_items(thd); /* Free strings used by items */ + lex_end(lex); + } DBUG_VOID_RETURN; } @@ -2982,6 +3004,15 @@ bool reload_acl_and_cache(THD *thd, uint options, TABLE_LIST *tables) if (ha_flush_logs()) result=1; } + if (options & REFRESH_QUERY_CACHE_FREE) + { + query_cache.pack(); + options &= ~REFRESH_QUERY_CACHE; //don't flush all cache, just free memory + } + if (options & (REFRESH_TABLES | REFRESH_QUERY_CACHE)) + { + query_cache.flush(); + } if (options & (REFRESH_TABLES | REFRESH_READ_LOCK)) { if ((options & REFRESH_READ_LOCK) && thd) |