
Appendix F: The SPAREA
SPAREAX C definition
#ifndef SP_DEFS
#define SP_DEFS
/*
Various declarations and definitions for Stored Procedures for C.
Should be usable with the SAS/C compiler, and with slight
modification, the IBM C/370 compiler. Uses the SAS/C digraphs for
square brackets - "(]" for the left square bracket, and "])" for the
right square bracket.
SAS/C and C/370 are trademarks of the SAS Institute, Inc. and IBM
Corporation respectively.
*/
#include "sqlda.h"
/*
Keyword variable table declaration.
*/
struct VARTAB {
unsigned long varTabL; /* Number of entries in table (<<= 50) */
struct VARENT {
char *varName; /* Variable name */
char *varValue; /* Variable value */
short varNameL; /* Variable name length */
short varValL; /* Variable value length */
} varent(]50]);
};
/*
Stored Procedure Communication Area declaration.
*/
struct SPAREA {
char spheader(]8]); /* DS CL8 Eye catcher */
char spresrvd(]33]) /* DS CL33 Server information */
char sptrcopt; /* DS CL1 Trace options */
char spstatus(]2]); /* DS CL2 Status indicator */
char spcode(]8]); /* DS CL8 Error code */
char spformat(]3]); /* DS CL3 Pipe format */
char spmode(]6]); /* DS CL6 Pipe mode */
char sprc(]3]); /* DS CL3 Return code */
union {
char *spfrom; /* DS 0A From address */
char *spinto; /* DS 0A Into address */
struct SQLDA *spsqlda; /* DS A SQLDA address */
};
char *spvartxt; /* DS A Variable text */
struct VARTAB *spvartab; /* DS A Variable table */
int sprows; /* DS F Rows affected */
union {
short spmaxlen; /* DS 0H Max length of STD rec */
short spreclen; /* DS H Record length */
};
short spvarlen; /* DS H Variable text length */
char spprefix; /* DS CL1 Message file prefix */
char spmsg(]100]); /* DS CL100 Message area */
char _f0(]3]); /* Padding for alignment */
struct SQLBUF *spsql; /* DS A SQL buffer address */
char spattach(]8]); /* DS CL8 Attachment name */
char spuserid(]8]); /* DS CL8 Userid */
char sppwd(]8]); /* DS CL8 Password */
char spcmpopt; /* DS CL1 Compression option */
char spind; /* DS CL1 Message indicator */
char spdate(]8]); /* DS CL8 Request execution date */
char sptime(]8]); /* DS CL8 Request execution time */
char spconfig]4]); /* DS CL4 Configuration name */
char spserver(]30]); /* DS CL30 Server name */
char _f1(]32]); /* Padding to end of record */
};
/*
Stored procedure function declarations.
*/
void attach(struct SPAREA *); /* Attach to remote server */
void clospipe(struct SPAREA *); /* Close input/output pipe */
void commit(struct SPAREA *); /* Issue SYNCPOINT w/COMMIT */
void cssetup(struct SPAREA *); /* Initialize SPAREA */
void detach(struct SPAREA *); /* Detach from remote server */
void getmsg(struct SPAREA *); /* Get a message */
void getpipe(struct SPAREA *); /* Get row from input pipe */
void getpipe(struct SPAREA *); /* Put row to output pipe */
void message(struct SPAREA *); /* Issue message */
void openpipe(struct SPAREA *); /* Open input/output pipe */
void reqexec(struct SPAREA *); /* Execute SQL request */
void rescheck(struct SPAREA *); /* Check for results */
void rollback(struct SPAREA *); /* Issue SYNCPOINT w/ROLLBACK */
void status(struct SPAREA *); /* Issue status */
#endif
Copyright © 2005. Sybase Inc. All rights reserved.
|
|
View this book as PDF 