-
I'm using oracle ODBC. The exception "bad cast" is happened in "get" function in "from_base", "p.id= v.get("ID")". SOCI software think it should be type "double" from database, but actually I created table with field "id" as integer, not double. How to solve this problem? I need your help. My case is below: // create table namespace soci
}; person p1; |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
With While it is true that you're creating the column |
Beta Was this translation helpful? Give feedback.
With
type_conversion
s, you're using SOCI's dynamic API. This API forces you to use the exact C++ data types that SOCI maps the database types to (see https://soci.sourceforge.net/doc/release/4.0/backends/odbc/#dynamic-binding).While it is true that you're creating the column
id
as typeinteger
, you have to keep in mind that you also created aprimary key
constraint on that column. Some databases treat such columns as something along the lines ofnumeric(38,0)
internally, which of course would get mapped fromSQL_NUMERIC
todouble
by SOCI. I don't know how Oracle handles primary keys, but based on your description I would assume that this is exactly the issue here. Retrieving the column as…