🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #2884

Re: Oracle. How to get negative numbers ?

#2884
From: Arnie Mauer
Date: Mon, 24 Feb 2003 18:00
62 lines
3174 bytes
I'm using BCB 5.  I don't know if there's any difference there.  Also MDAC
2.7 on W2K.

I have noticed the following.  When retrieving a column at runtime, such as:

int AnInt = qry->FieldByName( "AField" )->AsInteger;

works as expected.  But, when binding them (Static?) at design time, as an
example for use with a data source and TDBGrid, the fields are declared as
Floats in the header, such as:

TFloatField * qryAFIELD;

Is this where you're having the problem?

- Arnie

"Victor Cazacov" <victor@kazakov.net> wrote in message
news:3e5a34d0@newsgroups.borland.com...
> Hello, Arnie !
>
>  AM> We use NUMBER(10) and have no problem with signed values.
>
> Yes, with NUMBER(10) there is no problem because it mapped to TBCBField.
>
> In ADODB file, in InternalInitFieldDefs procedure there is code:
>
> if (F.Type_ = adNumeric) and (F.NumericScale = 0) and
>     (F.Precision < 10) then
>           FieldType := ftInteger;
>
> So, BCD fields with precision less then 10 are treated as integer fields.
> I do not know for what reason does Borland use this trick (in BCB5 all
> adNumeric fields are mapped to BCB), but it allows me to use same
> code to work with both Oracle and Sybase databases. I have SMALLINT
> and INTEGER columns in Sybase, and without this trick get "Type mismatch,
> expected smallint, actual BCD" error when opening query to Oracle.
>
> Problem is that in another place in ADODB file, in
> TCustomADODataSet.GetFieldData procedure it is written:
>
> with tagVariant(Data) do
>   case Field.DataType of
> ...
>     ftAutoInc, ftInteger:
>       Integer(Buffer^) := lVal;
>
> That is not correct, because in case with Oracle NUMBER(9) field, Variant
> variable containing field value has type vtInterface and lVal member can
> not be used to get integer value. I think that VariantChangeTypeEx must
> be called here.
>
> Now the only way I see is to change all ADOQuery components to my class
> inherited from TCustomADODataSet and override GetFieldData method. Problem
> is in my bad Pascal knowlege.
>
> May be there is easier workaround ?
>
> --
> Regards, Victor
>
>
Technical Details
Message-ID: <3e5a5db0$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3e5a01b5$1@newsgroups.borland.com> <3e5a2a63@newsgroups.borland.com> <3e5a34d0@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,e2ba085cccbd09f0
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2003-02-24 10:04:07 PST
From: "Arnie Mauer" <amauer@vrms.com>
Newsgroups: borland.public.cppbuilder.database.ado
References: <3e5a01b5$1@newsgroups.borland.com> <3e5a2a63@newsgroups.borland.com> <3e5a34d0@newsgroups.borland.com>
Subject: Re: Oracle. How to get negative numbers ?
Date: Mon, 24 Feb 2003 13:00:24 -0500
Lines: 64
Organization: VRMS
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2720.3000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
NNTP-Posting-Host: 209.140.211.97
Message-ID: <3e5a5db0$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1046109616 209.140.211.97 (24 Feb 2003 10:00:16 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail