Menu

#114 Cppdb: Bound double constant becomes string of integer

cppcms-1.2
open
nobody
cppdb (9)
5
2014-10-30
2014-03-13
CN Liou
No

Double constant 1000000. passed to PostgreSQL reaches PostgreSQL as string '1000000':

const double E6=1000000.f;
cppdb::result r=db_session << "SELECT amount/? FROM mytable" << E6;

PostgreSQL log:

Parameter:$1 = '1000000'

As a result, when amount is small, the selected result always becomes 0 rather than decimal like 0.01.

Discussion

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.