[odb-users] sqlite string type std::array

MM finjulhich at gmail.com
Wed Aug 19 08:46:37 EDT 2015


hi,

typedef std::array<char,5> month_year_str_t;
struct month_and_year
{ ...
  operator month_year_str_t() const;
  void set(month_year_str_t);
};

struct myobj
{
    ...
   month_and_year my;
};


I would like to map the month_and_year type to a TEXT column in sqlite, and
use the provided conversion operator to do that.
What's the simplest way?

#pragma db value(month_year_str_t) type("TEXT")

#pragma db object(myobj) definition
#pragma db member(myobj::my) transient
#pragma db member(myobj::monthyear) virtual(month_year_str_t) \
  get( static_cast<month_year_str_t>(this.my) ) \
  set( set ((?)))


Rds,
MM


More information about the odb-users mailing list