Hey Matthew, Best wishes for 2012 !
2011/12/29 Matthew Sherborne <msherbo...@gmail.com>: > Thanks Koen for that last answer on making my WFormWidget descendant. I > think I might give that a go and give you a github pull request once I get > the first version of this blog app I'm writing out the door. I've given it some more thought an we really should make it possible to use other widgets as WFormWidget. In this way, we could make WDatePicker for example also a form widget. > I've switched to using your auth lib, rather than my own wittyPlus version. That's nice to hear! As I said before, any suggestions and criticisms on the auth lib are welcome (and likely justified!). > With dbo is there a way to specify a unique secondary key ? > > I have a 'blog post' and I like having the standard 'id' field being an int, > but I want to add an index with a not null constraint on the 'name' field. > At the moment, I'm just doing it by executing SQL straight out. Something > like: create unique index blog_post_name on blog_post (name); Currently, no, Wt::Dbo does not support this. But it seems to be a similar thing as the 'cascade delete' options that we do support already for foreign keys, so I think this is a valid feature request. > With dbo, what decides if a field is NOT NULL ? The capability of the C++ type to store a 'null' value. > This code: > > template <class Action> > > void persist(Action& a) { > > namespace dbo = Wt::Dbo; > > dbo::id(a, _name, "name"); > > dbo::field(a, _title, "title"); > > dbo::field(a, dateTime, "dateTime"); > > dbo::field(a, body, "body"); > > dbo::hasMany(a, tags, Wt::Dbo::ManyToMany, "post_tag"); > > } > > > generates this table in PostgreSQL: > > Column | Type | Modifiers > > ----------+-----------------------------+-------------------------------------------------------- > id | integer | not null default > nextval('blog_post_id_seq'::regclass) > version | integer | not null > name | text | not null > title | text | not null > dateTime | timestamp without time zone | > body | text | not null > Indexes: > "blog_post_pkey" PRIMARY KEY, btree (id) > "blog_post_name" UNIQUE, btree (name) > Referenced by: > TABLE "post_tag" CONSTRAINT "fk_post_tag_key2" FOREIGN KEY > (blog_post_id) REFERENCES blog_post(id) > > I don't see how name and title get a NOT NULL constraint .. but dateTime Because a string does not have a 'null' value (that is different from an empty string), while WDateTime (and also the boost datetime) have a 'null' value. > doesn't .. (I'd like it to have one too). That's a problem now too (you could also do it with a custom SQL command to add the null constraint as you do for the index). Perhaps this should be something you can specify in a similar way as the index (and be part of the same feature request). Regards, koen ------------------------------------------------------------------------------ Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex infrastructure or vast IT resources to deliver seamless, secure access to virtual desktops. With this all-in-one solution, easily deploy virtual desktops for less than the cost of PCs and save 60% on VDI infrastructure costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox _______________________________________________ witty-interest mailing list witty-interest@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/witty-interest