ddbc icon indicating copy to clipboard operation
ddbc copied to clipboard

odbc driver doesn't support SQL_DECIMAL

Open the5avage opened this issue 6 years ago • 1 comments

Hi, when using the odbc driver with an Oracle database my program crashed with an exception ("Type 3 not supported"). I could fix this by adding a case to the switch statement in line: 922 of file drivers/odbcddbc.d:

case SQL_DECIMAL: return readValue!(char[]);

I'm not experienced with SQL (i want to use ddbc for a sql course at my university) so maybe i miss some subtle issue with this. It also works to convert it to double like this,

case SQL_DECIMAL: return readValue!double;

but in my case the decimal type is used to store user IDs and converting to a floating point type would make no sense...

the5avage avatar Nov 09 '19 11:11 the5avage

DECIMAL can be various types depending on the precision that was used:

Precision Storage bytes
1 – 9 5
10-19 9
20-28 13
29-38 17

So it should probably attempt to convert to whichever number type the user is using and error if the data cannot convert correctly.

SingingBush avatar Dec 09 '19 18:12 SingingBush