Qorus Integration Engine® Enterprise Edition 6.0.25_prod
Loading...
Searching...
No Matches
OMQ::DbRemote Class Reference

A high level API for remote system.sqlutil service calls. More...

Inheritance diagram for OMQ::DbRemote:
[legend]
Collaboration diagram for OMQ::DbRemote:
[legend]

Public Member Methods

 constructor (string remote, string dsname, *hash< auto > opts)
 constructor taking a string giving the name of the remote connection for the remote server More...
 
 constructor (QorusSystemRestHelper remote, string dsname, *hash< auto > opts)
 constructor taking an OMQ::QorusSystemRestHelper object for the remote connection More...
 
auto methodGate (string method)
 Redirects the method to the remote service and prepends the datasource name to the arguments in the remote call.
 
- Public Member Methods inherited from OMQ::DbRemoteBase
 constructor (string remote, string dsname, *hash< auto > opts)
 constructor taking a string giving the name of the remote connection for the remote server More...
 
 constructor (QorusSystemRestHelper remote, string dsname, *hash< auto > opts)
 constructor taking an OMQ::QorusSystemRestHelper object for the remote connection More...
 
 destructor ()
 Just check if the transaction finished correctly.
 
 beginTransaction ()
 starts or continues a remote transaction More...
 
string datasourceName ()
 returns the remote datasource name specified in constructor
 
OMQ::StreamConfig config ()
 returns the configuration object
 
bool inTransaction ()
 Returns True if a remote transaction is in progress. More...
 
 commit ()
 commits a remote transaction
 
 rollback (bool action=AbstractParallelStream::DO_DISCONNECT)
 Rollback remote transaction. More...
 
 disconnect ()
 Disconnects the connection.
 
auto methodGateArgs (string method, *list< auto > args)
 Redirects the method to the remote service and prepends the datasource name to the arguments in the remote call.
 
auto methodGate (string method)
 Redirects the method to the remote service and prepends the datasource name to the arguments in the remote call.
 

Detailed Description

A high level API for remote system.sqlutil service calls.

DbRemote is identical to DbRemoteBase except that it automatically wraps all actions in a transaction by calling beginTransaction() in the constructor.

DbRemote provides a high level API for the system.sqlutil service in remote Qorus instances. Use it for single updates, deletes, inserts, and/or schema management.

DbRemote wraps all available system.sqlutil service methods with the following changes in service methods API:

  • the datasource argument is passed to OMQ::DbRemote::constructor() and it's not used in method calls
  • the transaction is started when the DbRemote object is constructed and must be committed or rolled back explicitly.
Warning
Use OMQ::DbRemoteSend and OMQ::DbRemoteReceive for inserting and fetching large amount of data. These classes are optimized for high volume data. Any use of e.g. DbRemote::select() will store all resulting data in the memory and it will be transferred in a single call.

DbRemote API calls

This class does not have any of its own methods; all method calls are redirected to system.sqlutil transparently.

In case of e.g. system.sqlutil.update with prototype:

int sqlutil.update(string ds, string table, hash<auto> set, *hash<auto> cond)

The DbRemote::update() version of an update call looks like this:

int DbRemote::update(string table, hash<auto> set, *hash<auto> cond) {}
Example of usage
%new-style
%requires QorusClientCore
QorusClient::init2();
DbRemote db("msepl-it", "omquser");
on_success db.commit();
on_error db.rollback();
auto r = db.select("H3G_IT_SHIPPED_ITEMS");
printf("%N\n", r);
r = db.list_tables();
printf("%N\n", r);
r = db.insert("op_in_test", ("id" : 11));
printf("%N\n", r);

Member Function Documentation

◆ constructor() [1/2]

OMQ::DbRemote::constructor ( QorusSystemRestHelper  remote,
string  dsname,
*hash< auto >  opts 
)

constructor taking an OMQ::QorusSystemRestHelper object for the remote connection

Parameters
remotean OMQ::QorusSystemRestHelper object
dsnamea string with name of the remote datasource to use
optsoptional Streaming API Constructor Options as follows:
  • "timeout": an HTTP socket timeout value in milliseconds; used locally and in the remote for socket I/O and queue operations; default value: 5m
  • "loglevel": a default log level option for logging; see Log Levels for valid value
  • "no_remote_timeout": if True the "timeout" option will not be sent to the remote

Automatically starts a remote transaction by calling beginTransaction().

Note
the explicit or default timeout value here overrides any socket I/O timeout set for the remote connection object

◆ constructor() [2/2]

OMQ::DbRemote::constructor ( string  remote,
string  dsname,
*hash< auto >  opts 
)

constructor taking a string giving the name of the remote connection for the remote server

Parameters
remotea string giving the name of the remote connection for the remote server
dsnamea string with name of the remote datasource to use
optsoptional Streaming API Constructor Options as follows:
  • "timeout": an HTTP socket timeout value in milliseconds; used locally and in the remote for socket I/O and queue operations; default value: 5m
  • "loglevel": a default log level option for logging; see Log Levels for valid value
  • "no_remote_timeout": if True the "timeout" option will not be sent to the remote

Automatically starts a remote transaction by calling beginTransaction().

Note
the explicit or default timeout value here overrides any socket I/O timeout set for the remote connection object

The documentation for this class was generated from the following file: