summaryrefslogtreecommitdiff
path: root/sql/uniques.cc
diff options
context:
space:
mode:
authorunknown <Sinisa@sinisa.nasamreza.org>2001-06-07 14:10:58 +0300
committerunknown <Sinisa@sinisa.nasamreza.org>2001-06-07 14:10:58 +0300
commitdd7f452c3ba6d4a673f07a271f60cf30c0d0c8d2 (patch)
treedd2be2dec43e6f6be30389e81bd803459d639fb6 /sql/uniques.cc
parent10da0aee9412748ef2f2f6c1d87367c69bc8526f (diff)
downloadmariadb-git-dd7f452c3ba6d4a673f07a271f60cf30c0d0c8d2.tar.gz
Enhancing both multi-table delete and division of LEX
sql/filesort.cc: removing of some extra comments sql/sql_class.h: Clear division between new and old stripping code sql/sql_delete.cc: Stripping of unnecessary code and making it more efficient sql/sql_parse.cc: Better split of LEX into two and enhancements in multi table delete sql/sql_yacc.yy: More efficient division of LEX and optional syntax in multi - table delete sql/uniques.cc: fixing some additional bugs
Diffstat (limited to 'sql/uniques.cc')
-rw-r--r--sql/uniques.cc13
1 files changed, 5 insertions, 8 deletions
diff --git a/sql/uniques.cc b/sql/uniques.cc
index 36a395dfa5d..c1ffeda1729 100644
--- a/sql/uniques.cc
+++ b/sql/uniques.cc
@@ -39,12 +39,12 @@ Unique::Unique(qsort_cmp2 comp_func, void * comp_func_fixed_arg,
uint size, ulong max_in_memory_size_arg)
:max_in_memory_size(max_in_memory_size_arg),elements(0)
{
- my_b_clear(&file);
init_tree(&tree, max_in_memory_size / 16, size, comp_func, 0, 0);
tree.cmp_arg=comp_func_fixed_arg;
/* If the following fail's the next add will also fail */
init_dynamic_array(&file_ptrs, sizeof(BUFFPEK), 16, 16);
max_elements= max_in_memory_size / ALIGN_SIZE(sizeof(TREE_ELEMENT)+size);
+ open_cached_file(&file, mysql_tmpdir,TEMP_PREFIX, DISK_BUFFER_SIZE, MYF(MY_WME));
}
@@ -74,8 +74,6 @@ bool Unique::flush()
int unique_write_to_file(gptr key, element_count count, Unique *unique)
{
- if (!my_b_inited(&unique->file) && open_cached_file(&unique->file, mysql_tmpdir,TEMP_PREFIX, DISK_BUFFER_SIZE, MYF(MY_WME)))
- return 1;
return my_b_write(&unique->file, key, unique->tree.size_of_element) ? 1 : 0;
}
@@ -114,7 +112,7 @@ bool Unique::get(TABLE *table)
IO_CACHE *outfile=table->io_cache, tempfile;
BUFFPEK *file_ptr= (BUFFPEK*) file_ptrs.buffer;
- uint maxbuffer= file_ptrs.elements - 1; // I added -1 .....
+ uint maxbuffer= file_ptrs.elements - 1;
uchar *sort_buffer;
my_off_t save_pos;
bool error=1;
@@ -122,16 +120,15 @@ bool Unique::get(TABLE *table)
my_b_clear(&tempfile);
/* Open cached file if it isn't open */
- if (!outfile) outfile= (IO_CACHE *) sql_calloc(sizeof(IO_CACHE));
- if (! my_b_inited(outfile) &&
+ outfile=table->io_cache=(IO_CACHE*) my_malloc(sizeof(IO_CACHE),MYF(MY_ZEROFILL));
+
+ if (!outfile || ! my_b_inited(outfile) &&
open_cached_file(outfile,mysql_tmpdir,TEMP_PREFIX,READ_RECORD_BUFFER,
MYF(MY_WME)))
return 1;
reinit_io_cache(outfile,WRITE_CACHE,0L,0,0);
-// sort_param.keys=elements;
sort_param.max_rows= elements;
- sort_param.examined_rows=0;
sort_param.sort_form=table;
sort_param.sort_length=sort_param.ref_length=tree.size_of_element;
sort_param.keys= max_in_memory_size / sort_param.sort_length;