Skip to Content.
Sympa Menu

freetds - RE: Datatype Real Problems with MSSQL 6.5

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Mark Schaal <mark AT champ.tstonramp.com>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: RE: Datatype Real Problems with MSSQL 6.5
  • Date: Fri, 3 Nov 2000 14:43:15 -0800 (PST)


>
> Confirming what you've noticed - I've had the same problem in SQL7.0 as
> well. Just changed my db to floats - not the right solution but it worked.
>
> > -----Original Message-----
> > From: John W [SMTP:jdw AT omegafi.com]
> > Sent: Monday,October 30,2000 1:35 PM
> > To: TDS Development Group
> > Subject: [freetds] Datatype Real Problems with MSSQL 6.5
> >
> > I am using mssql 6.5 sp5 and have a datatype defined as real. When I
> > access this field from php it always returns 0. If however I change the
> > field type to type float, it returns the value correctly. I believe the
> > problem may lie in the tds conversion library but I am not positive. Any
> > help in solving this would be appreciated
> >

I can confirm that the real->char and float->char conversions
are unsophisticated and thus buggy under many circumstances, and
this _may_ be the source of your problem. I'm thinking it will
give space padded output for...hmmm...all numbers under 1e+06 and
zero for all numbers under 1e-06. I'll need to chew on this a
while to decide how complete a fix I want to do.

However, I'm a bit concerned that using floats fixes the problem
because that conversion routine is identical. I'm also concerned that
dbconvert() doesn't deal with destlen = -1 which is what PHP uses.
That strikes me as a screwy option. I'd give it a symbolic constant
DB_SEGFAULT_WAITING_TO_HAPPEN :-), but there must've been a reason
for doing it that way...

Plus frankly I'm confused why php_mssql_get_field_name() doesn't
have a SQLREAL and has SQLNUMERIC separate from SQLDECIMAL, but I
doubt that is causing your problem plus I have no desire to muck
with the PHP source.

Hopefully I should have a fix for the tds_convert stuff by Monday.

Mark
--
Mark J. Schaal Phone: (909) 620-7724
TST On Ramp Fax: (909) 620-8174
System Administrator E-Mail: mark AT tstonramp.com




Archive powered by MHonArc 2.6.24.

Top of Page