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, exceptsqlgetmsg()
.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 callsqllogin()
again. (If you callsqllogin()
more than once, it returns unsuccessfully after the first successful call.) You can also callsqllogin()
again after you callsqllogout():
argc
The number of pointers (to startup parameters) to which
argv
refers. If you setargv
from the command line, the operating system typically setsargc
when parsing the command line during application startup. However, you must ensure thatargc
is set according to the following rules:
- If
argv
points to one or more non-null pointers (i.e., there is a list of startup parameters), you must setargc
to a value >= 1. It does not matter what value you choose (i.e., it need not match the number of pointers to whichargv
refers.- If
argv
is null, (i.e., there is no list of startup parameters), you must setargc
to zero.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 setargv
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 thatargv
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
NOTE: If you preprocess with precompiling, the string that papplname specifies must contain the same name as the application name you specify with the.r
extension).-a
parameter of the SQL preprocessor.NOTES
EXAMPLE
- You can pass Progress startup parameters to ESQL from the command line only using
sqllogin()
.- You can call
sqllogin()
only once from an application.- If
sqllogin()
fails, the only ESQL-LIB function you can call issqlgetmsg()
to read any messages that ESQL returns.- The
sqllogin()
function accepts both ESQL session (login) startup parameters and database connection parameters. However, because a database connection failure during login prevents further access to ESQL-LIB (exceptsqlgetmsg()
), you can build a more robust application using thesqlconn()
function to make all database connections, and usingsqllogin()
for ESQL session startup only.- If you are running in the small client model, you cannot pass Progress session-wide client startup parameters to
sqllogin()
, except for the common ESQL startup parameters. For more information, see Building and Running ESQL Applications."- For another way to specify the application name, see the
sqlapplname()
function reference entry.- For more information on r-code generation and logging in to a Progress database, see Programming with ESQL."
In this example, the program
esqldemo
callssqllogin():
For this example, you must first invoke
esqldemo
with the following command:
The first command line argument (
argv
[0]) points to the program name esqldemo, but esqldemo bypassesargv
[0], since Progress does not need or recognize the program name as a startup parameter. The first argument tosqllogin()
(argc
-1) passes a decremented argument count to reflect the bypassing ofargv
[0]. The program accepts the remaining command line arguments as Progress startup parameters (passed with the second argument tosqllogin()
,argv
[1]), including the database name (demo), the user name (dean), and the password (PdSvcs). The program passes the third argument tosqllogin()
containing the Stack Size startup parameter (set to 10K), and passes the fourth argument tosqllogin()
specifyingesqldemo
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 |