/* Program unosi ispitni rok Mart 2016 */ #include #include EXEC SQL INCLUDE SQLCA; /* funkcija za obradu greske */ int iserror(char err[]){ if (SQLCODE < 0){ printf("SQLCODE %ld %s\n\n", SQLCODE, err); return 1; } return 0; } /* za poziv funkcije greske koristice se makro */ #define CHECKERR(s) if (iserror(s)) exit(1); int main() { int i; /* povezujemo se na BP */ EXEC SQL CONNECT TO vstud user student using abcdef; CHECKERR("Connect"); EXEC SQL INSERT INTO ispitni_rok values (2016, 'mar', 'Mart 2016', current_date - 1 month, current_date - 1 month + 20 days, 1); CHECKERR("Insert"); /* raskida se konekcija sa BP */ EXEC SQL CONNECT RESET; CHECKERR("Connect reset"); return 0; }