[odb-users] ask a question
wanghuisoftware at 126.com
Wed Sep 11 07:22:54 EDT 2013
if i use "#pragma db view(SPSDAO::SpsIndividual) table("v_Individuals") readonly"
it generate error " 错误: 关系 "v_Individuals" 不存在"，but it actually existed.
At 2013-09-11 18:04:55,"Boris Kolpackov" <boris at codesynthesis.com> wrote:
>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")
> #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").
More information about the odb-users