home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / database / informix / 1604 < prev    next >
Encoding:
Internet Message Format  |  1992-07-23  |  2.0 KB

  1. Path: sparky!uunet!wupost!emory!emory.mathcs.emory.edu
  2. From: widener!obelix.informix.com!johnl@emory.mathcs.emory.edu (Jonathan Leffler)
  3. Newsgroups: comp.databases.informix
  4. Subject: Re:  Is there a return code from isql?
  5. Message-ID: <9225@emory.mathcs.emory.edu>
  6. Date: 24 Jul 92 09:34:12 GMT
  7. Sender: walt@mathcs.emory.edu
  8. Reply-To: widener!obelix.informix.com!johnl@emory.mathcs.emory.edu (Jonathan Leffler)
  9. Lines: 51
  10. X-Informix-List-ID: <list.1338>
  11.  
  12. Dear Judy,
  13.  
  14. Seems to be your lucky day -- two answers for two questions!
  15. There again, maybe you'd prefer not to have this answer.
  16.  
  17. >From: uunet!col.hp.com!judym (Judy Miller)
  18. >Subject: Is there a return code from isql?
  19. >Date: 23 Jul 92 17:04:18 GMT
  20. >X-Informix-List-Id: <news.1575>
  21. >
  22. >If I execute isql from a script, how can I test if it bombed?
  23. >--------------------------
  24. >$IFXDIR/isql -s <<-EOF
  25. >   database aspdb;
  26. >   delete from productdesc;
  27. >   typo to make it bomb
  28. >   load from "$ORBDIR/orb7050d" insert into productdesc;
  29. >EOF
  30. >
  31. >if [ $? -ne 0 ]; then
  32. >   echo $?
  33. >else
  34. >   echo "OK"
  35. >fi
  36. >--------------------------
  37. >I'd like to test if it failed, but the following doesn't work since $? is 0.
  38. >I assume there must be something else I can test.
  39.  
  40. You assume, I fear, in error.  There is, in my experience, no reliable way
  41. of dealing with erros.  So much so that I've given up using isql in this
  42. mode many, many moons ago, and I use my own ESQL/C program instead.  Your
  43. test script doesn't reveal the full extent of the problem:
  44.  
  45. isql - - <<!
  46. database aspdb;
  47. begin work;
  48. insert into table01 values (1, 2, 3)
  49. insert onto table02 values (1, "abracadabra", "ambidextrous");
  50. insert onto table02 values (1, "elementary", "sub-atomic physics");
  51. commit work;
  52. !
  53.  
  54. Since there is a typo (the "onto"), the second and third insert statements
  55. will fail, but the commit will occur and work!  Ouch!  If you're really
  56. interested, I could probably send you the program I use instead.
  57.  
  58. Yours,
  59. Jonathan Leffler (johnl@obelix.informix.com) #include <disclaimer.h>
  60.  
  61. PS: I assume $IFXDIR is a local synonym for $INFORMIXDIR?  Not that it
  62. matters.
  63.