summaryrefslogtreecommitdiff
path: root/myisam/mi_open.c
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2003-01-09 02:19:14 +0200
committerunknown <monty@mashka.mysql.fi>2003-01-09 02:19:14 +0200
commitb5e37b242e23c1fed48007e0ec6f9eb7ecc34758 (patch)
treed8a4d338b246396e32745b9fe381fc6de42d5a9d /myisam/mi_open.c
parenta3f4a46bf29761fe73760a74ceb86491861dcbf4 (diff)
downloadmariadb-git-b5e37b242e23c1fed48007e0ec6f9eb7ecc34758.tar.gz
Don't count NULL values in cardinalty for MyISAM tables.
Free row buffer cache after each query for MyISAM tables. Added table join option FORCE INDEX Fixed core dump bug when connecting with hostname that could not be resolved. include/my_base.h: Don't count NULL values in cardinalty myisam/mi_check.c: Don't count NULL values in cardinalty myisam/mi_extra.c: Free row buffer cache after each query myisam/mi_open.c: Avoid realloc if cache size doesn't change myisam/mi_search.c: Don't count NULL values in cardinalty myisam/myisamdef.h: Change buffer length from uint to uint32 to make it more portable/predictable mysql-test/r/myisam.result: Test case for cardinality with NULL keys and FORCE INDEX mysql-test/t/myisam.test: Test case for cardinality with NULL keys and FORCE INDEX sql/lex.h: Added table join option FORCE INDEX sql/mysql_priv.h: Added table join option FORCE INDEX sql/opt_range.cc: Added table join option FORCE INDEX sql/sql_base.cc: Added table join option FORCE INDEX sql/sql_lex.h: Added table join option FORCE INDEX sql/sql_parse.cc: Added table join option FORCE INDEX Don't use strlen() on hostname without first checking if it's not NULL sql/sql_select.cc: Added table join option FORCE INDEX sql/sql_yacc.yy: Added table join option FORCE INDEX sql/table.h: Added table join option FORCE INDEX
Diffstat (limited to 'myisam/mi_open.c')
-rw-r--r--myisam/mi_open.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/myisam/mi_open.c b/myisam/mi_open.c
index aeacf81d90a..0da5ebabf40 100644
--- a/myisam/mi_open.c
+++ b/myisam/mi_open.c
@@ -559,28 +559,36 @@ err:
DBUG_RETURN (NULL);
} /* mi_open */
+
byte *mi_alloc_rec_buff(MI_INFO *info, ulong length, byte **buf)
{
uint extra;
+ uint32 old_length;
+ LINT_INIT(old_length);
- if (! *buf || length > mi_get_rec_buff_len(info, *buf))
+ if (! *buf || length > (old_length=mi_get_rec_buff_len(info, *buf)))
{
byte *newptr = *buf;
/* to simplify initial init of info->rec_buf in mi_open and mi_extra */
if (length == (ulong) -1)
+ {
length= max(info->s->base.pack_reclength+info->s->base.pack_bits,
info->s->base.max_key_length);
+ /* Avoid unnecessary realloc */
+ if (newptr && length == old_length)
+ return newptr;
+ }
extra= ((info->s->options & HA_OPTION_PACK_RECORD) ?
ALIGN_SIZE(MI_MAX_DYN_BLOCK_HEADER)+MI_SPLIT_LENGTH+
MI_REC_BUFF_OFFSET : 0);
if (extra && newptr)
- newptr-=MI_REC_BUFF_OFFSET;
+ newptr-= MI_REC_BUFF_OFFSET;
if (!(newptr=(byte*) my_realloc((gptr)newptr, length+extra+8,
MYF(MY_ALLOW_ZERO_PTR))))
return newptr;
- *((uint *)newptr)=length;
+ *((uint32 *) newptr)= (uint32) length;
*buf= newptr+(extra ? MI_REC_BUFF_OFFSET : 0);
}
return *buf;