How to Work with a Local Database

Navigation:  »No topics above this level«

How to Work with a Local Database

Previous pageReturn to chapter overviewNext page

 

Overview

 

The local database is located in the device. It includes one or more tables which provide a storage space for application data but, also, allow for complex data structures like joined tables, etc. An MCL-Designer V4 project can ONLY include one local database with multiple tables and it is managed in the "Local Database"module. See Navigating the Local Database Module.

 

The data stored in the local database are managed and manipulated via SQL transactions.

 

If required, these data can be encrypted to ensure it will only be possible to read/use the local database content within the device itself.

 

MCL-Designer V4 provides you with processes ("Insert Record", "Delete Record", "Free SQL Statement",etc.) that handle the table(s) included in the local database.

See Working with the Local Database Processes Group.

 

The data within the local database can be indexed (see Working with Indexes) and its display can be structured with the help of views (see Working with Views).

 

The data included in the table(s) of a local database are displayed in the device's screen with the use of certain controls (Combo Box, Input List, Advanced List Box and Grid).

The maximum number of displayed records is 1000.

 

 

Local Database Setup

 

Each MCL-Designer V4 project includes one default local database with certain properties you can set up according to your needs such as name, location within the device, etc.

The setup options are available in the local database's properties window which can be accessed in the "Local Database" module:

 

Step-by-step

 

1. Open the "local Database" module.

 

 

2. Right-click the name of the local database (default name - "Project.db").

 

 

3. Select "Local Database Options".

 

 

4. Fill in the available options.

 

Local Database Options

DB Name

The local database's default name is "Project.db" but you can change it. Enter the new name in the corresponding box.

 

Do NOT use special characters and make sure the extension is still ".db" after the edition.

Notes

If necessary, add relevant information about the local database.

Location

Define the location for the local database in the target device:

 

Default - Refers to the default storage disc space for files. The local database will ONLY be accessible to the MCL application (and any background procedures).

Temp (Non-Persistent) - The application data that are stored in the local database tables are lost every time the RAM is cleaned up.

Shared - The internal storage disc space for files/local database tables that can also be shared with 3rd party applications.

External Storage - External storage disc space for files/local database tables that can ONLY be accessed by the MCL application.

External Shared - External storage disc space for files/local database tables to be shared across applications.

 

When selecting the location for the local database, consider the following:

 

The target device.

For instance, if the target device does not have a RAM partition (or an equivalent partition such as "cache disk"), the location “Temp (Non Persistent)” is NOT an option (the device will end up storing the local database files into the default folder for data files (<DATA> alias).

 

The Local Database's objective.

If the tables' content is to be managed solely by the MCL application (and its background procedures), we recommend the “Default” location. But, if you intend the data to be shared with 3rd party applications, select the “Shared” location for your local database.

 

Include in PDK

Check this option to ensure that the local database's data and structure is included in the application's PDK.

 

If the local database is encrypted (= checked "Encrypt Data" option), ONLY the local database's structure will be included in the PDK, NOT its content.

Encrypt Data

Check this option to ensure that the local database's content is encrypted and CANNOT be read/used outside the target device's environment.

 

Checking this option as well as the "Include in PDK" means that any application data that was stored in the local database will NOT be included in the PDK, ONLY the local database's structure.

 

Encryption Key

ONLY active if the "Encrypt Data" option is checked.

 

This option defines the type of key required for the data's encryption. The default option is "<Device Key>" which means that the encryption of the local database's data will be based on a key generated and provided by the MCL-Client installed in the target device. As a result, the application data stored in the tables of the local database can only be read/used within that target device.

If you download the files that represent the database from the device to an external environment such as a PC, you will not be able to read/use that data because you will NOT have access to the device's encryption key required for the data decryption.

 

 

Topics

 

This chapter covers the following topics:

 

Topic

Working with Tables

Working with Views

Working with Indexes