From 9e8946eb61f5edd064464d419b974dbf27dc5d76 Mon Sep 17 00:00:00 2001 From: "Rajdeep Mehra (mehrar)" Date: Fri, 15 Oct 2021 22:56:40 +0100 Subject: [PATCH] Create select_db.h --- select_db.h | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 select_db.h diff --git a/select_db.h b/select_db.h new file mode 100644 index 0000000..258e6cd --- /dev/null +++ b/select_db.h @@ -0,0 +1,56 @@ +#ifndef SELECT_DB_H +#define SELECT_DB_H +#include +#include +#include +#include "libsqlite.hpp" +#include "insert_db.h" +using namespace std; + +class select_db +{ +protected: + string modules; + string classes; + int students, studentID; + string lecturers, rooms; + string name, surname, username, email, password, retry, log1, pass1; + int Timing; + int Term; +public: + select_db(){ + try + { + sqlite::sqlite db("School.db"); + + auto cur = db.get_statement(); + cur->set_sql("SELECT username,password FROM STUDENTDETAILS WHERE username=? AND password=?;"); + cur->prepare(); + cur->bind( 1, username ); + cur->bind( 2, password ); + + string sqlusername; + string sqlpassword; + + while (cur->step()){ + sqlusername=cur->get_str(0); + sqlpassword=cur->get_str(1); + + } + + } + if sqlusername == null or sqlpassword==null: + return "invalid" + return sqlusername,sqlpassword; + } + catch( sqlite::exception e ) + { + cerr << e.what() << endl; + } + + return true; + } + } +}; + +#endif