diff options
author | unknown <acurtis/antony@ltamd64.xiphis.org> | 2006-10-03 16:51:19 -0700 |
---|---|---|
committer | unknown <acurtis/antony@ltamd64.xiphis.org> | 2006-10-03 16:51:19 -0700 |
commit | 831924f1675a4741ac75742e2452d347ca83f4b4 (patch) | |
tree | d94d214c7569e1874fa9aeee74e68af14a3b5477 /storage | |
parent | c0acb5d545322c7502cdbd0604b54fc0c0c46799 (diff) | |
parent | 71401eaccaa3dcb35875a36f9a84d7605609b0f3 (diff) | |
download | mariadb-git-831924f1675a4741ac75742e2452d347ca83f4b4.tar.gz |
Merge xiphis.org:/home/antony/work2/p2-bug22080.2
into xiphis.org:/home/antony/work2/p2-bug22080.3
storage/csv/ha_tina.cc:
Auto merged
Diffstat (limited to 'storage')
-rw-r--r-- | storage/csv/ha_tina.cc | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index 8f090470f49..c5c3ff11edc 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -548,7 +548,10 @@ int ha_tina::encode_quote(byte *buf) in the code. */ if ((*field)->is_null()) - ptr= end_ptr= 0; + { + buffer.append(STRING_WITH_LEN("\"\",")); + continue; + } else { (*field)->val_str(&attribute,&attribute); @@ -649,6 +652,7 @@ int ha_tina::find_current_row(byte *buf) off_t end_offset, curr_offset= current_position; int eoln_len; my_bitmap_map *org_bitmap; + int error; DBUG_ENTER("ha_tina::find_current_row"); /* @@ -662,23 +666,23 @@ int ha_tina::find_current_row(byte *buf) /* Avoid asserts in ::store() for columns that are not going to be updated */ org_bitmap= dbug_tmp_use_all_columns(table, table->write_set); + error= HA_ERR_CRASHED_ON_USAGE; + + memset(buf, 0, table->s->null_bytes); for (Field **field=table->field ; *field ; field++) { buffer.length(0); - if (file_buff->get_value(curr_offset) == '"') + if (curr_offset < end_offset && + file_buff->get_value(curr_offset) == '"') curr_offset++; // Incrementpast the first quote else - { - dbug_tmp_restore_column_map(table->write_set, org_bitmap); - DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); - } - for(;curr_offset != end_offset; curr_offset++) + goto err; + for(;curr_offset < end_offset; curr_offset++) { // Need to convert line feeds! if (file_buff->get_value(curr_offset) == '"' && - (((file_buff->get_value(curr_offset + 1) == ',') && - (file_buff->get_value(curr_offset + 2) == '"')) || + ((file_buff->get_value(curr_offset + 1) == ',') || (curr_offset == end_offset -1 ))) { curr_offset+= 2; // Move past the , and the " @@ -708,10 +712,7 @@ int ha_tina::find_current_row(byte *buf) we are working with a damaged file. */ if (curr_offset == end_offset - 1) - { - dbug_tmp_restore_column_map(table->write_set, org_bitmap); - DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); - } + goto err; buffer.append(file_buff->get_value(curr_offset)); } } @@ -719,11 +720,12 @@ int ha_tina::find_current_row(byte *buf) (*field)->store(buffer.ptr(), buffer.length(), system_charset_info); } next_position= end_offset + eoln_len; - /* Maybe use \N for null? */ - memset(buf, 0, table->s->null_bytes); /* We do not implement nulls! */ + error= 0; + +err: dbug_tmp_restore_column_map(table->write_set, org_bitmap); - DBUG_RETURN(0); + DBUG_RETURN(error); } /* |