Progress
Language Reference


LDBNAME Function

Interfaces
OS
SpeedScript
All
All
Yes

Returns the logical name of a database that is currently connected.

SYNTAX

LDBNAME
  (
    {   integer-expression
      | logical-name
      | alias
      | BUFFER bufname
    }
  ) 

integer-expression

The sequence number of a database the Progress session is connected to. For example, LDBNAME(1) returns information on the first database the Progress session is connected to, LDBNAME(2) returns information on the second database the Progress session is connected to, etc. If you specify a sequence number that does not correspond to a database the Progress session is connected to, the LDBNAME function returns the unknown value (?).

logical-name or alias

These forms of the LDBNAME function require a quoted character string or a character expression as a parameter. If the parameter is the logical name of a connected database or an alias of a connected database then the logical name is returned. Otherwise, Progress returns the unknown value (?).

BUFFER bufname

The name of a database table or buffer. The BUFFER option lets you determine the database a certain table belongs to without hard-coding the logical database name or alias.

EXAMPLE

This procedure disconnects all currently connected databases. After a database is disconnected, the connected databases are renumbered to reflect the change. For example, if databases 1, 2, 3, and 4, are connected and the procedure disconnects database 3, database 4 becomes database 3.

r-ldbnm.p
DO WHILE LDBNAME(1) <> ? : /* the parameter. is the number 1 */
  DISCONNECT VALUE(LDBNAME(1)).
END. 

NOTE

To determine if a particular name is an ALIAS or a logical database name, use this following procedure.

r-tstnm.p
DEFINE VARIABLE testnm as char.
SET testnm.
IF LDBNAME (testnm) = testnm
  THEN MESSAGE testnm "is a true logical database name.".
  ELSE
    IF LDBNAME (testnm) = ?
      THEN MESSAGE 
        testnm "is not the name or alias of any connected database.".
      ELSE MESSAGE 
        testnm "is an ALIAS for database " LDBNAME(testnm). 

SEE ALSO

CONNECT Statement, CONNECTED Function, CREATE ALIAS Statement, DBCODEPAGE Function, DBCOLLATION Function, DBRESTRICTIONS Function, DBTYPE Function, DELETE ALIAS Statement, DISCONNECT Statement, FRAME-DB Function, NUM-DBS Function, PDBNAME Function


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