【发布时间】:2013-04-18 10:45:45
【问题描述】:
我对@987654322@ 有一个大问题:
这是我的 SQL:
select cast(-10 as number(9)) foo, -10 bar
from dual
添加“foo”字段时会创建一个 TIntegerField 而不是 TBCDField,因为此时类型已更改:
procedure TCustomADODataSet.InternalInitFieldDefs;
if (F.Type_ = adNumeric) and (F.NumericScale = 0) and
(F.Precision < 10) then
FieldType := ftInteger;
功能:
function TCustomADODataSet.GetFieldData(Field: TField; Buffer: Pointer;
NativeFormat: Boolean): Boolean;
此时不考虑信号:
ftAutoInc, ftInteger:
Integer(Buffer^) := lVal;
TIntegerField 的tagVariant 的值为:
(14, 32768, 0, 0, 10, 10, 10, 1.4012984643e-44, 4.9406564584e-323, True, 10, 0.001, 4.9406564584e-323, , $A, $A, $A, $ A, $A, $A, $A, $A, $A, $A, $A, $A, $A'', $A, $A, $A, $A, $A, #10, 10 , 10, 10, 10, $A, , $A, $A, $A, $A)
TBCDField 也一样:
(14, 32768, 0, 0, 10, 10, 10, 1.4012984643e-44, 4.9406564584e-323, True, 10, 0.001, 4.9406564584e-323, , $A, $A, $A, $ A, $A, $A, $A, $A, $A, $A, $A, $A, $A'', $A, $A, $A, $A, $A, #10, 10 , 10, 10, 10, $A, , $A, $A, $A, $A)
foo 值为 10,bar 值为 -10。
这是一个错误吗?
有解决方法吗?
修好了?
我使用 Microsoft OLEDB Provider for Oracle 和 Oracle Provider for OLEDB 进行了测试。 所有测试均使用 Delphi 6 完成。
【问题讨论】:
-
有什么建议吗?有疑问吗?
-
我没有任何 Oracle 数据库可以尝试这个。 ;-)
-
如果在 ADO 记录集级别存在错误。 :-)
-
尝试使用 10 的精度。即
select cast(-10 as number(10)) foo。你能做到吗?其他选项是替换 ADODB.pas(或覆盖)TCustomADODataSet.GetFieldData。 see here -
@kobik 选择是由用户组装的,我无法预知这种情况。
标签: oracle delphi casting activex bcd