JSServer

Overview

The JSServer class represents a database server object and is commonly accessed through the Servoy maintenance plugin. It provides methods to interact with a database server, allowing developers to create, modify, and remove tables dynamically. Through JSServer, developers can synchronize table definitions with the database, reload the database model to reflect changes made externally, and retrieve or validate the current state of the database server.

Functionality

Developers can create new tables with specified columns, retrieve existing tables, or drop them entirely. Tables can be synchronized with the database, enabling changes to column definitions or metadata. Additionally, the class supports reloading the server's data model to capture external modifications, such as those made through raw SQL operations. Utility methods allow retrieval of all table names on the server and verification of the server's validity for use.

Methods Summarized

Type
Name
Summary

Creates in this server a new table with the specified name.

Drops the table with the specified name from this server.

Returns a JSTable instance corresponding to the table with the specified name from this server.

Returns an array with the names of all tables in this server.

Get valid state for the server.

void

Reloads the datamodel from the database, if changed externally or via rawSQL plugin.

Synchronizes a JSTable instance with the database.

Methods Detailed

createNewTable(tableName)

Creates in this server a new table with the specified name.

Parameters

  • String tableName The name of the table to create.

Returns: JSTableObject JSTableObject created table.

Sample

dropTable(tableName)

Drops the table with the specified name from this server.

Parameters

  • String tableName The name of the table to drop.

Returns: Boolean boolean success.

Sample

getTable(tableName)

Returns a JSTable instance corresponding to the table with the specified name from this server.

Parameters

  • String tableName The name of the table to retrieve.

Returns: JSTableObject JSTableObject table.

Sample

getTableNames()

Returns an array with the names of all tables in this server.

Returns: Array Array of String table names.

Sample

isValid()

Get valid state for the server.

Returns: Boolean boolean valid state.

Sample

reloadDataModel()

Reloads the datamodel from the database, if changed externally or via rawSQL plugin.

This call is not needed after a call to synchronizeWithDB().

Returns: void

Sample

synchronizeWithDB(table)

Synchronizes a JSTable instance with the database. If columns were added to or removed from the JSTable instance, all these changes will now be persisted to the database.

Parameters

  • JSTableObject table A JSTableObject instance that should be synchronized.

Returns: Boolean boolean success.

Sample


Last updated

Was this helpful?