Oracle Objects for OLE C++ Class Library Release 9.2 Part Number A95896-01 |
|
Applies To
Description
This method is called to cancel a non-blocking operation that is underway on the OSqlStmt object. Valid only if the OSqlStmt object has been created with OSQLSTMT_NONBLK option.
Usage
oresult Cancel(void) const
Arguments
none |
The application can cancel a long running asynchronous operation by calling the Cancel method on the OSqlStmt object. The Cancel method will cancel the execution that is in progress.
Return Values
An oresult indicating whether the operation succeeded (OSUCCESS) or not (OFAILURE).
Errors are thrown as exceptions.
Example
This example uses try and catch blocks.
//try block
try
{
OStartup(OSTARTUP_MULTITHREADED);
osess.Open();
odb.Open(osess, "ExampleDB", "scott", "tiger");
if ( ! odb.IsOpen() )
{
cout << "Database not opened: " << odb.GetErrorText() <<
endl;
odb.Close();
return(-1);
}
// To cancel an asynchronous execution
OSqlStmt osqlstmt(odb, ""update junk set ichar='CANCEL' where iint
100" ,OSQLSTMT_NONBLK);
if ( ret != OSQL_SUCCESS )
cout << "Error " << osqlstmt.GetErrorText() << endl;
ret = osqlstmt.NonBlockingState();
if ( ret == OSQL_STILL_EXECUTING )
{
ret = osqlstmt.Cancel();
if ( ret != OSQL_SUCCESS )
cout << "Error " << osqlstmt.GetErrorText() << endl;
else
cout << "Cancel of non-block execution succesful" <<
endl;
}
}
//catch block
catch(OException oerr)
{
cout << "Exception while executing non-blocking mode : " <<
oerr.GetErrorText() << endl;
retVal = -1;
}
Additional examples can be found in ORACLE_BASE\ORACLE_HOME\oo4o\cpp. See About Sample Code and Applications.
|
Copyright © 1998, 2002 Oracle Corporation. All Rights Reserved. |
|