summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorunknown <kostja@bodhi.local>2007-01-11 22:15:20 +0300
committerunknown <kostja@bodhi.local>2007-01-11 22:15:20 +0300
commitc1bcbe2973c2c3a4054635bac4a787ca06758c05 (patch)
treee4e6b520180358f870a1eeddcb51c8da437e1b44 /storage
parentbd27fcf8438a53d88ff292d955c13253a916b349 (diff)
parent5ed3d05e4078032f44d74c116919d2a0ec4aa550 (diff)
downloadmariadb-git-c1bcbe2973c2c3a4054635bac4a787ca06758c05.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into bodhi.local:/opt/local/work/mysql-5.1-runtime mysql-test/t/trigger.test: Auto merged sql/item_func.cc: Auto merged sql/sql_prepare.cc: Auto merged storage/csv/ha_tina.cc: Auto merged mysql-test/r/csv.result: Manual merge. mysql-test/t/csv.test: Manual merge.
Diffstat (limited to 'storage')
-rw-r--r--storage/csv/ha_tina.cc6
-rw-r--r--storage/heap/hp_block.c2
-rw-r--r--storage/heap/hp_write.c12
3 files changed, 14 insertions, 6 deletions
diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc
index 0818b915618..afe8e5f1b27 100644
--- a/storage/csv/ha_tina.cc
+++ b/storage/csv/ha_tina.cc
@@ -469,14 +469,16 @@ int ha_tina::encode_quote(byte *buf)
const char *end_ptr;
/*
- Write an empty string to the buffer in case of a NULL value.
+ CSV does not support nulls. Write quoted 0 to the buffer. In fact,
+ (*field)->val_str(&attribute,&attribute) would usually return 0
+ in this case but we write it explicitly here.
Basically this is a safety check, as no one ensures that the
field content is cleaned up every time we use Field::set_null()
in the code.
*/
if ((*field)->is_null())
{
- buffer.append(STRING_WITH_LEN("\"\","));
+ buffer.append(STRING_WITH_LEN("\"0\","));
continue;
}
diff --git a/storage/heap/hp_block.c b/storage/heap/hp_block.c
index 35e65a94603..85219380287 100644
--- a/storage/heap/hp_block.c
+++ b/storage/heap/hp_block.c
@@ -75,7 +75,7 @@ int hp_get_new_block(HP_BLOCK *block, ulong *alloc_length)
and my_default_record_cache_size we get about 1/128 unused memory.
*/
*alloc_length=sizeof(HP_PTRS)*i+block->records_in_block* block->recbuffer;
- if (!(root=(HP_PTRS*) my_malloc(*alloc_length,MYF(0))))
+ if (!(root=(HP_PTRS*) my_malloc(*alloc_length,MYF(MY_WME))))
return 1;
if (i == 0)
diff --git a/storage/heap/hp_write.c b/storage/heap/hp_write.c
index f8b268ee06a..86e79c9d7ec 100644
--- a/storage/heap/hp_write.c
+++ b/storage/heap/hp_write.c
@@ -67,11 +67,17 @@ int heap_write(HP_INFO *info, const byte *record)
DBUG_RETURN(0);
err:
- DBUG_PRINT("info",("Duplicate key: %d", (int) (keydef - share->keydef)));
+ if (my_errno == HA_ERR_FOUND_DUPP_KEY)
+ DBUG_PRINT("info",("Duplicate key: %d", (int) (keydef - share->keydef)));
info->errkey= keydef - share->keydef;
- if (keydef->algorithm == HA_KEY_ALG_BTREE)
+ /*
+ We don't need to delete non-inserted key from rb-tree. Also, if
+ we got ENOMEM, the key wasn't inserted, so don't try to delete it
+ either. Otherwise for HASH index on HA_ERR_FOUND_DUPP_KEY the key
+ was inserted and we have to delete it.
+ */
+ if (keydef->algorithm == HA_KEY_ALG_BTREE || my_errno == ENOMEM)
{
- /* we don't need to delete non-inserted key from rb-tree */
keydef--;
}
while (keydef >= share->keydef)