implemented delete

This commit is contained in:
Benjamin Petsch
2017-03-20 01:24:18 +01:00
parent 069b40dc0f
commit a7b8199c2d
17 changed files with 67 additions and 15 deletions

View File

@@ -352,11 +352,32 @@ void updateQuestion(){
}
void deleteCategory(){
EXEC SQL BEGIN DECLARE SECTION;
int id;
EXEC SQL END DECLARE SECTION;
cout << "Welche Kategorie? (ID)" << endl;
selectCategory();
cin >> id;
if(id){
EXEC SQL DELETE FROM gr2.test WHERE "ID" = :id;
if(!strcmp(sqlca.sqlstate, "23503")) cout << "Kategorie kann nicht geloescht werden! (Existieren noch Fragen mit der Kategorie?)" << endl;
else if(!strcmp(sqlca.sqlstate, "02000")) cout << "Kategorie existiert nicht!" << endl;
EXEC SQL COMMIT;
}
}
void deleteQuestion(){
EXEC SQL BEGIN DECLARE SECTION;
int id;
EXEC SQL END DECLARE SECTION;
cout << "Welche Frage? (ID)" << endl;
selectCategory();
cin >> id;
if(id){
EXEC SQL DELETE FROM gr2.testquestions WHERE "ID" = :id;
if(!strcmp(sqlca.sqlstate, "02000")) cout << "Frage existiert nicht!" << endl;
EXEC SQL COMMIT;
}
}
void cinClear() {