summaryrefslogtreecommitdiff
path: root/sql/ha_heap.cc
diff options
context:
space:
mode:
authorunknown <jani@prima.mysql.com>2000-12-07 14:17:07 +0200
committerunknown <jani@prima.mysql.com>2000-12-07 14:17:07 +0200
commit034e028d008f015643b530b03e29760801f89d3a (patch)
treecf3fdf6bbd0e62cc396bacddd0c4a2eaa5731b5a /sql/ha_heap.cc
parent128ebc1739d011e1af08bdfee8aa784cdb221afe (diff)
downloadmariadb-git-034e028d008f015643b530b03e29760801f89d3a.tar.gz
Bug fix, max_heap_table_size variable was not used.
Docs/manual.texi: Bug fix with HEAP type tables.
Diffstat (limited to 'sql/ha_heap.cc')
-rw-r--r--sql/ha_heap.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/sql/ha_heap.cc b/sql/ha_heap.cc
index b4b0c4b677e..0a8f55bc5bb 100644
--- a/sql/ha_heap.cc
+++ b/sql/ha_heap.cc
@@ -33,7 +33,8 @@ const char **ha_heap::bas_ext() const
int ha_heap::open(const char *name, int mode, uint test_if_locked)
{
- uint key,part,parts;
+ uint key,part,parts,mem_per_row=0;
+ ulong max_rows;
HP_KEYDEF *keydef;
HP_KEYSEG *seg;
@@ -47,7 +48,8 @@ int ha_heap::open(const char *name, int mode, uint test_if_locked)
for (key=0 ; key < table->keys ; key++)
{
KEY *pos=table->key_info+key;
-
+ mem_per_row += (pos->key_length + (sizeof(char*) * 2));
+
keydef[key].keysegs=(uint) pos->key_parts;
keydef[key].flag = (pos->flags & HA_NOSAME);
keydef[key].seg=seg;
@@ -66,9 +68,13 @@ int ha_heap::open(const char *name, int mode, uint test_if_locked)
seg++;
}
}
+ mem_per_row += MY_ALIGN(table->reclength+1, sizeof(char*));
+ max_rows = (ulong) (max_heap_table_size / mem_per_row);
file=heap_open(table->path,mode,
table->keys,keydef,
- table->reclength,table->max_rows,
+ table->reclength,
+ ((table->max_rows < max_rows && table->max_rows) ?
+ table->max_rows : max_rows),
table->min_rows);
my_free((gptr) keydef,MYF(0));
info(HA_STATUS_NO_LOCK | HA_STATUS_CONST | HA_STATUS_VARIABLE);