[odb-users] Quering with empty string parameter error. Microsoft SQL Server

Boris Kolpackov boris at codesynthesis.com
Thu Jul 4 10:40:22 EDT 2019

Andrey Paraskevopulo <andrey.psv at gmail.com> writes:

> As I understand, the problem that param in statement exists("... WHERE
> name=?"), but the value in not binded.
> Possible solutions:
> 1. Init buffer data for the empty string with empty size (for the query
>    param)
>    [...]

Thanks for the report and analysis! I've applied a slightly different
implementation of this fix. Could you confirm it works as expected for


> Remark: solution does not affect Blob variables (they have the null buf for
> the empty values). May be the query problem can be reproduced for the Blobs
> too.

Hm, long_query_param_impl is used as a base for
query_param_impl<T, id_long_binary> so I would expect this fix to
also work for BLOBs. Or am I missing something here?

> 2. Disable skip empty binds (with null buffer)
> [...]
> This solves the problem, but for me it hard to predict side effects.

Yes, I vaguely remember there being some issues with passing NULL
buffers to MSSQL (ODBC) runtime.

More information about the odb-users mailing list