Added sample code for data entry into database
This commit is contained in:
parent
c90064c2ae
commit
270c358698
18
main.cpp
18
main.cpp
@ -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
BIN
sqlite.db3
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user