User Tools

Site Tools


usingdatabaseserverbeansinscripting

This is an old revision of the document!


Scripting for Database Servers (in MIStudio and TransSECS)

Although there is a lot you can do with just using Database Servers set up in the MIStudio logic and in the Devices of TransSECS and MIStudio, using scripts that reference these beans can be a powerful tool.

These examples assume that you have already set up your database (either local or remote) and have set up the connection in your project using a generic (or specific) DatabaseConnectionManager for your database. In MIStudio you will need to be in LIVE mode (toggle from SIM → LIVE) to enable the database connection during development.

Triggering a Database Server

Database servers can be triggered in a script to run the existing SQL statement using any value, of any type, sent to the trigger() method of the bean. Be sure the SQL statement is set before triggering the bean. Use setSQLStatement() to set the SQL statement, if needed. Also make sure the server has been properly configured to use the DatabaseConnectionManager.

If the database bean is writing data to the database, the SQL Statement should include this current data to write to specific columns of the table. This can be either an UPDATE or INSERT statement. No output is generated from the bean when it is triggered. This type of bean can also use a CREATE statement.

If the database bean is reading data from the database, the output of the bean after triggering will contain a result (either a single value, array, or 2D array, depending on the bean type). The SQL statement would typically be a SELECT statement to read this data.

usingdatabaseserverbeansinscripting.1627497528.txt.gz · Last modified: by wikiadmin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki