diff options
author | unknown <hf@deer.(none)> | 2003-12-01 17:19:10 +0400 |
---|---|---|
committer | unknown <hf@deer.(none)> | 2003-12-01 17:19:10 +0400 |
commit | 5d90d9406eb23052916482d4b4f76631a507cfe9 (patch) | |
tree | 126aa9404b20610fed02f1d2fb10aac967ed5334 /libmysqld/emb_qcache.h | |
parent | 046b80bbeb074aeea3158c8108d93e6e6215d2e2 (diff) | |
download | mariadb-git-5d90d9406eb23052916482d4b4f76631a507cfe9.tar.gz |
SCRUM
WL#1246 (Query cache in embedded library)
libmysqld/Makefile.am:
New files added to the project
libmysqld/lib_sql.cc:
added initialization of 'newborn' fields:
catalog, catalog_length, def_length
sql/sql_cache.cc:
Code added to provide query-cache in embedded library
query_cache_insert isn't called during the query execution
in embedded library. So we call it in query_cache_end_of_result.
Parameter of query_cache_end_of_result changed to get access to
the recordset
sql/sql_cache.h:
function's parameter changed
sql/sql_parse.cc:
we don't need these anymore
Diffstat (limited to 'libmysqld/emb_qcache.h')
-rw-r--r-- | libmysqld/emb_qcache.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/libmysqld/emb_qcache.h b/libmysqld/emb_qcache.h new file mode 100644 index 00000000000..32ce19847ff --- /dev/null +++ b/libmysqld/emb_qcache.h @@ -0,0 +1,61 @@ +/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +class Querycache_stream +{ + byte *cur_data; + byte *data_end; + Query_cache_block *block; + uint headers_len; +public: +#ifndef DBUG_OFF + uint stored_size; +#endif + Querycache_stream(Query_cache_block *ini_block, uint ini_headers_len) : + block(ini_block), headers_len(ini_headers_len) + { + use_next_block(); +#ifndef DBUG_OFF + stored_size= 0; +#endif + } + void use_next_block() + { + cur_data= ((byte*)block)+headers_len; + data_end= cur_data + (block->used-headers_len); + } + + void store_char(char c); + void store_short(ushort s); + void store_int(uint i); + void store_ll(ulonglong ll); + void store_str_only(const char *str, uint str_len); + void store_str(const char *str, uint str_len); + void store_safe_str(const char *str, uint str_len); + + char load_char(); + ushort load_short(); + uint load_int(); + ulonglong load_ll(); + void load_str_only(char *buffer, uint str_len); + char *load_str(MEM_ROOT *alloc, uint *str_len); + int load_safe_str(MEM_ROOT *alloc, char **str, uint *str_len); + int load_column(MEM_ROOT *alloc, char **column); +}; + +uint emb_count_querycache_size(THD *thd); +int emb_load_querycache_result(THD *thd, Querycache_stream *src); +void emb_store_querycache_result(Querycache_stream *dst, THD* thd); |