Document metadata

Application name

CSK_Module_Database

Version

0.1.0

Date

2023-12-13

Author

SICK AG

Crowns

CSK_Database

Short description

Module to log data wihtin a SQLite database.
This can be useful to create relations between different data and to filter for specific data entries.
Typically the feature of this module is used like this (check also main script of this module):

1) Setup
- Set database name and storing location via 'setDatabaseName' / 'setDatabaseLocation'.
- Predefine table columns via 'setColumnsInfo'.
- Now create new database via 'createDatabase'.
- Set an event to receive data to store within the database. (event should provide as much parameters as table columns were defined).

2) Usage
Predefine a query via 'setQuery' and call it via 'callQuery'.

Functions

CSK_Database.callQuery()
Short description

Call SQL query.

Parameters
Name Type Multiplicity Description

query

STRING

?

Optional query. If not set, preset query will be used (see 'setQuery').

Return values
Name Type Multiplicity Description

queryResult

AUTO

*

Result of SQL query

Sample (auto-generated)
queryResult = CSK_Database.callQuery(query)
CSK_Database.createDatabase()
Short description

Function to create new database based on preset database name and location.

Return values
Name Type Multiplicity Description

success

BOOL

1

Success

Sample (auto-generated)
success = CSK_Database.createDatabase()
CSK_Database.deleteDataViaUI()
Short description

Function to delete selected data via UI.

Sample (auto-generated)
CSK_Database.deleteDataViaUI()
CSK_Database.loadDatabase()
Short description

Function to load existing database.

Sample (auto-generated)
CSK_Database.loadDatabase()
CSK_Database.loadParameters()
Short description

Load parameters for this module from the CSK_PersistentData module if possible and use them.

Sample (auto-generated)
CSK_Database.loadParameters()
CSK_Database.pageCalled()
Short description

Function to register "OnResume" of the module UI (only as helper function).

Return values
Name Type Multiplicity Description

empty

STRING

1

Empty string (only needed to simplify binding).

Sample (auto-generated)
empty = CSK_Database.pageCalled()
CSK_Database.selectEntryViaUI()
Short description

Function to select entry out of UI table.

Parameters
Name Type Multiplicity Description

selection

STRING

1

Selection

Sample (auto-generated)
CSK_Database.selectEntryViaUI(selection)
CSK_Database.sendParameters()
Short description

Send parameters to CSK_PersistentData module if possible to save them.

Sample (auto-generated)
CSK_Database.sendParameters()
CSK_Database.setColumnsInfo()
Short description

Function to preset columns of database to create.

Parameters
Name Type Multiplicity Description

columnDefinition

STRING

1

Column name and type definition like e.g. 'Event text, MetaDataLocation text,ImageLocation text'.

Sample (auto-generated)
CSK_Database.setColumnsInfo(columnDefinition)
CSK_Database.setDatabaseLocation()
Short description

Function to set location path of database.

Parameters
Name Type Multiplicity Description

path

STRING

1

Path to database

Sample (auto-generated)
CSK_Database.setDatabaseLocation(path)
CSK_Database.setDatabaseName()
Short description

Function to set name of database

Parameters
Name Type Multiplicity Description

name

STRING

1

Name of database

Sample (auto-generated)
CSK_Database.setDatabaseName(name)
CSK_Database.setLoadOnReboot()
Short description

Configure if this module should load its saved parameters at app/device boot up.

Parameters
Name Type Multiplicity Description

status

BOOL

1

Status

Sample (auto-generated)
CSK_Database.setLoadOnReboot(status)
CSK_Database.setParameterName()
Short description

Function to set the name of the parameters if saved/loaded via the CSK_PersistentData module.

Parameters
Name Type Multiplicity Description

name

STRING

1

Name of the parameter.

Sample (auto-generated)
CSK_Database.setParameterName(name)
CSK_Database.setQuery()
Short description

Function to set SQL query.

Parameters
Name Type Multiplicity Description

query

STRING

1

SQL query to call.

Sample (auto-generated)
CSK_Database.setQuery(query)
CSK_Database.setRegisteredEvent()
Short description

Functio to register to event to receive data for database.

Parameters
Name Type Multiplicity Description

eventName

STRING

1

Name of event.

Sample (auto-generated)
CSK_Database.setRegisteredEvent(eventName)

Events

CSK_Database.OnDataLoadedOnReboot
Short description

Event to call if module tried to load parameters and should be ready.

Sample (auto-generated)
function handleOnDataLoadedOnReboot()
  -- Do something
end

Script.register("CSK_Database.OnDataLoadedOnReboot", "handleOnDataLoadedOnReboot")
CSK_Database.OnNewParameterName
Short description

Notify name of persistent data parameter.

Callback arguments
Name Type Multiplicity Description

name

STRING

1

Parameter name

Sample (auto-generated)
function handleOnNewParameterName(name)
  -- Do something
end

Script.register("CSK_Database.OnNewParameterName", "handleOnNewParameterName")
CSK_Database.OnNewStatusActiveDatabaseName
Short description

Notify name of currently active database.

Callback arguments
Name Type Multiplicity Description

name

STRING

1

Name of database.

Sample (auto-generated)
function handleOnNewStatusActiveDatabaseName(name)
  -- Do something
end

Script.register("CSK_Database.OnNewStatusActiveDatabaseName", "handleOnNewStatusActiveDatabaseName")
CSK_Database.OnNewStatusColumnList
Short description

