Application Lock Management
By default, ESQL waits indefinitely on behalf of your application for a locked database resource. However, ESQL allows your application to specify a different response when it encounters a locked resource by calling the
sqlsetlogoption()
function. Thesqlsetlogoption()
function allows you to specify your own callback function that tells ESQL what to do when it encounters a locked resource.If you supply a callback function, ESQL calls the callback function each time it encounters a resource lock and proceeds according to the value that you return from the function. Depending on the value you return, ESQL can:
For more information on how to define and use your lock management callback function, see the
sqlsetlogoption()
reference entry in ESQL-LIB Reference."NOTE: By default, ESQL waits for a locked resource rather than returning an error. So if a lock is detected and then immediately released, the application receives the record. Otherwise, if an error is always returned in record lock situations, then even when the resource becomes immediately available, the application cannot obtain it.Handling Interrupts in ESQL Large Clients
In the large client model, if you press CTRL-G during execution, the current SQL statement is aborted (if you are accessing the database) or the next SQL statement is aborted (if you are not accessing the database). You can cancel a resource lock wait during large client operation using the CTRL-G interrupt. (For information on cancelling resource lock waits during small client operation, see the "Managing Multi-user Applications" section.) In any case, ESQL detects the interrupt, rolls back any open transaction, and closes any open cursors.
NOTE: The lock callback function mechanism described in the previous section is the preferred method for handling resource lock issues.When ESQL detects the CTRL-C interrupt, it executes a function named
CAUTION: Do not define your own CTRL-C interrupt handler in place ofsqlctlc()
. The defaultsqlctlc()
function is a dummy entry point that takes no action. However, you can create your ownsqlctlc()
function to print an error message, set a global flag that you check in your program, or perform any other action that your application defines-except calling other ESQL-LIB functions. If you attempt to call other ESQL-LIB functions from withinsqlctlc()
, ESQL returns an error.sqlctlc()
. If you do specify another handler, ESQL does not roll back the current transaction and close open cursors when the interrupt occurs. However, you can add any additional interrupt handling functionality tosqlctlc()
without preventing ESQL from handling transactions and cursors appropriately.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |