You are here: Surpac Concepts > Macros > SCL > Database Commands > SclDatabases
GEOVIA Surpac

sclDatabases

Overview

This command provides access to the list of currently connected databases. The current implementation only supports only a single database connection. You can obtain the handle of the currently connected database using this command. From the database handle, you can obtain handles for other database objects (such as queries, inserts, tables, fields).

Synopsis

sclDatabases command optional argument list
sclDatabases SclCountItems
sclDatabases SclGetItem DatabaseHandle $DatabasePosition

Description

The sclDatabases command has a number of sub commands that permit various tasks to be performed. Each of the sub-commands and their arguments are described below.

Arguments

  • SclCountItems - Returns a count of the number of currently connected databases. At this time only 1 database can be connected at a time.
  • SclGetItem - Obtains the handle to a database at a specified position in the set of databases.
    • DatabaseHandle
    • Passed by reference. The handle to the database at the specified position is assigned to this variable.

    • DatabasePosition
    • Passed by value. The position in the set of databases for which the database handle is required. At this time only one database can be connected at a time so the only valid value for DatabasePosition is 0.

Returns

$SCL_TRUE on successful completion. A TCL error is returned if an error is encountered.

Examples

#
# Get the handle to an existing database and display its name
#
if {[sclDatabases SclCountItems] < 1} {
error "No databases are connected"
}
sclDatabases SclGetItem DatabaseHandle 0
  puts "The connected database name is [$DatabaseHandle SclGetId]"