pocoproject / poco

The POCO C++ Libraries are powerful cross-platform C++ libraries for building network- and internet-based applications that run on desktop, server, mobile, IoT, and embedded systems.
https://pocoproject.org
Other
8.42k stars 2.17k forks source link

ODBC: DataFormatException getting Time value from SQL Server #3801

Open MailShop opened 2 years ago

MailShop commented 2 years ago

Hi,

I get a DataFormatException getting time values from SQL Server. Example:

Session session("ODBC", "Driver=ODBC Driver 17 for SQL Server;Server=[...];Database=[...];Trusted_Connection=yes;");
session << "CREATE TABLE TimeTestTable (ok int, bad time)", now;
session << "INSERT INTO TimeTestTable (ok, bad) VALUES ( 1, '12:34:56')", now;
Statement s(session);
//s << "SELECT ok FROM TimeTestTable WHERE ok=1", now; //this works fine
s << "SELECT bad FROM TimeTestTable WHERE ok=1", now; //this throws DataFormatException("Unsupported data type.")
Poco::Data::RecordSet rs(s);

Looks like SQL Server's ODBC driver returns a custom type, SQL_SS_TIME2 (-154), rather than the standard value. Not the only project to notice this problem: https://github.com/nanodbc/nanodbc/issues/18

Pull request with a fix: https://github.com/pocoproject/poco/pull/3802

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 365 days with no activity.

Smurf-IV commented 1 year ago

Why are pull requests being ignored ?

github-actions[bot] commented 1 month ago

This issue is stale because it has been open for 365 days with no activity.