List:Internals« Previous MessageNext Message »
From:Sinisa Milivojevic Date:November 30 2001 12:12pm
Subject:Re: Format of doubles in queries(feature request)
View as plain text  
On Thu, 29 Nov 2001 16:05:25 -0200
Roland <roland@stripped> wrote:

> Hello,
> SKIP TO THE END IF YOU JUST WANT TO READ THE FEATURE REQUEST.
> 
> As a Java programmer, I often access a MySQL database trough a driver, and 
> notice a little problem:
> The MySQL format for DOUBLEs with exponent is like  3.41E+7
> The '+' is required for positive exponents. If you wrote that same number 
> as 3.41E7 it would generate a
> syntax error.
> The problem arises, when you convert a java double to string, the plus sign 
> is omitted for positive exponents.
> That means that java would output the above number as 3.41E7. When I pass 
> this number on to a MySQL query I
> get a syntax error. To avoid it I have two options:
> 1. (Easy) Enclose the double with single quotes. Works fine!
> select * from  table where number='3.41E7';  instead of
> select * from  table where number=3.41E7;
> 2. (Hard)  Change the format of the number to make Java convert it to 3.41E+7.
> 
> To make it all simpler why not:
> 
> FEATURE REQUEST:
> Allow an alternate syntax for double types. When the exponent is positive 
> the plus sign may be omitted. That means
> 3.41E+7 == 3.41E7.
> Would that be too hard to implement? I don't think so. But it would save 
> other programmers a lot of work. The way it is now,
> each application programmer has to program his own conversion, or use the 
> single-quotes trick.
> 
> Thanks for your attention,
> Roland
> 

Hi!

I just tried it in our 4.0 tree and it worked just like the way you want it to.

3.4E7 = 3.4E+7


--

Regards,

--
For technical support contracts, go to https://order.mysql.com/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Mr. Sinisa Milivojevic <sinisa@stripped>
 / /|_/ / // /\ \/ /_/ / /__   MySQL AB, FullTime Developer
/_/  /_/\_, /___/\___\_\___/   Larnaca, Cyprus
       <___/   www.mysql.com
Thread
Format of doubles in queries(feature request)Roland29 Nov
  • Re: Format of doubles in queries(feature request)Sinisa Milivojevic30 Nov
  • Format of doubles in queries(feature request)Michael Widenius30 Nov
  • Re: Format of doubles in queries(feature request)Roland30 Nov