Notify current list of columns.

Callback arguments
Name Type Multiplicity Description

list

STRING

1

List of columns

Sample (auto-generated)
function handleOnNewStatusColumnList(list)
  -- Do something
end

Script.register("CSK_Database.OnNewStatusColumnList", "handleOnNewStatusColumnList")
CSK_Database.OnNewStatusDatabaseLocation
Short description

Notify location path of database.

Callback arguments
Name Type Multiplicity Description

path

STRING

1

Path to database

Sample (auto-generated)
function handleOnNewStatusDatabaseLocation(path)
  -- Do something
end

Script.register("CSK_Database.OnNewStatusDatabaseLocation", "handleOnNewStatusDatabaseLocation")
CSK_Database.OnNewStatusDatabaseName
Short description

Notify name of database.

Callback arguments
Name Type Multiplicity Description

name

STRING

1

Name of database

Sample (auto-generated)
function handleOnNewStatusDatabaseName(name)
  -- Do something
end

Script.register("CSK_Database.OnNewStatusDatabaseName", "handleOnNewStatusDatabaseName")
CSK_Database.OnNewStatusDataSelection
Short description

Notify selected database entry.

Callback arguments
Name Type Multiplicity Description

selection

STRING

1

Data of selection

Sample (auto-generated)
function handleOnNewStatusDataSelection(selection)
  -- Do something
end

Script.register("CSK_Database.OnNewStatusDataSelection", "handleOnNewStatusDataSelection")
CSK_Database.OnNewStatusLoadParameterOnReboot
Short description

Notify status if parameters should be loaded on app/device boot up.

Callback arguments
Name Type Multiplicity Description

status

BOOL

1

Status

Sample (auto-generated)
function handleOnNewStatusLoadParameterOnReboot(status)
  -- Do something
end

Script.register("CSK_Database.OnNewStatusLoadParameterOnReboot", "handleOnNewStatusLoadParameterOnReboot")
CSK_Database.OnNewStatusQuery
Short description

Notify current SQL query.

Callback arguments
Name Type Multiplicity Description

query

STRING

1

SQL query

Sample (auto-generated)
function handleOnNewStatusQuery(query)
  -- Do something
end

Script.register("CSK_Database.OnNewStatusQuery", "handleOnNewStatusQuery")
CSK_Database.OnNewStatusRegisteredEvent
Short description

Notify registered event to receive new data.

Callback arguments
Name Type Multiplicity Description

event

STRING

1

Name of event

Sample (auto-generated)
function handleOnNewStatusRegisteredEvent(event)
  -- Do something
end

Script.register("CSK_Database.OnNewStatusRegisteredEvent", "handleOnNewStatusRegisteredEvent")
CSK_Database.OnNewTableContent
Short description

Notify content for dynamic table in UI

Callback arguments
Name Type Multiplicity Description

content

STRING

1

Result content of SQL query.

Sample (auto-generated)
function handleOnNewTableContent(content)
  -- Do something
end

Script.register("CSK_Database.OnNewTableContent", "handleOnNewTableContent")
CSK_Database.OnPersistentDataModuleAvailable
Short description

Notify status if features of CSK_PersistendData module are available.

Callback arguments
Name Type Multiplicity Description

status

BOOL

1

Status

Sample (auto-generated)
function handleOnPersistentDataModuleAvailable(status)
  -- Do something
end

Script.register("CSK_Database.OnPersistentDataModuleAvailable", "handleOnPersistentDataModuleAvailable")
CSK_Database.OnUserLevelAdminActive
Short description

Status of Admin userlevel. Used internally in combination with the CSK_UserManagement module if available.

Callback arguments
Name Type Multiplicity Description

status

BOOL

1

Status

Sample (auto-generated)
function handleOnUserLevelAdminActive(status)
  -- Do something
end

Script.register("CSK_Database.OnUserLevelAdminActive", "handleOnUserLevelAdminActive")
CSK_Database.OnUserLevelMaintenanceActive
Short description

Status of Maintenance userlevel. Used internally in combination with the CSK_UserManagement module if available.

Callback arguments
Name Type Multiplicity Description

status

BOOL

1

Status

Sample (auto-generated)
function handleOnUserLevelMaintenanceActive(status)
  -- Do something
end

Script.register("CSK_Database.OnUserLevelMaintenanceActive", "handleOnUserLevelMaintenanceActive")
CSK_Database.OnUserLevelOperatorActive
Short description

Status of Operator userlevel. Used internally in combination with the CSK_UserManagement module if available.

Callback arguments
Name Type Multiplicity Description

status

BOOL

1

Status

Sample (auto-generated)
function handleOnUserLevelOperatorActive(status)
  -- Do something
end

Script.register("CSK_Database.OnUserLevelOperatorActive", "handleOnUserLevelOperatorActive")
CSK_Database.OnUserLevelServiceActive
Short description

Status of Service userlevel. Used internally in combination with the CSK_UserManagement module if available.

Callback arguments
Name Type Multiplicity Description

status

BOOL

1

Status

Sample (auto-generated)
function handleOnUserLevelServiceActive(status)
  -- Do something
end

Script.register("CSK_Database.OnUserLevelServiceActive", "handleOnUserLevelServiceActive")

CSK_Module_Database

Short description

This is an automatically generated CROWN (description not necessary).

Overview