Текущий архив: 2006.10.08;
Скачать: CL | DM;
Внизkoledb with oracle - count() function Найти похожие ветки
← →
azsd © (2005-12-13 20:08) [0]Hi,all
some times I use ifieldByName["rcnt"] for "SELECT COUNT(*) rcnt FROM table_foo" but It always give me a zero or negative value.
oracle 9.2.0.7 on linux,and microsoft/oracle oledb provider for windows.
after some debug and delphi hang I found the coltype of rcnt is ftReal for "rcnt" field.
and the raw type of "rcnt" is DBTYPE_VARNUMERIC.
sure the normal number field have DBTYPE_NUMERIC type.
I found some data
I64(PQWORD of rawdate?) = TO_CHAR(number or varnumeric)
$2601000A = $0426
$00010001 = $0 (var)
$0001FF01 = $0 (var,orale provider)
$01010001 = $1 (var)
$0201000A = $2
$02010001 = $2 (var)
$66010004 = $0966 (var)
$9701000A = $0297
I pastle it to WinHex and use data inspector but the Single/Double type have no matched true values.
at last I serach DBTYPE_NUMERIC in koledb.pas and get a "TODO" mark.
How can I convert the value to double or integer use data like FieldPtr/bPrecision/bScale?
In other way,Is It a todo or an impossible task?
or is there some new build? (I get 1.165 in 2004/Oct/23 file date)
in the past i use TO_CHAR in querytext,but today I want to fix it.
← →
azsd © (2005-12-14 20:58) [1]the FieldPtr seems like an 24bytes struct in numeric:
$0426=
0A 00 01 26 04 00 00 00 00 00 00 00 00 00 00 00 ..... 00 00 00 00
$0297=
0A 00 01 97 02 00 00 00 00 00 00 00 00 00 00 00 ..... 00 00 00 00
I think it may have local Precision and Scale in this struct.
var_numeric
121=$79=
03 00 01 79 00 00 00 05 15 00 00 00 E2 96 54 E0 0F 47 E6 50 00 00 00 00
2737=$AB0=
040001 B10A0000 000000000000000000000000000000000
the 1st byte may be Precision(decimal digits?) in varnumeric,so the 2nd seems be scale.
I will use this step in TQuery.GetFloatFields:
1.get WORD/DWORD/QWORD/other integer data by local Precision
2.use local scale to scale them to double.
now I can not make sure If it will occur errors of other provider,
Is there some detail documents of the struct avalible?
I search over the net but hav"nt get something helpful.
← →
azsd © (2005-12-15 19:29) [2]I added FillChar in FetchData to clear the Buffer,and got the varnumberic structure fixed up.
the random bytes like
030001 DE010500 00530065 00740074 0069006E 00
cleanuped to
030001 DE000000 00000000 00000000 00000000 00
I tranlate the tagDB_VARNUMERIC from MSDN to koledb.pas with PDBVARNumric and compile it,shamely I found it have an same declare exists in orginal codes.
at last the dbtype_numeric and dbtype_varnumberic in GetFltField/GetIntField have been added now.
thx all who had readed this posts.
I am sorry for the shuffle codes and grammer.
Страницы: 1 вся ветка
Текущий архив: 2006.10.08;
Скачать: CL | DM;
Память: 0.44 MB
Время: 0.04 c