Skip to content

MySQL: MYSQL_BIND 'is_unsigned' member is not set #158

@simon-graham

Description

@simon-graham

For unsigned types, the MYSQL_BIND is_unsigned value should be set to 1. The relevant code in 1.5.x/trunk is in /Data/MySQL/src/Binder.cpp.

void Binder::realBind(std::size_t pos, enum_field_types type, const void* buffer, int length)
{
    if (pos >= _bindArray.size())
    {
        std::size_t s = static_cast<std::size_t>(_bindArray.size());
        _bindArray.resize(pos + 1);

        std::memset(&_bindArray[s], 0, sizeof(MYSQL_BIND) * (_bindArray.size() - s));
    }

    MYSQL_BIND b = {0};

    b.buffer_type   = type;
    b.buffer        = const_cast<void*>(buffer);
    b.buffer_length = length;

    _bindArray[pos] = b;
}

This function should also set is_unsigned, based on the type of value we are binding in Binder::bind. According to the MySQL documentation, this value must be set

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions