开发者

IDataReader from Oracle Overflows when returning decimal values

开发者 https://www.devze.com 2023-01-24 15:08 出处:网络
I have some code that is responsible for converting data from an IDataReader into an IronPython.Runtime.List of PythonTuples.This same code is employed for several different kinds of database connecti

I have some code that is responsible for converting data from an IDataReader into an IronPython.Runtime.List of PythonTuples. This same code is employed for several different kinds of database connections (including Access, Oracle and MySql).

Oracle's OracleDecimal datatype causes an overflow when calling dataReader.GetValues() when the cursor contains a value with a large precision. This issue has been well documented, and the solutions always involve using specific methods on the OracleDataAdapter. I only have an IDataReader interface.

Is there any way around this开发者_运维知识库 issue without binding my code specifically to ODP.NET? Surely there must be some way to get at this data in a provider-agnostic way?


The only provider agnostic method that I am aware of is to round the values in your select statement. I've found that rounding to 15 decimal places usually does the trick.


It may not be exactly what you're looking for, but the System.Data.Common.DbDataReader class has a GetProviderSpecificValues function that may do what you want

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号