[odb-users] Storing NaN in the datadbase

Alexander A. Prokhorov prokher at gmail.com
Sun Jul 22 15:48:55 EDT 2012


Hi Boris,

as I already said in Linux it works like a charm. But in Windows I've 
got in trouble:

28>Scalar-odb.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static void __cdecl odb::sqlite::real_value_traits<double>::set_image(double &,bool &,double)" (__imp_?set_image@?$real_value_traits at N@sqlite at odb@@SAXAANAA_NN at Z) referenced in function "public: static bool __cdecl odb::access::object_traits<class da::pse::journaling::ScalarDouble>::init(struct odb::access::object_traits<class da::pse::journaling::ScalarDouble>::image_type &,class da::pse::journaling::ScalarDouble const &,enum odb::sqlite::statement_kind)" (?init@?$object_traits at VScalarDouble@journaling at pse@da@@@access at odb@@SA_NAAUimage_type at 123@ABVScalarDouble at journaling@pse at da@@W4statement_kind at sqlite@3@@Z)


28>Scalar-odb.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static void __cdecl odb::sqlite::real_value_traits<double>::set_value(double &,double,bool)" (__imp_?set_value@?$real_value_traits at N@sqlite at odb@@SAXAANN_N at Z) referenced in function "public: static void __cdecl odb::access::object_traits<class da::pse::journaling::ScalarDouble>::init(class da::pse::journaling::ScalarDouble &,struct odb::access::object_traits<class da::pse::journaling::ScalarDouble>::image_type const &,class odb::database &)" (?init@?$object_traits at VScalarDouble@journaling at pse@da@@@access at odb@@SAXAAVScalarDouble at journaling@pse at da@@ABUimage_type at 123@AAVdatabase at 3@@Z)


can you suggest something?


On 18.07.2012 14:13, Boris Kolpackov wrote:
> Hi Alexander,
>
> Alexander A. Prokhorov <prokher at gmail.com> writes:
>
>> class Value : public DbObject {
>>    friend class odb::access;
>>    double _value;
>> };
>>
>> Everything is fine until Value::_value becomes NaN, when calling persist
>> for such objects I got the following error: 'object already persistent'
>> is it possible to store NaN's in database with odb?
> Hm, according to this thread[1], SQLite converts NaNs to NULLs for some,
> perhaps misguided, reason. To be consistent, I updated libodb-sqlite to
> convert NULLs back to NaNs for consistency. So to make NaNs work you will
> need to do two things:
>
> 1. Apply this patch to libodb-sqlite:
>
> http://scm.codesynthesis.com/?p=odb/libodb-sqlite.git;a=commit;h=3fabd5107e81d1f75a259ba1d1fa1911c166ebac
>
> 2. Enable NULLs for the members that store NaNs:
>
> class Value : public DbObject {
>
>    #pragma db null
>    double _value;
> };
>
> [1] http://comments.gmane.org/gmane.comp.db.sqlite.general/73139
>
> Boris



More information about the odb-users mailing list