13.07.2015 Views

Using SQL Adapters with Ensemble - InterSystems Documentation

Using SQL Adapters with Ensemble - InterSystems Documentation

Using SQL Adapters with Ensemble - InterSystems Documentation

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Creating Adapter Methods for <strong>SQL</strong>All subsequently created statements will inherit these attributes.For example:Set ..Adapter.StatementAttrs = "QueryTimeout:10"• If the connection has already been established, call the SetConnectAttr method of the adapter.This method takes two arguments (the attribute name and the desired value) and returns a status.For example:Set tout= ..Adapter.SetConnectAttr("querytimeout",10)Note:It is your responsibility to ensure that the attributes you use are supported by the ODBCdriver for the database to which you are connecting. It is beyond the scope of the <strong>InterSystems</strong>documentation to attempt to compile any such list.The most useful places to set statement attributes are as follows:• Within a message handler method of a business operation, if you use the <strong>SQL</strong> outbound adapter.• Within the OnInit method of a business host.5.7 Managing TransactionsThe <strong>SQL</strong> adapters provide the following methods that you can use to manage formal database transactions:SetAutoCommitCommitMethod SetAutoCommit(pAutoCommit) As %Status [ CodeMode = expression ]Sets autocommit on or off for this adapter connection. This works only after the DSN connectionis established.If you want to set this at connect time, customize the OnInit method of your business serviceor operation. In your custom method, set the ConnectAttrs property.Method Commit() As %StatusCommits all database activities (<strong>with</strong>in this adapter process) since the last commit.44 <strong>Using</strong> <strong>SQL</strong> <strong>Adapters</strong> <strong>with</strong> <strong>Ensemble</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!