From OpenSCADAWiki
Jump to: navigation, search

OpenSCADA interface to process the requests to the DB is presented by the objects and virtual functions of the calls from the OpenSCADA core:

  • TTypeBD->TModule — The root module's object of the "DB" subsystem:
    • TBD *openBD( const string &id ); — It is called when you open or create by this module a new database object with id identifier.
  • TBD — The database object:
    • void enable( ); — Enabling of the database.
    • void disable( ); — Disabling of the database.
    • void load_( ); — Loading a database from a shared configuration storage.
    • void save_( ); — Saving the database in a shared configuration storage.
    • void allowList( vector<string> &list ); — Request the tables' list list in the database.
    • void sqlReq( const string &req, vector< vector<string> > *tbl = NULL, char intoTrans = EVAL_BOOL ); — Handling of the req SQL-query to the database and receiving the results in the tbl table, if the selection request and the pointer are nonzero. When you set intoTrans to "true" a transaction must be opened for the request; to "false" - must be closed. This function should be implemented for a databases that support SQL-queries.
    • void transCloseCheck( ); — The periodically called function to check the transactions and closing the old or contain many requests ones.
    • TTable *openTable( const string &table, bool create ); — It is called when you open or create a new table's object.
  • TTable — Table's object in the database:
    • void fieldStruct( TConfig &cfg ); — Getting the current structure of the table in the TConfig object.
    • bool fieldSeek( int row, TConfig &cfg, vector< vector<string> > *full = NULL ); — Sequential scan of the table entries using the row exhaustive search and "false" return at the end with the addressing by the active, keyUse(), key fields. full defines before the request for preloading full reply with extracting next entries from here.
    • void fieldGet( TConfig &cfg ); — Request of the specified in the TConfig object record with the addressing by key fields.
    • void fieldSet( TConfig &cfg ); — Transfer of the specified in the TConfig object record with the addressing by key fields.
    • void fieldDel( TConfig &cfg ); — Deleting of the specified in the TConfig object record with the addressing by key fields.