🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.vdbase.data.sql
Article #504

Size of Float in Sql Server

#504
From: Honeywood Systems
Date: Thu, 03 Sep 1998 00:00
24 lines
1877 bytes
Please excuse me as I know this isn't really a Delphi Problem, but I
can't find a general BDE newsgroup to post this in.

I am using Borland C/C++ 4.53 with 16 Bit BDE connected via 16Bit ODBC
Drivers to a SQL Server 6.5 Database.

I have a table that has a numeric field in it.  I am using the IDAPI
funtion DbiGetfield to return the value from a record into a character
buffer.  Before calling this function I am allocating the amount of
space that I require the buffer to be based on the Field Properties.  

The iFieldLen variable of this structure determines that I require 4
Bytes of memory to read the Numeric Field.  However when I call the
DbiGetField Function it returns 8 Bytes and overruns the amount of
space I have allocated.  Result --- Two weeks trying to find a bug in
another piece of code that was being overrun, very annoying.

Checking the other Field Properties they are all correct i.e.
Fieldname(LASTNO) and Field Type (fldFLOAT) ...  So why this mismatch?
Obviously I can code a work around to correctly determine the length
of the variable, but I'm worried where else I may be incorrectly
allocating the wrong amount of memory.

So what is the proper way to determine the Field Length?
Technical Details
Message-ID: <35fb6f49.63551285@news.demon.co.uk>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: ff5a1,190ad9e15b3fa93a,start
X-Google-Attributes: gidff5a1,public
From: support@honeywood.demon.co.uk (Honeywood Systems)
Subject: Size of Float in Sql Server
Date: 1998/09/03
Message-ID: <35fb6f49.63551285@news.demon.co.uk>
X-Deja-AN: 387437214
Content-Transfer-Encoding: 7bit
X-NNTP-Posting-Host: honeywood.demon.co.uk:158.152.24.119
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: abuse@demon.net
X-Trace: news.demon.co.uk 904818387 nnrp-01:5783 NO-IDENT honeywood.demon.co.uk:158.152.24.119
MIME-Version: 1.0
Newsgroups: borland.public.vdbase.data.sql