Re[4]: Fwd: [odb-users] odb compilation Visual Studio 2008 error
Александр Кожевников
bioshocker at mail.ru
Sat May 11 12:46:54 EDT 2013
>Hi,
>
>Please don't send multiple copies of the same question to the mailing
>list. It won't make us reply faster. If any, it will have the exact
>opposite effect.
>
>
>Александр Кожевников < bioshocker at mail.ru > writes:
>
>> #pragma db type("DATETIME")
>> tm time_;
>
>ODB doesn't provide a default mapping for struct tm. Generally, ODB
>cannot "auto-magically" map any C++ type to any database type. The
>only mappings that you can use are those that are documented in the
>manual or those that you provided yourself. Also note that SQLite
>doesn't have the DATETIME type.
>
>So, in this case your options are (in the order of increasing
>difficulty):
>
>1. Instead of struct tm, use a date-time type that is supported by
> ODB. For example, boost::posix_time::ptime from the Boost date-
> time library.
>
>2. Provide your own implementation of struct tm to an SQLite type
> mapping. See this guide for details:
>
> http://www.codesynthesis.com/~boris/blog/2012/10/16/custom-cxx-to-database-type-mapping-in-odb/
>
>
>> #pragma db type("NVARCHAR(36)")
>> boost::uuids::uuid deviceId_;
>
>The same problem here. ODB only supports mapping of Boost uuid to SQLite
>BLOB. Also, SQLite doesn't have the NVARCHAR type. So your options here
>are:
>
>1. Use the default mapping for uuid.
>
>2. Use a string instead of uuid if you want a text representation.
>
>3. Provide your own mapping of uuid to TEXT.
>
>Boris
Thanks, it was helpful, but i get new error at Pre-Build event:
C:\SDK\libodb-sqlite-2.2.1/odb/sqlite/details/config.hxx:12:4: error: #error libodb-sqlite header included in odb-compiled header
More information about the odb-users
mailing list