New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to set string parameter to NULL using bind overload #9
Comments
From @mloskot on July 3, 2017 20:55 The line I'm surprised the issue has not leaked earlier. I wonder if it is Progress/MSSQL specific or we don't have it covered with tests properly. @lexicalunit, since you made that change, do you recall why @AndrewJD79 What Progress do you use? Do you know if it is freely available edition we could run on Travis CI or AppVeyor services for testing? |
From @AndrewJD79 on July 3, 2017 21:29 I'm not sure about free Progress but it can be easily reproduced on MSSQL. |
From @mloskot on July 3, 2017 21:42
This particular one, yes. I was generally looking for Progress to set it up for nanodbc testing.
A driver may misinterpret I suppose @lexicalunit relied on that particular driver during earlier development of nanodbc. Anyhow, it needs to be fixed. |
Interesting. I think this is probably a bug left over from when I was still attempting to somehow refactor the bind interface, especially for strings, to make it less complicated. |
From @mloskot on July 7, 2017 11:52 AFAICT, the problem is with using Generally, strings are supposed to be bound using the dedicated family of @lexicalunit Does it seem correct? TBH, I'm not sure if there is point in fixing |
From @AndrewJD79 on July 7, 2017 17:23 Actually, I do use bind_strings. Please see stack-trace:
|
From @mloskot on July 7, 2017 21:57 OK. I looked at your MWE code, which says |
From @AndrewJD79 on July 3, 2017 20:40
Environment
Actual behavior
Unable to set string parameter to NULL using following bind overload:
void bind( short param_index, T const* values, std::size_t batch_size, bool const* nulls, param_direction direction = PARAM_IN);
The overload eventually calls
void statement::statement_impl::bind_parameter<string::value_type>( bound_parameter const& param, bound_buffer<string::value_type>& buffer)
For some reasons last parameter (parameter length or status indicator) passed into SQLBindParameter is
(buffer.size_ <= 1 ? nullptr : bind_len_or_null_[param.index_].data()
I'm not sure why length_or_status is depending from batch size (buffer.size_). If the line changed to
bind_len_or_null_[param.index_].data()
everything works as expected.
Expected behavior
parameter has to have NULL value
Minimal Working Example
Copied from original issue: lexicalunit/nanodbc#277
The text was updated successfully, but these errors were encountered: