hostdatabases
hostdatabases
HOST
,
DATABASES
,
CACHE

The hostdatabases statement downloads a list of available databases on a Panorama X Server.

Parameters

This statement has three parameters:

host – name of the host to query.

databases – field or variable to contain the list of databases on the server. The list will be carriage return separated. If this parameter is omitted, the statement will run asynchronously (see below).

cache – optional pre-cached data from hoststatus statement. If this parameter is supplied, Panorama will not query the server.

Description

This statement downloads a list of available databases on a Panorama X Server. Here is an example that uses the hostdownload statement to download all of the available databases on a server to the local computer:

    local sharedDatabases
    hostdatabases "My Server",sharedDatabases
    looparray sharedDatabases,cr(),sharedDatabase
        hostdownload sharedDatabase,"My Server",{path="~/Documents/Databases/"}
    endloop

Note: The hostdatabases function will return an error if the current user is not authorized to administer the specified server (see Restricting Server Access).

#### Getting the Database List in the Background

The hostdatabases statement normally runs synchronously, in other words, you have to wait for the server to respond before the procedure continues with the next line. While you are waiting, Panorama is unresponsive.

Another option is to run the statement asynchronously. To do that, simply leave off the databases parameter. If you do this, your code must include the label `hostDatabases:` (see the goto statement to learn about labels). When used asynchronously, the hostdatabases statement will send a request to the server for the list of databases, but will not wait for the list, so Panorama is not frozen while it waits. When the list is ready, Panorama will automatically call your `hostDatabases:` subroutine. It passes one parameter to this subroutine, the list of server databases. Here is an example that gets the list of databases on My Server, then displays that list on a form (using a Text Display, Text List or Matrix object). Panorama doesn’t freeze up waiting for the server, you can begin performing other tasks immediately. Whenever the server responds with the list, it will be displayed.

    hostdatabases "My Server"
    return

    hostDatabases:
    letfileglobal sharedDatabases = parameter(1)
    showvariables sharedDatabases // display the list on a form

Note: If the current user is not authorized to administer the specified server (see Restricting Server Access), the list will be empty.

See Also

- hostdownload -- downloads a shared file to this computer, prompting the user for the location.

History

Version | Status | Notes
10.2 | New | New in this version.