Skip to Content.
Sympa Menu

freetds - Re: Packaging FreeTDS for Debian

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Brian Bruns <camber AT umcc.ais.org>
  • To: TDS Development Group <freetds AT franklin.oit.unc.edu>
  • Subject: Re: Packaging FreeTDS for Debian
  • Date: Wed, 22 Dec 1999 22:03:47 -0500 (EST)


Ok, looked at ctlib and it was a simple freetds bug. The CVS version
should show the correct behaviour. Incidentally it was not chopping the
the decimal portion off but was truncating to 3 character (the size
returned from the money4 -> char convert was returning the size of money4
(4) and not the resulting string)

Let me know how it works.

Brian

On Wed, 22 Dec 1999, Brian Bruns wrote:

> Ok, I'm looking at the dblib configured PHP3 (3.0.12) right now and it
> appears to be relying on some pretty undefined behaviour which is roughly
> this:
>
> 1) get the size of the field with dbdatlen()
> 2) add 20 to it just to be sure
> 3) allocate a buffer of this size (24 in the case of smallmoney)
> 4) call dbconvert from SYBMONEY4 to SYBCHAR with the source size set to 24
> and the destination size set to -1 (no length checking)
> Here is the problem, the sybase docs state that a null terminated string
> will be returned and no bounds checking will happen. PHP expects the
> string to be blank padded and then counts from 24 down while there is a
> blank reduces its length (result->value.str.len) to that. So, in the case
> of MONEY4 the string length should be the length of the string but is
> really 24.
>
> Anyway, I made a quick hack, which goes like this if destlen is -1 use the
> source length to pad out the destination with blanks. ugly, but it seems
> to work. I'll look at ctlib later tonight, the same hack may or may not
> work for --with-sybase-ct configured PHPs.
>
> Brian
>
> On Wed, 22 Dec 1999, Christian Oyarzun wrote:
>
> > I tried it with the latest php4 CVS and the bug is still there. I am not
> > getting any cents
> > at all ie ( 19.95 is 19. and 0.00 is 0.0 )
> >
> > --CO
> >
> > > Hmmm...I found a problem, but possibly not the one your seeing. PHP
> > > seems
> > > to convert everything to a string and the first smallmoney value coming
> > > back is not getting null terminated. What kind of values are you getting
> > > back for the cents?
> > >
> > > Brian
> > >
> > > On Tue, 21 Dec 1999, Christian Oyarzun wrote:
> > >
> > > >
> > > > > On Tue, 21 Dec 1999, Christian Oyarzun wrote:
> > > > >
> > > > > > I just put my src rpms at
> > > > > > http://staff.wilmington.net/oyarzun/rpms I
> > > > used a
> > > > > > mandrake 6.1 machine, but the should work fine on RH 6.1. I've
> > > > > > used
> > the
> > > > > > freetds support to connect to a MSSQL 7
> > > > > > server to do simple queries. It works fine except for small money
> > give
> > > > the
> > > > > > dollar amount correct,
> > > > > > but not the cents. I would guess it has something to do with the
> > > > > > php
> > > > code
> > > > > Hmmm... I'll look into this. are you using --with-sybase or
> > > > > --with-sybase-ct?
> > > > >
> > > > I've tried both with the same results, but currently ct. I'll get the
> > latest
> > > > php CVS and give
> > > > that a try. (The problem exists in both php4 and php3).
> > > >
> > > > --CO
> > > >
> > > >
> > > > ---
> > > > You are currently subscribed to freetds as: camber AT ais.org
> > > > To unsubscribe, forward this message to
> > $subst('Email.Unsub')
> > > >
> > > >
> > >
> > >
> > > ---
> > > You are currently subscribed to freetds as: co AT wilmington.net
> > > To unsubscribe, forward this message to
> > $subst('Email.Unsub')
> > >
> >
> >
> > ---
> > You are currently subscribed to freetds as: camber AT ais.org
> > To unsubscribe, forward this message to $subst('Email.Unsub')
> >
> >
>
>
> ---
> You are currently subscribed to freetds as: camber AT ais.org
> To unsubscribe, forward this message to $subst('Email.Unsub')
>
>





Archive powered by MHonArc 2.6.24.

Top of Page