List:General Discussion« Previous MessageNext Message »
From:Jay Pipes Date:May 26 2006 1:57pm
Subject:Re: fetch floats/doubles in native binary representation
View as plain text  
Andras Pal wrote:
> Hi,
>   I've a large table with lots of floats (or doubles) that i want to query
> using C API. By default, in C, the rows are returned as a type of char **,
> therefore floating numbers are returned as ascii strings. Is it possible
> to fetch somehow directly these numbers in their original binary
> representation? I know it is architecture-dependent, but if we use
> localhost, it won't cause any problem if the result is casted directy to
> (float) and/or (double). For our problem, it would be much more efficent
> to do the queries this way than the server converts the number to ascii,
> the client converts the number againt to binary (on the same machine), and
> we do what we want to do after it (which is a simple multiplication, not
> as time consuming as two conversions...).

Hi Andras!

Why not have the MySQL server do the computation, if it is a simple 
multiplication?  Can you post the code you are using so we might suggest 
an alternative solution?

Cheers,

-- 
Jay Pipes
Community Relations Manager, North America, MySQL Inc.
Roaming North America, based in Columbus, Ohio
email: jay@stripped	mob: +1 614 406 1267

Are You MySQL Certified? http://www.mysql.com/certification
Got Cluster? http://www.mysql.com/cluster
Thread
fetch floats/doubles in native binary representationAndras Pal26 May
  • Re: fetch floats/doubles in native binary representationJay Pipes26 May