strcat(result," ");
}
else
{
strcat(s,"s ");
sprintf(s1,s,fulda->sqlvar??(i??).sqldata);
strcat(result,s1);
}
break;
}
case 496:
{
strcat(s,"d ");
sprintf(s1,s,*((long int*)fulda->sqlvar??(i??).sqldata));
strcat(result,s1);
break;
}
case 497:
{
if(*fulda->sqlvar??(i??).sqlind<0)
{
for(j=0;j<l;j++)strcat(result,"_");
strcat(result," ");
}
else
{
strcat(s,"d ");
sprintf(s1,s,*((long int*)fulda->sqlvar??(i??).sqldata));
strcat(result,s1);
}
break;
}
case 500:
{
strcat(s,"d ");
sprintf(s1,s,*((short int*)fulda->sqlvar??(i??).sqldata));
strcat(result,s1);
break;
}
case 501:
{
if(*fulda->sqlvar??(i??).sqlind<0)
{
for(j=0;j<l;j++)strcat(result,"_");
strcat(result," ");
}
else
{
strcat(s,"d ");
sprintf(s1,s,*((short int*)fulda->sqlvar??(i??).sqldata));
strcat(result,s1);
}
break;
}
default:
{
for(j=0;j<l;j++)strcat(result,"?");
strcat(result," ");
}
}
}
strcat(result,"\n");
}
CLOSE_CUR1:
EXEC SQL CLOSE CUR1;
if (sqlca.sqlcode != 0)
{
sprintf(argv??(2??),"ERROR - SQL code returned non-zero for "
"close CUR1, received %d\n",sqlca.sqlcode);
*(int *) argv??(3??) = sqlca.sqlcode;
return(-1);
}
for(i=0;i<fulda->sqld;i++)
{
free(fulda->sqlvar??(i??).sqldata);
free(fulda->sqlvar??(i??).sqlind);
}
free(fulda);
strcat(result,"\n");
strcpy(argv??(2??),result);
}
else
{
EXEC SQL EXECUTE STATEMENT;
if (sqlca.sqlcode != 0)
{
sprintf(argv??(2??),"ERROR - SQL code returned non-zero for "
"execute STATEMENT, received %d\n",sqlca.sqlcode);
*(int *) argv??(3??) = sqlca.sqlcode;
return(-1);
}
strcpy(argv??(2??),result);
}
}
else
{
printf("\nParameters missing.\n");
return(-1);
}
}
/*****************************************************/
/* S009 */
/* Вызывает хранимую процедуру S008 procedure */
/*****************************************************/
#include <stdlib.h>
#include <stdio.h>
EXEC SQL INCLUDE SQLCA;
int main(void)
{
EXEC SQL BEGIN DECLARE SECTION;
short outcode;
short pri;
EXEC SQL END DECLARE SECTION;
printf("\nS009 begin.\n");
EXEC SQL CALL S010(:outcode,:pri);
if (sqlca.sqlcode != 0)
{
printf("ERROR - SQL code returned non-zero for "
"call, received %d\n",sqlca.sqlcode);
exit(-1);
}
printf("\nOutcode=%d\nPrint=%d\n",outcode,pri);
printf("S009 end.\n");
EXEC SQL COMMIT;
return 0;
}
/*********************************************************************/
/* S010 */
/* Пример хранимой процедуры */
/* */
/* INSERT INTO SYSIBM.SYSPROCEDURES */
/* (PROCEDURE, AUTHID, LUNAME, LOADMOD, LINKAGE, COLLID, */
/* LANGUAGE, ASUTIME, STAYRESIDENT, IBMREQD, RUNOPTS, */
/* PARMLIST,RESULT_SETS,WLM_ENV, */
/* PGM_TYPE,EXTERNAL_SECURITY,COMMIT_ON_RETURN) */
/* VALUES('S010', ' ', ' ', 'S010', ' ', 'S010', */
/* 'C', 0, ' ', 'N', ' ', */
Уважаемый посетитель!
Чтобы распечатать файл, скачайте его (в формате Word).
Ссылка на скачивание - внизу страницы.