libpqxx: Converting field to double throws exception
Hi,
i’m trying to get some data from a postgresql table and i’m having trouble with a conversion to double :
for (auto row : r) {
c.date_add = row[2].as<std::string>();
c.latitude = row[3].as<double>(); // throw Could not convert string to numeric value : '45.02564'
}
The database field have “double precision” type.
i 've work my way around the problem by doing :
c.latitude = std::stod(row[3].as<std::string>());
but i’d rather get it working the proper way.
I’m wondering if the locale can be at fault here ? My default locale is french where a decimal number is in theory written with a comma (45,02564).
I’m working with postgres 11 , on windows 10 et Vs 2015
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 29 (19 by maintainers)
Well, glad the problem is solved at least. 😄