From ebd5aec15e4901893711569e174cd9efbcc712e0 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 4 Dec 2006 03:07:44 +0300 Subject: Fix Bug #21328 mysqld issues warnings on ALTER CSV table to MyISAM mysql-test/r/csv.result: update result file mysql-test/r/log_tables.result: log_tables test contains alter of a CSV table with NULLs which results in warnings. In fact this is how the bug noticed. So, now when it is fixed we should update result file. mysql-test/t/csv.test: add a test for the bug storage/csv/ha_tina.cc: We should write 0 to the data file in the case we meet NULL. CSV does not support NULL values internally and we shouldn't distinguish them from 0 when writing a row (the alternative is to implement full NULL support). Otherwise other routines (such as Field::check_int() become confused). In 5.0 NULLs are stored as zeroes. In 5.1 it somehow turned into empty string. Which is wrong. --- storage/csv/ha_tina.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'storage/csv') diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index f7e5aa9d50c..6a6bc52d6ad 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -542,14 +542,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; } else -- cgit v1.2.1