home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / carsql.zip / README < prev    next >
Text File  |  1995-12-21  |  4KB  |  95 lines

  1. NAME: CARSQL
  2.  
  3. COPYRIGHT:                                                                           
  4. ----------                                                                           
  5. Copyright (C) International Business Machines Corp., 1991,1995.                      
  6.                                                                                      
  7. DISCLAIMER OF WARRANTIES:                                                            
  8. -------------------------                                                            
  9. The following [enclosed] code is sample code created by IBM                          
  10. Corporation.  This sample code is not part of any standard IBM product               
  11. and is provided to you solely for the purpose of assisting you in the                
  12. development of your applications.  The code is provided "AS IS",                     
  13. without warranty of any kind.  IBM shall not be liable for any damages               
  14. arising out of your use of the sample code, even if they have been                   
  15. advised of the possibility of such damages.                                          
  16.  
  17.  
  18. DESCRIPTION:
  19.  
  20. This sample illustrates how to catch the exception from DAX
  21. (Data Access Class) object's 4 standard methods (add(), delete(),
  22. update(), and retrieve()), and extract the SQLCODE from the exception
  23. object (IDSAccessError).
  24.  
  25. The sample consists of 2 VB part:
  26.     - CarView visual part which displays a car record and interfaces with
  27.       the user
  28.     - AccessError non-visual which is used to catch the IDSAccessError
  29.       exception and extract the SQLCODE from the exception object.
  30.       For more info on the AccessError part, refer to the part features.
  31.  
  32. Note:
  33.  
  34.   - DAX throws an IDSAccessError exception for the above methods
  35.     only if the SQLCODE is < 0 or = 100.
  36.  
  37.   - The AccessError part does not extract other information in the
  38.      SQLCA structure other than the SQLCODE and the ErrorText.
  39.      You can define the attributes for other information,
  40.      and add code in the AccessError::obtainSqlcode() method to extract them.
  41.  
  42. How to run the sample application:
  43.  
  44.   - The sample program will not run if you don't have DB2/2 1.2 or above
  45.      installed on your machine.  If you have DB2/2 2.1 installed, you need
  46.     to apply CTV30x csd for the DAX and VB components.
  47.  
  48.   - Build the car database : invoke DAXSAMP.CMD from
  49.      x:\ibmcpp\samples\database\car\daxsamp directory.
  50.  
  51.     If you see "sysSeachPath" error after invoke the above CMD,
  52.    add the following lines at the top of the CMD file:
  53.  
  54.     Call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs';
  55.    Call SysLoadFuncs;
  56.  
  57.   - Now you're ready to try it out, i.e enter carview from the command line,
  58.     assuming you're in the directory where the carview.exe resides.
  59.  
  60. How to catch the exception using the AccessError non-visual part
  61. in a visual part:
  62.  
  63.   - Drop the AccessError part to the free-form-surface of the
  64.     composition editor of your visual part.
  65.  
  66.   - Assume that you have a visual part looks similiar to the sample carview
  67.     visual part. (it is not bad idea to load up the VB, and open up the carview
  68.     part now)
  69.  
  70.   - To catch the exception, make the following connections:
  71.      ( assuming that the user clicks on the add_push_button to invoke the add()
  72.        method )
  73.  
  74.     PushButton(ButtonClickedEvent) -> DAXTable(resetSqlcode)      conn1
  75.     PushButton(ButtonClickedEvent) -> DAXTable(add)                   conn2
  76.     conn2                                      -> AccessError(obtainSqlcode)
  77.     PushButton(ButtonClickedEvent) -> DAXTable(checkSqlcode)
  78.  
  79.     Note: the checkSqlcode() will send the following events: 
  80.                   Sqlcode_0 event if sqlcode =0
  81.                   Sqlcode_100 event if sqlcode =100
  82.                   Sqlcode_lt0 event if sqlcode <0
  83.                   SqlcodeEvent if sqlcode = 100 or < 0
  84.  
  85.            From these events, you can choose an appropriate event and connect it
  86.            to a method from other part to request a service, for example,
  87.            you may want to connect AccessError(sqlcode_0) to IDatastore(commit),
  88.            i.e call the commit method if a record is added successfully.
  89.  
  90.  
  91. FeedBack:
  92.   
  93.   - Any feedback or question, drop a message  to BLUC@VNET.IBM.COM.
  94.  
  95.