🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Oracle. How to get negative numbers ?

#2883
From: Victor Cazacov
Date: Mon, 24 Feb 2003 15:03
41 lines
2628 bytes
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: <3e5a34d0@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3e5a01b5$1@newsgroups.borland.com> <3e5a2a63@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 07:10:05 PST
Reply-To: "Victor Cazacov" <victor@kazakov.net>
From: "Victor Cazacov" <victor@kazakov.net>
Newsgroups: borland.public.cppbuilder.database.ado
References: <3e5a01b5$1@newsgroups.borland.com> <3e5a2a63@newsgroups.borland.com>
Subject: Re: Oracle. How to get negative numbers ?
Date: Mon, 24 Feb 2003 16:03:17 +0100
Lines: 43
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
X-Comment-To: Arnie Mauer
FL-Build: Fidolook Express 2001 UIExt. BuildID: 3BC00FAD (7/10/2001 10:17:49).
NNTP-Posting-Host: 195.143.24.227
Message-ID: <3e5a34d0@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1046099152 195.143.24.227 (24 Feb 2003 07:05:52 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail