13.01.2013 Views

OpenEdge Data Management: DataServer for Microsoft SQL Server

OpenEdge Data Management: DataServer for Microsoft SQL Server

OpenEdge Data Management: DataServer for Microsoft SQL Server

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.

Additional record locking details<br />

<strong>Data</strong> source record locking<br />

In MS <strong>SQL</strong> <strong>Server</strong>, if transactions are scoped within other transactions, nested or embedded, all<br />

commit/rollback operations on the nested transactions are ignored by <strong>SQL</strong> server. Not until the<br />

transaction nesting levels are reduced to zero are all the nested levels actually committed or<br />

rolled back. This is a restriction of the data source with ramifications illustrated by the following<br />

code:<br />

DO TRANSACTION:<br />

RUN STORED-PROC SP.<br />

CLOSE STORED-PROC SP.<br />

UPDATE record 2.<br />

ASSIGN fld2 = X.<br />

END.<br />

If the stored procedure SP has a commit or rollback statement within its T<strong>SQL</strong>, the commit or<br />

rollback isn’t actually executed until the END statement in ABL, when the transaction level<br />

returns to zero. If record 2 is also updated by SP, then record 2 will be locked out to an ABL<br />

transaction that’s also trying to update it. SP will continue to hold record 2 and lock out an ABL<br />

update even if SP explicitly commits the update inside the stored procedure. To avoid this<br />

problem, it is necessary to recode the example as follows:<br />

DO TRANSACTION:<br />

RUN STORED-PROC SP.<br />

CLOSE STORED-PROC SP.<br />

END.<br />

DO TRANSACTION:<br />

UPDATE Record 2.<br />

ASSIGN fld2 = X.<br />

END.<br />

NO–LOCK<br />

The <strong>Data</strong><strong>Server</strong> can emulate the <strong>OpenEdge</strong> NO–LOCK behavior if the isolation level is set to read<br />

uncommitted at connection time and you specify the NO–LOCK syntax in your ABL statement.<br />

Locking impact on queries<br />

The <strong>Data</strong><strong>Server</strong> processes query statements marked with SHARE-LOCK and EXCLUSIVE-LOCK<br />

queries very differently from NO-LOCK queries.<br />

Note: There is an exception to the previous statement; queries marked SHARE-LOCK when the<br />

record isolation level is read uncommitted are treated like a NO-LOCK.<br />

2–39

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

Saved successfully!

Ooh no, something went wrong!