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,6 +11,13 @@ struct employee{
double salary; double salary;
}; };
// class item{
// public:
// private:
// };
int main(){
auto employees = make_storage("sqlite.db3", auto employees = make_storage("sqlite.db3",
make_table("Employees", make_table("Employees",
make_column("id", &employee::id, autoincrement(), primary_key()), make_column("id", &employee::id, autoincrement(), primary_key()),
@ -19,16 +26,9 @@ auto employees = make_storage("sqlite.db3",
make_column("salary", &employee::salary) make_column("salary", &employee::salary)
) )
); );
// class item{
// public:
// private:
// };
int main(){
employees.sync_schema(); employees.sync_schema();
//std::cout << sqlitedb; employees.remove_all<employee>();
employees.replace(employee{0,"Sagar","Ramsaransingh",120000});
system("PAUSE"); system("PAUSE");
return 0; return 0;
} }

BIN
sqlite.db3 Normal file

Binary file not shown.