Added sample code for data entry into database

This commit is contained in:
Shaquille Soekhlal 2019-05-21 21:58:46 -03:00
parent c90064c2ae
commit 270c358698
2 changed files with 13 additions and 13 deletions

View File

@ -11,15 +11,6 @@ struct employee{
double salary;
};
auto employees = make_storage("sqlite.db3",
make_table("Employees",
make_column("id", &employee::id, autoincrement(), primary_key()),
make_column("first_name", &employee::first_name),
make_column("last_name", &employee::last_name),
make_column("salary", &employee::salary)
)
);
// class item{
// public:
@ -27,8 +18,17 @@ auto employees = make_storage("sqlite.db3",
// };
int main(){
employees.sync_schema();
//std::cout << sqlitedb;
system("PAUSE");
return 0;
auto employees = make_storage("sqlite.db3",
make_table("Employees",
make_column("id", &employee::id, autoincrement(), primary_key()),
make_column("first_name", &employee::first_name),
make_column("last_name", &employee::last_name),
make_column("salary", &employee::salary)
)
);
employees.sync_schema();
employees.remove_all<employee>();
employees.replace(employee{0,"Sagar","Ramsaransingh",120000});
system("PAUSE");
return 0;
}

BIN
sqlite.db3 Normal file

Binary file not shown.