Problem: Looking for example of how to use isc_dsql_execute_immediate. Solution: IB V4.x Here is an example performing the request above. ----------------------------------------------- #include#include #include #include long dbStatus[32], SQLCODE; void tsetsqlcode(char *msg) { SQLCODE=isc_sqlcode(dbStatus); if (SQLCODE) { fprintf(stderr, "SQL err %ld doing %sn", SQLCODE, msg); exit(1); } } int main() { isc_db_handle db= 0; isc_tr_handle tr= 0; isc_stmt_handle stmt= 0; char sqlstring[50], cnt_info[2], string[1024]; strcpy(sqlstring, "testdb.db"); (void) isc_attach_database(dbStatus, 0, sqlstring, &db, 0, 0); tsetsqlcode("opening db"); (void) isc_start_transaction(dbStatus, &tr, 1, &db, 0, 0); tsetsqlcode("starting transaction"); strcpy(sqlstring, "delete from testfuncs"); isc_dsql_execute_immediate(dbStatus, &db, &tr, 0, sqlstring, 1, 0); tsetsqlcode("executing immed"); (void) isc_commit_transaction(dbStatus, &tr); tsetsqlcode("commit"); (void) isc_detach_database(dbStatus, &db); tsetsqlcode("closing db"); exit(0); } ---------------------- simple copy this to file and compile it and link it. For examples on Solaris: test.c is the file containing the above codes. pooka%cc -c -w test.c ==>produce file tester.o pooka%cc test.o -o test -lgdsmt -lsocket -lthread -lnsl -ldl pooka%test
Last Modified: 27-OCT-00