Skip to content
Permalink
Browse files
Update and rename login and select to create1_db.h
  • Loading branch information
mehrar committed Oct 15, 2021
1 parent d053a78 commit 6f8c9754893feb196a28b65351ce517b06c409bc
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 34 deletions.
@@ -0,0 +1,49 @@
#ifndef CREATE1_DB_H
#define CREATE1_DB_H
#include <iostream>
#include <string>
#include <sqlite3.h>



int callback(void *NotUsed, int len, char **value, char **column){

for(int i = 0; i < len; i++) {
cout << column[i] << ": " << value[i] << endl;

}
return 0;
}

int create1_db() {/* creating a timetable for the student*/
sqlite3 *db;
char *column = 0;
int load;
string sql;
load = sqlite3_open("Timetable.db", &db);

if(load){
cout << "DB Error: " << sqlite3_errmsg(db) << endl;
sqlite3_close(db);
return(1);
}

sql = "DROP TABLE LESSON;";

load = sqlite3_exec(db, sql.c_str(), callback, 0, &column);

sql = "CREATE TABLE LESSON (" \
"studentID INT NOT NULL," \
"modules STR NOT NULL,"\
"classes STR NOT NULL,"\
"students STR NOT NULL,"\
"lecturers STR NOT NULL,"\
"Timing int NOT NULL,"\
"rooms STR NOT NULL);";

load = sqlite3_exec(db, sql.c_str(), callback, 0, &column);
sqlite3_close(db);

return 0;
}
#endif

This file was deleted.

0 comments on commit 6f8c975

Please sign in to comment.