[odb-users] ask a question

Boris Kolpackov boris at codesynthesis.com
Wed Sep 11 06:04:55 EDT 2013


Hi,

wanghuisoftware at 126.com writes:

> i want to know how to create an odb view based on database view.

When it comes to ODB views, there is no difference between database
tables and database views since they can be queried in exactly the
same way. So to create an ODB view based on a database view you will
use the table syntax:

#pragma db view table("my_view")
struct my_view
{
  #pragma db column("col1") type("INTEGER")
  unsigned long val1;

  #pragma db column("col2") type("TEXT")
  std::string val2;
};

For more information, see Section 9.2, "Table Views". It is also
possible to create a native ODB view based a database view  (Section
9.5, "Native Views").

Boris



More information about the odb-users mailing list