Tcl API

This table describes the Tcl API commands:

Command Description Parameters Returns
smatdbopen Creates or opens a SMAT database named SmatdbName. smatdbName ?-e msgEncoding?
  • smatdbName: SMAT database name
  • msgEncoding: Message content encoding
SMAT database handle

matdbName can be an absolute or relative path. This is consistent with NetConfig.

A duplicate smatdbName can be opened at the TPS of any thread or process of a site. This gives the option to save all into one, for example, saving all the messages into one database in the exec directory.

If -e msgEncoding is specified, then the API uses this encoding to open smatdb and search the message content. If not specified, then it uses UTF-8 as the default, or uses the one in NetConfig that is based on the context.

smatdbinsert Stores a message into the SMAT database. smatdbHandle msgID ?saveContext?
  • smatdbHandle: SMAT database handle
  • msgID: Message object handle
  • saveContext: User-specified context. This is optional. The default is tps context .
Error code. 0 indicates insert success; otherwise, failure.

saveContext is similar to a tag that can be used to identify the type/context of data being saved. It can be used for resending mapping and is saved into the SMAT database as metadata SaveContext.

It cannot be inbound or outbound. If inbound or outbound is used, then the default tps context is used.

For the default tps context, see Default saveContext for each TPS.

For external script, default context is empty.

When an error code is returned, there are two ways to find the error detail. You can view the engine log, or locate detail according to the error code, since the return code stays consistent with the sqlite error return.

If attempting to insert a message into the traditional IB/OB SMAT database, then an error is reported.

If tracing is supported, then this function also inserts the record there.

smatdbcount Gets the message total count that meets the search condition.

smatdbHandle ?searchCondition?

smatdbHandle: The SMAT database handle.

searchCondition: The SQL where condition for doing the search.

Message count. 1 means failure.

If searchCondition is not specified, then this returns the total count of messages in the SMAT database.

smatdbsearch Gets messages from the SMAT database.

smatdbHandle ?searchCondition? ?columnBitMask?

smatdbHandle: The SMAT database handle

searchCondition: The SQL where condition for doing the search.

columnBitMask: The columns to search. The default is all columns. This must start with 0x.

Message object handle list.

If no search-related parameters are specified, then this returns all the messages in the SMAT database.

The table name of the SMAT database is smat_msgs. For SMATDB column definitions, see Table smat_msgs definition.

For information on how to define columnBitMask, see SMAT database columns.

If a column is not searched, then its value is empty.

smatdbdelete Deletes messages from the SMAT database. smatdbHandle ?deleteCondition?

smatdbHandle: SMAT database handle

deleteCondition: The SQL where condition for doing the delete.

Message number deleted. -1 means failure.

If no optional parameters are specified, then all the messages are deleted in the SMAT database.

If attempting to delete a message from the traditional IB/OB SMAT database, then an error is reported.

smatdbcycle Cycles the SMAT database. smatdbHandle

smatdbHandle: SMAT database DB handle

0 indicates cycle success; otherwise, failure.
smatdbclose Closes a SMAT database. smatdbHandle

smatdbHandle: SMAT database handle

Error code. 0 indicates close success; otherwise, failure.

The SMAT database handle must be removed when the SMAT database is closed.