On Wed, Dec 30, 2009 at 12:20 AM, OvermindDL1 <[email protected]> wrote:
> I have a few classes, one is:
> class Group {
> public:
>        std::string displayName;
>        std::string description;
>
>        Permissions permissions;
>        Users       users;
>
>        template<class Action>
>        void persist(Action& a)
>        {
>                dbo::field(a,   displayName, "displayName");
>                dbo::field(a,   description, "description");
>
>                dbo::hasMany(a, permissions, dbo::ManyToMany, 
> "Group_Permission_Link");
>                dbo::hasMany(a, users,       dbo::ManyToMany, 
> "Group_User_Link");
>        }
> };
>
> And I run createTables(), but an exception gets thrown of a message:
> near "Group": syntax error
>
> The SQL that Wt::Dbo is passing to sqlite is:
> create table Group(
>  id integer primary key autoincrement,
>  version integer not null,
>  displayName text not null,
>  description text not null
> )
>
> I am not sure what the problem is.  The Blog seems to work fine...

Boy do I feel dim... found the problem.  Apparently Wt::Dbo does not
quote identifiers when they need to be quoted, and well, the table
name 'should' be quoted (but is not always required depending on what
the name is, and well, the string Group is also a keyword, thus it is
one of those that *has* to be quoted), and since they are not quoted
(nor are other identifiers I notice, they should be...), it just
chokes and dies.

Changing:
  mapClass<Group>("Group");
Into:
  mapClass<Group>("\"Group\"");
Fixed that problem, but I should not need to do that, Wt::Dbo should
automatically have "'s around *all* identifiers unless it actually
checks them to see if they need them or not, but it should never just
'not' have them.

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to