Cant bind int64_t with odbc_backend
Brought to you by:
artyom-beilis
In file odbc_backend.cpp
in class odbc_backend::statement::parameter
in template method
template <typename T> /* line 591*/
void set(T v)
{
std::ostringstream ss;
ss.imbue(std::locale::classic());
if(!std::numeric_limits<T>::is_integer)
ss << std::setprecision(std::numeric_limits<T>::digits10+1);
ss << v;
value=ss.str();
null=false;
ctype = SQL_C_CHAR;
if(std::numeric_limits<T>::is_integer)
sqltype = SQL_INTEGER;
else
sqltype = SQL_DOUBLE;
}
This code cant handle integer values larger than 0x80000000, since they need a SQL_BIGINT
sqltype, but SQL_INTEGER
passed.
Passing value larger that that, causes an ODBC numeric type out of range
error. At least with SQL Server 2012 on Windows 7 client and server. Library and client application compiled with msvc2013 c++ compiller.
Proposed patch in attachment.
For any feedback, please email on vasilly.prokopyev<at>gmail.com</at>
Anonymous