sqllogin() — Start a Progress ESQL Session

Logs into Progress ESQL from an ESQL application. You must successfully call sqllogin() once before calling any other ESQL functions, except sqlgetmsg().

If sqllogin() logs in successfully and connects to all requested databases, it returns 0; otherwise it returns -1. If the call is unsuccessful, you can call sqllogin() again. (If you call sqllogin() more than once, it returns unsuccessfully after the first successful call.) You can also call sqllogin() again after you call sqllogout():

SYNTAX
int
sqllogin ( argc, argv, pparms, papplname )
  int   argc;         /* INPUT */
  char  **argv;      /* INPUT */
  char  *pparms;      /* INPUT */
  char  * papplname;    /* INPUT */ 

argc

The number of pointers (to startup parameters) to which argv refers. If you set argv from the command line, the operating system typically sets argc when parsing the command line during application startup. However, you must ensure that argc is set according to the following rules:

argv

A pointer to a null-terminated list of pointers to Progress startup parameters. ESQL requires the null termination to find the end of the list (i.e., it does not use argc to traverse the list). If you set argv from the command line, the operating system terminates the list for you.

pparms

A pointer to a string specifying Progress startup parameters. ESQL processes the parameters in pparms before the parameters in argv. This allows you to override default values that argv specifies from the command line.

papplname

A pointer to the name of your application. ESQL uses the first two characters of papplname to generate the first two characters of the application’s r-code filenames. If you specify a null string for this value, ESQL generates these filenames entirely as random hexadecimal number strings (plus the .r extension).

NOTE: If you preprocess with precompiling, the string that papplname specifies must contain the same name as the application name you specify with the -a parameter of the SQL preprocessor.

NOTES

EXAMPLE

In this example, the program esqldemo calls sqllogin():

char *msg;
            .
            .
            .
if (sqllogin(argc-1,&argv[1],"-s 10","esqldemo") == -1)
{
  printf("Failed to login to Progress ESQL!\n");
    while ((msg = (char *) sqlgetmsg()) != (char *) 0)
      printf("%s\n",msg);
  exit(2);
} 

For this example, you must first invoke esqldemo with the following command:

esqldemo demo -U dean -P PdSvcs 

The first command line argument (argv[0]) points to the program name esqldemo, but esqldemo bypasses argv[0], since Progress does not need or recognize the program name as a startup parameter. The first argument to sqllogin() (argc-1) passes a decremented argument count to reflect the bypassing of argv[0]. The program accepts the remaining command line arguments as Progress startup parameters (passed with the second argument to sqllogin() , argv[1]), including the database name (demo), the user name (dean), and the password (PdSvcs). The program passes the third argument to sqllogin() containing the Stack Size startup parameter (set to 10K), and passes the fourth argument to sqllogin() specifying esqldemo as the application name used for generating r-code.

SEE ALSO

sqlapplname() — Set the ESQL Application Name, sqlconn() — Connect Database(s), sqlgetmsg() — Get Next Error Message, sqllogout() — Terminate a Progress ESQL Session


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095