Child pages
  • Maintenance Mode
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 23 Next »

Function

isInMaintenanceMode

Description

Returns true if the server is in maintenance mode, false otherwise.

Syntax

Parameters

Example

if (%%elementName%%.isInMaintenanceMode())
	application.output("Server is in maintenance mode.");
else
	application.output("Server is not in maintenance mode.");

Function

setMaintenanceMode

Description

Puts the server into/out of maintenance mode, depending on the boolean parameter that is specified (if the parameter is true, then the server will be put into maintenance mode; if the parameter is false, then the server will be put out of maintenance mode).

Syntax

Parameters

Example

%%elementName%%.setMaintenanceMode(!%%elementName%%.isInMaintenanceMode());

Function

getConnectedClients

Description

Returns an array of IClientInformation elements describing the clients connected to the server.

Syntax

Parameters

Example

var clients = %%elementName%%.getConnectedClients();
application.output("There are " + clients.length + " connected clients.");
for (var i = 0; i < clients.length; i++)
	application.output("Client has clientId '" + clients[i].getClientId() + "' and has connected from host '" + clients[i].getHostAddress() + "'.");

Function

sendMessageToAllClients

Description

Sends a message to all connected clients.

Syntax

Parameters

Example

%%elementName%%.sendMessageToAllClients("Hello, all clients!");

Function

sendMessageToClient

Description

Sends a message to a specific client, identified by its clientId. The clientIds are retrieved by calling the getConnectedClients method.

Syntax

Parameters

Example

var clients = %%elementName%%.getConnectedClients();
for (var i=0; i<clients.length; i++)
	%%elementName%%.sendMessageToClient(clients[i].getClientId(), "Hello, client " + clients[i].getClientId() + "!");

Function

shutDownAllClients

Description

Shuts down all connected clients.

Syntax

Parameters

Example

%%elementName%%.shutDownAllClients();

Function

shutDownClient

Description

Shuts down a specific client, identified by its clientId. The clientIds are retrieved by calling the getConnectedClients method.

Syntax

Parameters

Example

var clients = %%elementName%%.getConnectedClients();
for (var i=0; i<clients.length; i++)
	%%elementName%%.shutDownClient(clients[i].getClientId());

Function

getServer

Description

Retrieves an instance of JSServer corresponding to the server with the name specified through the "serverName" argument. If the optional argument "mustBeEnabled" is set to true, then the JSServer instance is returned only if the server is active. Similarly, if the "mustBeValid" optional argument is set to true, then the JSServer instance is returned only if the server is valid. If the specified server is not found, or if it does not meet the requirements imposed by the optional arguments, then null is returned. By default both optional arguments have the value false.

Syntax

Parameters

Example

var server = %%elementName%%.getServer("example_data");
if (server) {
	var tableNames = server.getTableNames();
	application.output("There are " + tableNames.length + " tables.");
	for (var i=0; i<tableNames.length; i++)
		application.output("Table " + i + ": " + tableNames[i]);
	}
else {
	plugins.dialogs.showInfoDialog("Attention","Server 'example_data' cannot be found.","OK");
}

Function

getServerNames

Description

Retrieves a list with the names of all available database servers. The returned list will contain only enabled servers if the "mustBeEnabled" optional argument is set to true. The list will contain only valid servers if the "mustBeValid" argument is set to true. If the "sort" optional argument is set to true, then the list will be sorted alphabetically. If the "includeDuplicates" optional argument is set to false, then duplicate servers will appear only once in the list. By default, the "mustBeEnabled" and the "mustBeValid" arguments have the value false, while the "sort" and "includeDuplicates" arguments have the value true.

Syntax

Parameters

Example

var serverNames = %%elementName%%.getServerNames();
application.output("There are " + serverNames.length + " servers.");
for (var i=0; i<serverNames.length; i++)
	application.output("Server " + i + ": " + serverNames[i]);

  • No labels