summaryrefslogtreecommitdiff
path: root/sql/field_conv.cc
diff options
context:
space:
mode:
authormonty@mysql.com <>2004-12-06 02:00:37 +0200
committermonty@mysql.com <>2004-12-06 02:00:37 +0200
commit67ce24796584e80cf843b37b09aeb794c9231190 (patch)
treeb75e098b12b8e91a3470008602bacbb5b3009e45 /sql/field_conv.cc
parent46089cfd144be3430f69e2a8b48b0aeee154d6fa (diff)
downloadmariadb-git-67ce24796584e80cf843b37b09aeb794c9231190.tar.gz
Add support for up to VARCHAR (size up to 65535)
Renamed HA_VAR_LENGTH to HA_VAR_LENGTH_PART Renamed in all files FIELD_TYPE_STRING and FIELD_TYPE_VAR_STRING to MYSQL_TYPE_STRING and MYSQL_TYPE_VAR_STRING to make it easy to catch all possible errors Added support for VARCHAR KEYS to heap Removed support for ISAM Now only long VARCHAR columns are changed to TEXT on demand (not CHAR) Internal temporary files can now use fixed length tables if the used VARCHAR columns are short
Diffstat (limited to 'sql/field_conv.cc')
-rw-r--r--sql/field_conv.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/sql/field_conv.cc b/sql/field_conv.cc
index 890687fc925..5074f4e0026 100644
--- a/sql/field_conv.cc
+++ b/sql/field_conv.cc
@@ -355,15 +355,16 @@ static void do_expand_string(Copy_field *copy)
static void do_varstring(Copy_field *copy)
{
uint length=uint2korr(copy->from_ptr);
- if (length > copy->to_length-2)
+ if (length > copy->to_length- HA_KEY_BLOB_LENGTH)
{
- length=copy->to_length-2;
+ length=copy->to_length-HA_KEY_BLOB_LENGTH;
if (current_thd->count_cuted_fields)
copy->to_field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_DATA_TRUNCATED, 1);
}
int2store(copy->to_ptr,length);
- memcpy(copy->to_ptr+2, copy->from_ptr,length);
+ memcpy(copy->to_ptr+HA_KEY_BLOB_LENGTH, copy->from_ptr + HA_KEY_BLOB_LENGTH,
+ length);
}
/***************************************************************************
@@ -506,7 +507,7 @@ void (*Copy_field::get_copy_func(Field *to,Field *from))(Copy_field*)
}
else if (to->charset() != from->charset())
return do_field_string;
- else if (to->real_type() == FIELD_TYPE_VAR_STRING && to_length !=
+ else if (to->real_type() == MYSQL_TYPE_VARCHAR && to_length !=
from_length)
return do_varstring;
else if (to_length < from_length)