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

@@ -575,11 +575,54 @@ void updateQuestion(){
}
void deleteCategory(){
/* exec sql begin declare section */
#line 356 "F:\\postgrachelor\\project\\dbclient.pgc"
int id ;
/* exec sql end declare section */
#line 357 "F:\\postgrachelor\\project\\dbclient.pgc"
cout << "Welche Kategorie? (ID)" << endl;
selectCategory();
cin >> id;
if(id){
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "delete from gr2 . test where \"ID\" = $1 ",
ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 362 "F:\\postgrachelor\\project\\dbclient.pgc"
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;
{ ECPGtrans(__LINE__, NULL, "commit");}
#line 365 "F:\\postgrachelor\\project\\dbclient.pgc"
}
}
void deleteQuestion(){
/* exec sql begin declare section */
#line 371 "F:\\postgrachelor\\project\\dbclient.pgc"
int id ;
/* exec sql end declare section */
#line 372 "F:\\postgrachelor\\project\\dbclient.pgc"
cout << "Welche Frage? (ID)" << endl;
selectCategory();
cin >> id;
if(id){
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "delete from gr2 . testquestions where \"ID\" = $1 ",
ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 377 "F:\\postgrachelor\\project\\dbclient.pgc"
if(!strcmp(sqlca.sqlstate, "02000")) cout << "Frage existiert nicht!" << endl;
{ ECPGtrans(__LINE__, NULL, "commit");}
#line 379 "F:\\postgrachelor\\project\\dbclient.pgc"
}
}
void cinClear() {