Oracle® Objects for OLE C++ Class Library Developer's Guide 10g Release 2 (10.2) Part Number B14308-01 |
|
Applies To
Description
This method retrieves the last error that occurred when processing a changed message.
Usage
oboolean GetChangedError(long *serr, long *cerr) const
Arguments
Arguments |
Description |
---|---|
serr |
Pointer to variable to set to the server error. |
cerr |
Pointer to variable to set to the class library error. |
When an OBound subclass instance notifies its OBinder instance that it has changed its value (by calling OBound::Changed) the OBinder will call StartEdit on its dynaset. This may fail for a variety of reasons. The most common are that another user has a lock on the row, or the current user doesn't have permission to edit the row, or that the data in the database has changed. If the StartEdit call fails OBinder will call OnChangedError to save the error information. That error information can then be retrieved later by calling GetChangedError.
A separate routine is needed to check for errors because the changed message is normally sent to the OBinder by some indirect process, such as assignment to a variable or a keystroke to a user-interface widget, that does not allow a success return value to be passed up to client code.
Return Value
TRUE if there was an error, FALSE if there was not.
Example
This example sets up a managed dynaset (OBinder) and shows changed error handling.
// construct the OBinder OBinder empblock; // here we have several OBoundVal objects (see the Workbook) OBoundVal salary; OBoundVal ename; // bind the OBoundVal objects to the OBinder salary.BindToBinder(&empblock, "sal"); ename.BindToBinder(&empblock, "ename"); // now open the OBinder ODatabase odb("ExampleDB", "scott", "tiger"); // open the database empblock.Open(odb, "select * from emp order by ename"); /* At this point the OBinder and OBound subclass instances are all set up. The first record of the dynaset is current. Now we can try to change a value. salary = 3499.99; /* That tried to initiate a database change. Note that there was no return value for us to check for success. We need to call GetChangedError to find out if that worked. long servererr; long classerr; if (empblock.GetChangedError(&servererr, &classerr)) { // error processing here }