[odb-users] Storing NaN in the datadbase
Alexander A. Prokhorov
prokher at gmail.com
Wed Jul 18 08:57:55 EDT 2012
Thank you, Boris - I'll try.
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