Skip Headers
Oracle® Objects for OLE C++ Class Library Developer's Guide
10g Release 2 (10.2)

Part Number B14308-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

NonBlockingState

Applies To

OSqlStmt

Description

This method is called to determine if SQL execution is still pending on this object.

Valid only if the OSqlStmt object has been created with OSQLSTMT_NONBLK option.

Usage

long NonBlockState(void) const

Arguments

none

Remarks

OSqlStmt created with OSQLSTMT_NONBLK option provides the ability to execute SQL statements and PL/SQL blocks in non-blocking mode. In the non-blocking mode, control is returned to the application immediately even if the execution is not complete. This allows the application to execute other tasks which are not dependent on the results of the last execution. The application can determine the status of the asynchronous execution by polling on NonBlockingState.

Return Values

OSQL_STILL_EXECUTING indicates that the execution is still in progress.

OSQL_SUCCESS indicates that the execution completed successfully.

Any errors are thrown as exceptions.

The application should poll till the execution completes with OSQL_SUCCESS or until the call results in an exception.

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);

}

// Set up a sql statement to execute in Non-Blocking mode

OSqlStmt osqlstmt(odb, "update junk set ichar='AGAIN' where iint >

100 ",OSQLSTMT_NONBLK);

long ret = OSQL_STILL_EXECUTING;

while ( ret == OSQL_STILL_EXECUTING )

{

ret = osqlstmt.NonBlockingState();

}

cout << "Statement executed succesfully in non-block mode"<< endl;

}

//catch block

catch(OException oerr)

{

cout << "Exception while executing in 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.