[freetds] RE: Datatype Real Problems with MSSQL 6.5 (fwd)
| From: | Rasmus Lerdorf | Date: | Sat, 04 Nov 2000 02:36:56 +0000 |
| Subject: | [freetds] RE: Datatype Real Problems with MSSQL 6.5 (fwd) | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-37087@lists.php.net to get a copy of this message | ||
---------- Forwarded message ----------
Date: Fri, 3 Nov 2000 21:36:24 -0500 (EST)
From: Brian Bruns <camber@ais.org>
Reply-To: TDS Development Group <freetds@franklin.oit.unc.edu>
To: TDS Development Group <freetds@franklin.oit.unc.edu>
Subject: [freetds] RE: Datatype Real Problems with MSSQL 6.5
When I looked at this before, it appeared that PHP was broken. I said
screw it and used sybase-ct and that was under the real OpenClient!
Always meant to get around to fixing that. BTW this breakage occured
between 3.0.5 and 3.0.11 but I'm not sure where because I didn't run any
intermediate versions on that box.
Regarding tds_convert_flt8 and tds_convert_real, obviously we have to cut
it off somewhere. Looks like the built in convert function will return
up to 17 digits and then e+/- if necessary for both real and float types,
so that is probably what we need to shoot for.
Brian
On Fri, 3 Nov 2000, Mark Schaal wrote:
> >
> > 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@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@tstonramp.com
>
---
You are currently subscribed to freetds as: [rasmus@lerdorf.on.ca]
To unsubscribe, forward this message to leave-freetds-12801E@franklin.oit.unc.edu