home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
distrib.akp.su/Programming/Vb-6+Rus/
/
distrib.akp.su.tar
/
distrib.akp.su
/
Programming
/
Vb-6+Rus
/
COMMON
/
MSDEV98
/
BIN
/
IDE
/
XPWIZ.AWX
/
TEMPLATE
/
PROC.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1998-06-18
|
2KB
|
85 lines
#include <stdafx.h>
#define XP_NOERROR 0
#define XP_ERROR 1
#define MAXCOLNAME 25
#define MAXNAME 25
#define MAXTEXT 255
#ifdef __cplusplus
extern "C" {
#endif
RETCODE __declspec(dllexport) $$XP_NAME$$(SRV_PROC *srvproc);
#ifdef __cplusplus
}
#endif
RETCODE __declspec(dllexport) $$XP_NAME$$(SRV_PROC *srvproc)
{
DBSMALLINT i = 0;
DBCHAR colname[MAXCOLNAME];
DBCHAR spName[MAXNAME];
DBCHAR spText[MAXTEXT];
// Name of this procedure
wsprintf(spName, "$$XP_NAME$$");
//Send a text message
wsprintf(spText, "%s Sample Extended Stored Procedure", spName);
srv_sendmsg(
srvproc,
SRV_MSG_INFO,
0,
(DBTINYINT)0,
(DBTINYINT)0,
NULL,
0,
0,
spText,
SRV_NULLTERM);
//Set up the column names
wsprintf(colname, "ID");
srv_describe(srvproc, 1, colname, SRV_NULLTERM, SRVINT2, sizeof(DBSMALLINT), SRVINT2, sizeof(DBSMALLINT), 0);
wsprintf(colname, "spName");
srv_describe(srvproc, 2, colname, SRV_NULLTERM, SRVCHAR, MAXNAME, SRVCHAR, 0, NULL);
wsprintf(colname, "Text");
srv_describe(srvproc, 3, colname, SRV_NULLTERM, SRVCHAR, MAXTEXT, SRVCHAR, 0, NULL);
// Update field 2 "spName", same value for all rows
srv_setcoldata(srvproc, 2, spName);
srv_setcollen(srvproc, 2, strlen(spName));
// Send multiple rows of data
for (i = 0; i < 3; i++) {
// Update field 1 "ID"
srv_setcoldata(srvproc, 1, &i);
// Update field 3 "Text"
wsprintf(spText, "%d) Sample rowset generated by the %s extended stored procedure", i, spName);
srv_setcoldata(srvproc, 3, spText);
srv_setcollen(srvproc, 3, strlen(spText));
// Send the entire row
srv_sendrow(srvproc);
}
// Now return the number of rows processed
srv_senddone(srvproc, SRV_DONE_MORE | SRV_DONE_COUNT, (DBUSMALLINT)0, (DBINT)i);
return XP_NOERROR ;
}