Re: [Cppcms-users] Cppdb: Bound double constant becomes string of integer
Brought to you by:
artyom-beilis
|
From: Artyom B. <art...@ya...> - 2014-03-13 07:40:11
|
Ok.... I see, interesting problem... 1st I'll look into formatting code - try to make sure that there is always a decimal point or "E". Can you please open a ticket please? 2nd I think you can use stuff like "SELECT amount/?::REAL ..." or "SELECT amount CAST( ? as DOUBLE PRECISION) ... " to eliminate such a problem for now. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ -------------------------------------------- On Thu, 3/13/14, CN <cn...@fa...> wrote: Subject: [Cppcms-users] Cppdb: Bound double constant becomes string of integer To: cpp...@li... Date: Thursday, March 13, 2014, 8:55 AM The following double constant 1000000. passed to PostgreSQL: const double E6=1000000.f; cppdb::result r=db_session << "SELECT amount/? FROM mytable" << E6; reaches PostgreSQL as string "1000000": Parameter:$1 = '1000000' As a result, when amount is small, the selected result always becomes 0 rather than decimal like 0.01. Is there any way I can force the parameter to be sent to back end as float or long double? Regards, CN -- http://www.fastmail.fm - One of many happy users: http://www.fastmail.fm/help/overview_quotes.html ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/13534_NeoTech _______________________________________________ Cppcms-users mailing list Cpp...@li... https://lists.sourceforge.net/lists/listinfo/cppcms-users |