home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / carsql.zip / accerr.cpv next >
Text File  |  1995-12-21  |  3KB  |  91 lines

  1. // Feature source code generation begins here...
  2. INotificationId accessError::sqlcodeId = "accessError::sqlcode";
  3. INotificationId accessError::errorTextId = "accessError::errorText";
  4. INotificationId accessError::sqlcode_100Id = "accessError::sqlcode_100";
  5. INotificationId accessError::sqlcode_0Id = "accessError::sqlcode_0";
  6. INotificationId accessError::sqlcode_lt0Id = "accessError::sqlcode_lt0";
  7. INotificationId accessError::sqlcodeEventId = "accessError::sqlcodeEvent";
  8.  
  9. long accessError::sqlcode() const
  10. {
  11.   return iSqlcode;
  12. }
  13.  
  14. accessError& accessError::setSqlcode(long aSqlcode)
  15. {
  16.   if (!(iSqlcode == aSqlcode))
  17.   {
  18.     iSqlcode = aSqlcode;
  19.     notifyObservers(INotificationEvent(accessError::sqlcodeId, *this));
  20.   } // endif
  21.   return *this;
  22. }
  23.  
  24. IString accessError::errorText() const
  25. {
  26.   return iErrorText;
  27. }
  28.  
  29. accessError& accessError::setErrorText(const IString& aErrorText)
  30. {
  31.   if (!(iErrorText == aErrorText))
  32.   {
  33.     iErrorText = aErrorText;
  34.     notifyObservers(INotificationEvent(accessError::errorTextId, *this));
  35.   } // endif
  36.   return *this;
  37. }
  38.  
  39. accessError& accessError::resetSqlcode()
  40. {
  41.   iSqlcode = 0 ;            //added code
  42.   iErrorText = NULL;      //added code
  43.   return *this;
  44. }
  45.  
  46. accessError& accessError::obtainSqlcode(const IException& exception)
  47. {
  48.   // added code starts here
  49.  
  50.     IDSAccessError * accerrp;
  51.     accerrp = (IDSAccessError *) & exception;          //IDSAccessError is a derived class of IException.
  52.                                                        //In this case it is ok to cast the IException object
  53.                                                        //back to the original IDSAccessError object, because
  54.                                                        //the VB codegen casts IDSAccessError to IException object
  55.                                                        //if you catch the exception in VB.
  56.  
  57.     setSqlcode( accerrp->getSqlca().sqlcode );
  58.     setErrorText(accerrp->text());
  59.   // added code ends here
  60.  
  61.   return *this;
  62. }
  63.  
  64. // Feature source code generation ends here.
  65.  
  66.  
  67. // Feature source code generation begins here...
  68.  
  69. void accessError::checkSqlcode()
  70. {
  71.      // added code starts here
  72.  
  73.     if (iSqlcode == 0)
  74.        notifyObservers(INotificationEvent(accessError::sqlcode_0Id, *this));
  75.     else if (iSqlcode == 100)
  76.     {
  77.        notifyObservers(INotificationEvent(accessError::sqlcode_100Id, *this));
  78.        notifyObservers(INotificationEvent(accessError::sqlcodeEventId, *this));
  79.      }
  80.     else if (iSqlcode < 0)
  81.      {
  82.         notifyObservers(INotificationEvent(accessError::sqlcode_lt0Id, *this));
  83.         notifyObservers(INotificationEvent(accessError::sqlcodeEventId, *this));
  84.      }
  85.  
  86.      // added code ends here
  87.   return ;
  88. }
  89.  
  90. // Feature source code generation ends here.
  91.