Skip to Content.
Sympa Menu

freetds - RE: money wire format

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Thompson, Bill D (London)" <ThompBil AT exchange.uk.ml.com>
  • To: "'TDS Development Group'" <freetds AT franklin.oit.unc.edu>
  • Subject: RE: money wire format
  • Date: Wed, 7 Aug 2002 23:13:11 +0100


Hey James,

Money on the wire is two 4 byte integers, each is INDEPENDENTLY little or
big endian.

I reckon your problem is similar to the one you had with numerics on little
endian machines (remember?)

tds_convert_money assumes that the data makes sense as a 64 byte integer.

On a big endian machine the two 4 byte integers, strung together , can be
treated as a single entity.
On little endian of course they cannot.
As one of the comments in freetds (somewhere) says : "proving the
superiority of big-endian architecture"

so I guess for tds_convert_money to work on little endian we have to really
mess around with the bytes:

Assuming we dont change tds_process_row, and the money value comes down
unchanged the bytes would have to be moved as follows ( I reckon, and it IS
late here )

Wire:

1 2 3 4 5 6 7 8

To:

5 6 7 8 1 2 3 4

does that make sense ?

Bill


> -----Original Message-----
> From: Lowden, James K [SMTP:LowdenJK AT bernstein.com]
> Sent: Wednesday, August 07, 2002 6:54 PM
> To: TDS Development Group
> Subject: [freetds] money wire format
>
> Money->char is currently broken on little endians, as I reported the other
> day. Could someone (Bill, Brian?) please provide the wire format for
> money
> data? That would make it easier for me to fix tds_convert_money tonight.
>
>
> Also I recently discovered the function ntohs. I wonder how
> tds_swap_bytes
> is different, and how to know which to use when. I see of course they
> have
> different semantics, but it seems like their purpose is the same.
>
> --jkl
>
>
> The information contained in this transmission may contain privileged and
> confidential information and is intended only for the use of the person(s)
> named above. If you are not the intended recipient, or an employee or
> agent
> responsible for delivering this message to the intended recipient, any
> review, dissemination, distribution or duplication of this communication
> is
> strictly prohibited. If you are not the intended recipient, please contact
> the sender immediately by reply e-mail and destroy all copies of the
> original message. Please note that for certain accounts we do not accept
> orders and/or instructions by e-mail, and for those accounts we will not
> be
> responsible for carrying out such orders and/or instructions. Kindly
> refrain
> from sending orders or instructions by e-mail unless you have confirmed
> that
> we accept such communications for your account. Please also note that to
> satisfy regulatory requirements we review the outgoing and incoming e-mail
> correspondence of staff members serving certain functions.
>
>
>
> ---
> You are currently subscribed to freetds as: [thompbil AT exchange.uk.ml.com]
> To unsubscribe, forward this message to
> $subst('Email.Unsub')





Archive powered by MHonArc 2.6.24.

Top of Page