In-Memory Databases

Overview

In addition to using tables stored on real database servers, Servoy allows you to create In-Memory tables (using HSQL). These tables have the same configurations as regular database tables, including column properties and events.

You can populate these In-Memory tables by using a JSDataSet and the createDataSource() function. This function allows you to dynamically define In-Memory datasources or foundsets at runtime. If you've already defined the In-Memory table in Servoy Developer, you won’t need to provide the column and type information again, as this was already defined during design time.

Creating In-Memory Databases

There are two ways to create an In-Memory database:

  1. Using the Solution Explorer context menu under Datasources -> In Memory -> Create new data source. This opens a dialog where you can specify the datasource name.

Create In-Memory datasource

After adding the datasource name, the Table Editor will open, allowing you to define the structure of your table, just like any other table.

  1. At runtime, using JSDataSet::createDataSource.

This function allows you to dynamically define In-Memory datasources/foundsets at runtime. Alternatively, if you've already defined the In-Memory datasource in the Developer, you won’t need to provide column and type information at runtime, as it was set during design time.

Additional Table Event: onLoad

In-Memory tables have an additional table event called onLoad, which is triggered when a form accesses the In-Memory datasource (i.e., when the form’s datasource is set to the In-Memory table) or when datasource.mem.name.getFoundSet() is called. This event enables you to populate the In-Memory datasource on demand, rather than during the solution or form’s onLoad event.

However, you still need to use the JSDataSet::createDataSource() function within the onLoad method to actually populate the In-Memory table.

Commands Summary

Below is a summary of available commands via the context menu for In-Memory datasources:

Command
Summary

Opens the Table Editor to edit the table

Deletes the In-Memory Datasource definition

Renames the In-Memory Datasource definition

Searches for all locations within the solution where the In-Memory datasource is used

Commands Details

Create in memory datasource

Creates an In-Memory datasource with a specified name (table name). Opens the Table Editor to define and edit the table as you would for a regular database table.

Edit table/view

Opens the Table Editor to edit the In-Memory table’s structure and column information (metadata stored by Servoy Developer).

Move In Memory Datasource

Moves the In-Memory Datasource to another solution (module).

Delete In Memory Datasource

Deletes the In-Memory Datasource definition.

Rename In Memory Datasource

Renames the In-Memory Datasource definition.

Search for references

Searches for all locations within the solution where the In-Memory datasource is used, and lists them in the ##Search view##. This can be useful to find out which objects are using this data source.

Last updated

Was this helpful?