|
//header
|
|
|
|
#include <Wt/WApplication>
|
|
#include <Wt/WEnvironment>
|
|
#include <Wt/WDateTime>
|
|
#include <Wt/WApplication>
|
|
#include <Wt/WContainerWidget>
|
|
#include <Wt/WComboBox>
|
|
#include <Wt/WTextArea>
|
|
#include <Wt/Ext/TableView>
|
|
#include <Wt/Ext/Button>
|
|
#include <Wt/Ext/Dialog>
|
|
#include <Wt/Ext/LineEdit>
|
|
#include <Wt/Ext/ComboBox>
|
|
#include <Wt/Ext/MessageBox>
|
|
#include <Wt/Ext/NumberField>
|
|
#include <Wt/Ext/ToolBar>
|
|
#include <Wt/WIntValidator>
|
|
#include <Wt/WCssDecorationStyle>
|
|
#include <Wt/Dbo/QueryModel>
|
|
#include <Wt/WStandardItemModel>
|
|
#include <Wt/WBatchEditProxyModel>
|
|
#include <Wt/WStandardItem>
|
|
#include <Wt/WTable>
|
|
#include <Wt/WLabel>
|
|
#include <Wt/WCheckBox>
|
|
#include <Wt/WGroupBox>
|
|
#include <Wt/WSelectionBox>
|
|
#include <Wt/WVBoxLayout>
|
|
#include <Wt/WHBoxLayout>
|
|
#include <Wt/WText>
|
|
#include <Wt/Dbo/collection>
|
|
#include <Wt/WRegExpValidator>
|
|
#include <Wt/WPopupMenu>
|
|
#include <Wt/WPoint>
|
|
#include <Wt/WTableView>
|
|
#include <Wt/WDate>
|
|
#include <Wt/WScrollArea>
|
|
#include <Wt/WLineEdit>
|
|
#include <Wt/Dbo/Dbo>
|
|
#include <Wt/Dbo/Session>
|
|
#include <Wt/Dbo/backend/Postgres>
|
|
#include <Wt/Dbo/SqlConnectionPool>
|
|
#include <Wt/Dbo/FixedSqlConnectionPool>
|
|
#include <Wt/Dbo/WtSqlTraits>
|
|
#include <Wt/Dbo/Transaction>
|
|
|
|
using namespace Wt;
|
|
|
|
class rootw: public WContainerWidget {
|
|
public:
|
|
rootw(Wt::Dbo::SqlConnectionPool *pool, WContainerWidget *parent = 0);
|
|
~rootw();
|
|
private:
|
|
Wt::Dbo::Session session;
|
|
void submit();
|
|
WLineEdit *e_name,*e_pass,*e_date;
|
|
Ext::Button *btn;
|
|
WText *t_status;
|
|
};
|
|
|
|
class db_test {
|
|
public:
|
|
//int id;
|
|
std::string name,password;
|
|
boost::optional<std::string> create_date;
|
|
template<class Action>
|
|
void persist(Action& a)
|
|
{
|
|
Dbo::field(a,name,"username");
|
|
Dbo::field(a,password,"password");
|
|
Dbo::field(a,create_date,"domain_id");
|
|
}
|
|
};
|
|
namespace Wt {
|
|
namespace Dbo {
|
|
template<>
|
|
struct dbo_traits<db_test> : public dbo_default_traits {
|
|
static const char *surrogateIdField() { return "id"; }
|
|
static const char *versionField() { return 0; }
|
|
};
|
|
}
|
|
}
|