void INGdisconnectDB(INGconn *dbconn) { /* # line 808 "myingres.sc" */ int sess_id; /* # line 810 "myingres.sc" */ if (dbconn != NULL) { sess_id = dbconn->session_id; /* # line 814 "myingres.sc" */ /* disconnect */ { IIsqInit(&sqlca); IILQsidSessID(sess_id); IIsqDisconnect(); } /* # line 816 "myingres.sc" */ /* host code */ free(dbconn->dbname); if (dbconn->user) { free(dbconn->user); } if (dbconn->password) { free(dbconn->password); } free(dbconn->msg); free(dbconn); } }
Owners_record *getowners(void) { Owners_record *head = 0 ; struct { char parentname[12 ]; char parentcity[11 ]; char childname[22 ]; char childcity[11 ]; float fraction; } Owners; short null_indicator[5]; /* # line 3511 "getowners.sc" */ /* connect */ { IIsqInit(&sqlca); IIsqConnect(0,"hotel",(char *)0, (char *)0, (char *)0, (char *)0, (char *)0, (char *)0, (char *)0, (char *)0, (char *)0, (char *)0, (char *)0, (char *)0, (char *)0); if (sqlca.sqlcode < 0) IIsqStop(&sqlca); } /* # line 3514 "getowners.sc" */ /* open */ { IIsqInit(&sqlca); IIcsOpen("cursor1",26754,24986); IIwritio(0,(short *)0,1,32,0,"select * from owners"); IIwritio(0,(short *)0,1,32,0," for readonly "); IIcsQuery("cursor1",26754,24986); if (sqlca.sqlcode < 0) IIsqStop(&sqlca); } /* # line 3515 "getowners.sc" */ /* host code */ while (sqlca.sqlcode == 0) { /* # line 3516 "getowners.sc" */ /* fetch */ { IIsqInit(&sqlca); if (IIcsRetrieve("cursor1",26754,24986) != 0) { IIcsGetio(&null_indicator[0],1,32,11,(Owners).parentname); IIcsGetio(&null_indicator[1],1,32,10,(Owners).parentcity); IIcsGetio(&null_indicator[2],1,32,21,(Owners).childname); IIcsGetio(&null_indicator[3],1,32,10,(Owners).childcity); IIcsGetio(&null_indicator[4],1,31,4,&(Owners).fraction); IIcsERetrieve(); } /* IIcsRetrieve */ if (sqlca.sqlcode < 0) IIsqStop(&sqlca); } /* # line 3517 "getowners.sc" */ /* host code */ if (sqlca.sqlcode == 0) { head = add_orecord(head, Owners.parentname, Owners.parentcity, Owners.childname, Owners.childcity, Owners.fraction); } } /* # line 3523 "getowners.sc" */ /* close */ { IIsqInit(&sqlca); IIcsClose("cursor1",26754,24986); if (sqlca.sqlcode < 0) IIsqStop(&sqlca); } /* # line 3524 "getowners.sc" */ /* commit */ { IIsqInit(&sqlca); IIxact(3); if (sqlca.sqlcode < 0) IIsqStop(&sqlca); } /* # line 3525 "getowners.sc" */ /* disconnect */ { IIsqInit(&sqlca); IIsqDisconnect(); if (sqlca.sqlcode < 0) IIsqStop(&sqlca); } /* # line 3527 "getowners.sc" */ /* host code */ return head; }
Hotels_record *gethotels(void) { Hotels_record *head = 0 ; struct { char hname[22 ]; char hcity[11 ]; } Hotels; short null_indicator[2]; /* # line 3508 "gethotels.sc" */ /* connect */ { IIsqInit(&sqlca); IIsqConnect(0,"hotel",(char *)0, (char *)0, (char *)0, (char *)0, (char *)0, (char *)0, (char *)0, (char *)0, (char *)0, (char *)0, (char *)0, (char *)0, (char *)0); if (sqlca.sqlcode < 0) IIsqStop(&sqlca); } /* # line 3511 "gethotels.sc" */ /* open */ { IIsqInit(&sqlca); IIcsOpen("cursor2",26752,22733); IIwritio(0,(short *)0,1,32,0,"select hname, hcity from hotel"); IIwritio(0,(short *)0,1,32,0," for readonly "); IIcsQuery("cursor2",26752,22733); if (sqlca.sqlcode < 0) IIsqStop(&sqlca); } /* # line 3512 "gethotels.sc" */ /* host code */ while (sqlca.sqlcode == 0) { /* # line 3513 "gethotels.sc" */ /* fetch */ { IIsqInit(&sqlca); if (IIcsRetrieve("cursor2",26752,22733) != 0) { IIcsGetio(&null_indicator[0],1,32,21,(Hotels).hname); IIcsGetio(&null_indicator[1],1,32,10,(Hotels).hcity); IIcsERetrieve(); } /* IIcsRetrieve */ if (sqlca.sqlcode < 0) IIsqStop(&sqlca); } /* # line 3514 "gethotels.sc" */ /* host code */ if (sqlca.sqlcode == 0) { head = add_hrecord(head, Hotels.hname, Hotels.hcity); } } /* # line 3519 "gethotels.sc" */ /* close */ { IIsqInit(&sqlca); IIcsClose("cursor2",26752,22733); if (sqlca.sqlcode < 0) IIsqStop(&sqlca); } /* # line 3520 "gethotels.sc" */ /* commit */ { IIsqInit(&sqlca); IIxact(3); if (sqlca.sqlcode < 0) IIsqStop(&sqlca); } /* # line 3521 "gethotels.sc" */ /* disconnect */ { IIsqInit(&sqlca); IIsqDisconnect(); if (sqlca.sqlcode < 0) IIsqStop(&sqlca); } /* # line 3523 "gethotels.sc" */ /* host code */ return head; }
void IIpsqDisconnect(void) { IIsqDisconnect(); }