Server/Database: Reduce differences between 3.3.5 and 6.x branches

Cherry-pick 1bea52fd46 and 543bea32 to add support to TYPE_BINARY MySQL field type
This commit is contained in:
jackpoz
2016-08-10 16:02:22 +02:00
parent 3755937611
commit abe37e458c
5 changed files with 59 additions and 18 deletions

View File

@@ -39,7 +39,7 @@ void Field::SetByteValue(void* newValue, enum_field_types newType, uint32 length
data.raw = true;
}
void Field::SetStructuredValue(char* newValue, enum_field_types newType)
void Field::SetStructuredValue(char* newValue, enum_field_types newType, uint32 length)
{
if (data.value)
CleanUp();
@@ -47,10 +47,10 @@ void Field::SetStructuredValue(char* newValue, enum_field_types newType)
// This value stores somewhat structured data that needs function style casting
if (newValue)
{
size_t size = strlen(newValue);
data.value = new char [size+1];
strcpy((char*)data.value, newValue);
data.length = size;
data.value = new char[length + 1];
memcpy(data.value, newValue, length);
*(reinterpret_cast<char*>(data.value) + length) = '\0';
data.length = length;
}
data.type = newType;