Hey Oto, Op 27 april 2012 11:31 heeft Oto Magaldadze <omagalda...@yahoo.com> het volgende geschreven: > oh maan so i need to create a separate class to each of the tables i need to > connect to ?? :((
Yes. There is actually an alternative more Qt-like model floating around somewhere too, which sparked some discussion on the mailing list. I'm not sure what the state is of the project, and what databases were supported. Regards, koen > ________________________________ > From: Nagaev Boris <bnag...@gmail.com> > To: Oto Magaldadze <omagalda...@yahoo.com>; > witty-interest@lists.sourceforge.net > Sent: Friday, April 27, 2012 12:50 PM > Subject: Re: [Wt-interest] link WTableView to sql table > > Hello! > > In QueryModel, Result may be dbo::ptr<YourClass> (or boost::tuple of > such dbo::ptr's if you use SQL JOIN). > > To tell QueryModel, which fields to use, call addColumn method for > each field, or use addAllFieldsAsColumns() to add all fields as > columns. > > Then setQuery(session.find<YourClass>()) to ad all records from > database table to this model/view. > > Here YourClass is a C++ class, representing a record, for example: > > class User { > public: > std::string name; > std::string password; > > template<class Action> > void persist(Action& a) > { > dbo::field(a, name, "name"); > dbo::field(a, password, "password"); > } > }; > > On Fri, Apr 27, 2012 at 10:25, Oto Magaldadze <omagalda...@yahoo.com> wrote: >> In Qt if i want to display sql table content in view i can do this: >> QSqlTableModel model; >> model.setTable("Table1"); >> model.select(); >> >> QTableView view; >> view.setModel(&model); >> >> And how do I do that in Wt, 'cause I am stuck with Wt::Dbo::QueryModel< >> Result > and Wt::Dbo::Query< Result, BindStrategy >, really can't get why >> is >> there <Result> stuff, what is it needed for, isn't there a way to >> .setTable(std:str tablename)? >> >> >> Oto >> >> >> >> ------------------------------------------------------------------------------ >> Live Security Virtual Conference >> Exclusive live event will cover all the ways today's security and >> threat landscape has changed and how IT managers can respond. Discussions >> will include endpoint security, mobile security and the latest in malware >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >> _______________________________________________ >> witty-interest mailing list >> witty-interest@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/witty-interest >> > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > witty-interest mailing list > witty-interest@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/witty-interest > ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ witty-interest mailing list witty-interest@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/witty-interest