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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

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() {

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() {

Binary file not shown.

Binary file not shown.

View File

@@ -1,13 +1 @@
# depslib dependency file v1.0
1489738282 source:c:\users\s_seedorf\desktop\cpp\project\dbclient.pgc
<iostream>
<stdlib.h>
1489959780 source:f:\postgrachelor\project\dbclient.pgc
<iostream>
<stdlib.h>
1489768344 source:f:\postgrachelor\postgrachelorcppapplication\project\dbclient.pgc
<iostream>
<stdlib.h>

View File

@@ -4,7 +4,7 @@
<ActiveTarget name="Debug" />
<File name="dbclient.pgc" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="5815" topLine="213" />
<Cursor1 position="10046" topLine="324" />
</Cursor>
</File>
<File name="dbclient.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">