home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: Product
/
Product.zip
/
DBDEMO.ZIP
/
DEMODB.ZIP
/
D30ACBA2.C
< prev
next >
Wrap
Text File
|
1991-06-03
|
4KB
|
132 lines
/* ********************************************************************* */
/*
D30ACBA2.C is a program with only one function: to update the database
configuration file.
The changes made will be to the log file size and to the application
heap size.
Log file size will be changed to 200 - 4k pages.
Application heap size will be changed to 6. */
/***************************************************************************/
/* */
/* MODIFICATIONS: */
/* Date Author Description */
/* */
/* */
/* 12/10/87 D.J.Grant Added SQLEISIG function call, and */
/* enhances exit_error to also print */
/* SQLERRD[0] - [5] and SQL_ERRP. */
/* 02/06/89 W.B.Brown Upgraded to run on Release 3.0. */
/* */
/* */
/***************************************************************************/
#include <stdio.h>
#include <sql.h>
#include <sqlenv.h>
#include <sqlutil.h>
#include <sqlca.h>
#include <sqlcodes.h>
#include <memory.h>
#include <string.h>
struct sqlca sqlca;
unsigned char msg_buf[512];
unsigned char rte_label[16] = " ";
unsigned char dbase[] = "BANK";
unsigned char password[] = "";
unsigned char errfile[] = "D30ACBA2.ERR";
unsigned char sqlerrp_value[9] = " "; /* error value */
int errlevel = 0;
short rc = 0; /* From sqlaintp - initialize to 0 */
/* ** BEGIN MAIN FUNCTION ******* ******** */
int main (void);
main ()
{
/* Declare output error file */
FILE *ptr_errfile;
/* Declare a short integer to receive the return code message length-SQL */
/* (Error file is open for error, therefore (-1) is used for open.) */
/* Declare a short integer to indicate dbase open(0) or failed (-1). */
struct sqlfupd chglst[2];
unsigned long opt4;
unsigned short opt7;
opt4 = 200;
opt7 = 6;
chglst[0].token = 4;
chglst[0].ptrvalue = (char *)&opt4;
chglst[1].token = 7;
chglst[1].ptrvalue = (char *)&opt7;
strcpy(rte_label,"instal sqleisig");
sqleisig(&sqlca); /* ctrl-break processing */
if (sqlca.sqlcode != 0)
{
goto ret_code;
}
/* ******************************************************************** */
sqlfeudb (dbase,password,2,chglst,&sqlca);
ret_code:
if (sqlca.sqlcode != 0)
{
ptr_errfile = fopen(errfile, "w");
fprintf(ptr_errfile,"\nSQLERRD[0] is %ld",sqlca.sqlerrd[0]);
fprintf(ptr_errfile,"\nSQLERRD[1] is %ld",sqlca.sqlerrd[1]);
fprintf(ptr_errfile,"\nSQLERRD[2] is %ld",sqlca.sqlerrd[2]);
fprintf(ptr_errfile,"\nSQLERRD[3] is %ld",sqlca.sqlerrd[3]);
fprintf(ptr_errfile,"\nSQLERRD[4] is %ld",sqlca.sqlerrd[4]);
fprintf(ptr_errfile,"\nSQLERRD[5] is %ld",sqlca.sqlerrd[5]);
memcpy (sqlerrp_value, sqlca.sqlerrp, 8);
fprintf(ptr_errfile,"\nSQLERRP is %s",sqlerrp_value);
if ((rc = sqlaintp(msg_buf,512,0,&sqlca)) > 0)
{
fprintf(ptr_errfile,"SQLCODE IS %ld\n",sqlca.sqlcode);
fprintf(ptr_errfile,msg_buf);
fclose(ptr_errfile);
}
else
{
fprintf(ptr_errfile,"SQLCODE IS %ld\n",sqlca.sqlcode);
fclose(ptr_errfile);
}
errlevel = 2;
}
return(errlevel);
} /* END MAIN FUNCTION */