home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / include / sdsstad.inl < prev    next >
Encoding:
Text File  |  1996-02-22  |  2.3 KB  |  69 lines

  1. /******************************************************************************/
  2. /* File:   sdsstad.inl                                                        */
  3. /* Class:                                                                     */
  4. /*         IDSStatementAdd                                                    */
  5. /*                                                                            */
  6. /******************************************************************************/
  7.  
  8. /***********************************************
  9.  
  10.     Licensed Materials - Property of IBM
  11.  
  12.     5622-880   5801-AAR
  13.  
  14.     (c) Copyright IBM Corp 1991, 1996.
  15.  
  16. ************************************************/
  17.  
  18. //#include "sdsstad.hpp"
  19.  
  20. /*-----------------------------------------------------------------+
  21. |  Constructor                                                     |
  22. +-----------------------------------------------------------------*/
  23. inline IDSStatementAdd::IDSStatementAdd(const char* aStatement,
  24.                            DatastoreDB2* aDatastore )
  25.           :IDSStatement(aStatement,aDatastore)
  26. {
  27.  
  28. }
  29.  
  30. inline IDSStatementAdd::IDSStatementAdd(const char* aStatement,
  31.                            DatastoreODBC* aDatastore )
  32.           :IDSStatement(aStatement,aDatastore)
  33. {
  34.  
  35. }
  36.  
  37. /*-----------------------------------------------------------------+
  38. |  Destructor                                                      |
  39. +-----------------------------------------------------------------*/
  40. inline IDSStatementAdd::~IDSStatementAdd()
  41. {
  42.  
  43. }
  44.  
  45. inline IDSStatementAdd&
  46. IDSStatementAdd::execute()
  47. {
  48.     parameterBuffers.bindToStatement( iSQLStatement );
  49.     iSQLStatement->executeDirect(iStatement);
  50.     switch (iSQLStatement->rowCount()) {
  51.       case 0:
  52.         {
  53.           IString strError = ClsEnv::daxMsg(DAX_MSG_OBJECT_NOT_FOUND_OR_NOT_INSERTED);
  54.           IDADataObjectNotFound exc(strError,DAX_MSG_OBJECT_NOT_FOUND_OR_NOT_INSERTED,IException::recoverable);
  55.           ITHROW (exc);
  56.         }
  57.       case 1:
  58.         break;  // OK
  59.       default:
  60.       {
  61.           //iSQLStatement->rollback();
  62.           IString strError = ClsEnv::daxMsg(DAX_MSG_OBJECT_NOT_UNIQUE);
  63.           IDADataObjectInvalid exc(strError,DAX_MSG_OBJECT_NOT_UNIQUE,IException::recoverable);
  64.           ITHROW (exc);
  65.       }
  66.     }
  67.     return *this;
  68. }
  69.