home *** CD-ROM | disk | FTP | other *** search
- /*----------------------------------------------------------------*/
- /* */
- /* Example of sqlfgt() and sqlfpt() : */
- /* Get file from Server and Put file to Server */
- /* */
- /*----------------------------------------------------------------*/
-
- #include "stdio.h"
- #include "sql.h"
- #include "errsql.h"
- #include "sqlsrv.h"
-
- /* error defines */
- #define APIERROR 1
-
- #define apierr(a) error(a,__LINE__, APIERROR)
-
- SQLTRCD rcd; /* return code */
-
- main()
- {
- SQLTSVH shandle;
- SQLTDAP srvname;
- char *password;
- char *srvfile;
- char *lclfile;
-
- srvname = "SERVER1";
- password = 0;
- srvfile = "sql.h";
- lclfile = "localsql.h";
-
- /* CONNECT TO THE SERVER */
-
- if (rcd = sqlcsv(&shandle,srvname,password))
- apierr("SQLCSV");
- else
- printf("Connection Established to Server \n");
-
- if (rcd = sqlfgt(shandle, srvfile, lclfile))
- apierr("SQLFGT");
- else
- printf("Sucessful Get File from Server \n");
-
- srvfile = "srvsqlfl.h";
-
- if (rcd = sqlfpt(shandle, srvfile, lclfile))
- apierr("SQLFPT");
- else
- printf("Sucessful Put File to Server \n");
-
- /* DISCONNECT FROM THE SERVER */
-
- if (rcd = sqldsv(shandle))
- apierr("SQLDSV");
- else
- printf("Disconnected from Server \n");
- }
-
- /*
- ERROR - prints an error message for the utility
- */
- error(what, line, type)
- char* what; /* description of what happened */
- int line; /* line number where error occured */
- int type; /* type of error */
- {
- char msg[200]; /* error message buffer */
-
- sqlerr(rcd, msg); /* get the error message */
- printf("\nError: %s at line %d: %s, Error # %d\n", what, line, msg,rcd);
- }
-
-
-