Added sample code for data entry into database
This commit is contained in:
parent
c90064c2ae
commit
270c358698
26
main.cpp
26
main.cpp
@ -11,15 +11,6 @@ struct employee{
|
|||||||
double salary;
|
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{
|
// class item{
|
||||||
// public:
|
// public:
|
||||||
|
|
||||||
@ -27,8 +18,17 @@ auto employees = make_storage("sqlite.db3",
|
|||||||
// };
|
// };
|
||||||
|
|
||||||
int main(){
|
int main(){
|
||||||
employees.sync_schema();
|
auto employees = make_storage("sqlite.db3",
|
||||||
//std::cout << sqlitedb;
|
make_table("Employees",
|
||||||
system("PAUSE");
|
make_column("id", &employee::id, autoincrement(), primary_key()),
|
||||||
return 0;
|
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
BIN
sqlite.db3
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user