From 270c358698afacbc896728357505fe9079ba7214 Mon Sep 17 00:00:00 2001 From: Shaquille Soekhlal Date: Tue, 21 May 2019 21:58:46 -0300 Subject: [PATCH] Added sample code for data entry into database --- main.cpp | 26 +++++++++++++------------- sqlite.db3 | Bin 0 -> 12288 bytes 2 files changed, 13 insertions(+), 13 deletions(-) create mode 100644 sqlite.db3 diff --git a/main.cpp b/main.cpp index aae0203..c640a0f 100644 --- a/main.cpp +++ b/main.cpp @@ -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(); + employees.replace(employee{0,"Sagar","Ramsaransingh",120000}); + system("PAUSE"); + return 0; } \ No newline at end of file diff --git a/sqlite.db3 b/sqlite.db3 new file mode 100644 index 0000000000000000000000000000000000000000..9431acb5e8ee3b9501cf077cf64713858a7c0eb1 GIT binary patch literal 12288 zcmeI&zfQtH90%|_>c2t7jl`wD?H~{rXA`Qqn8s4Dltdr2nav`0uX=z1Rwwb2tWV=5P-nH3v^05m3p1`b9Ea9*(B0e z-$52ko`U3Vy=h!{(()zw*102TZEiJDanR5!YtLtVw_=+7#h&jeaNB*J?^w(HAF=~2hCTb9?SE7>Qj=eKQFuWU)zC%3Ir&vB?hVi=}bJ}6!<$d@;( zgOU1uEK`w6r-JmUoSz+Q#oe5jKbU?H5P$##AOHafKmY;|fB*y_009VWu)s0fW))#{ z)kvkDiZhj}Bny+#1Al+}zW>iydA7j^#HT|50uX=z1Rwwb2tWV=5P$##Ah0H|&kb{L H`5VF)Zmn-b literal 0 HcmV?d00001