home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / database / informix / 2793 < prev    next >
Encoding:
Internet Message Format  |  1992-12-23  |  2.5 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!rpi!gatech!darwin.sura.net!spool.mu.edu!olivea!gossip.pyramid.com!pyramid!infmx!aland
  2. From: aland@informix.com (Colonel Panic)
  3. Newsgroups: comp.databases.informix
  4. Subject: Re: ESQL C problem with sqlerrd[2]
  5. Message-ID: <1992Dec18.031113.11876@informix.com>
  6. Date: 18 Dec 92 03:11:13 GMT
  7. References: <1giuitINNcgq@emory.mathcs.emory.edu> <1992Dec14.230122.22841@unlv.edu> <brownlow.724615082@xanadu>
  8. Sender: news@informix.com (Usenet News)
  9. Organization: You tell me, then we'll both know.
  10. Lines: 43
  11.  
  12. In article <brownlow.724615082@xanadu> brownlow@informix.com (Keith Brownlow) writes:
  13. >>The sqlca.sqlerrd[2] value DOES NOT hold the number of rows found by opening
  14. >>a cursor for a select statement (dynamic or otherwise).  The sqlerrd[2] value
  15. >>is filled in only by the update and delete statements (maybe insert too), but
  16. >>not by a select.
  17. >
  18. >>The only way to get the number of rows from a select statment is to
  19. >>execute some type of "select count(*) into $cnt ..." statement with the same
  20. >>from and where clause as the original select statement.
  21. >
  22. >
  23. >A little clarification at this point;
  24. >
  25. > sqlca.sqlerrd[2] holds the values of the last SERIAL value inserted.
  26.  
  27. Nope.  The question was pertaining to ESQL/C, in which case sqlerrd[1] 
  28. (in C, the second occurrence in the sqlerrd integer array) is used to hold 
  29. the last SERIAL returned if the last SQL statement was a successful INSERT.  
  30. Otherwise, it holds the ISAM/RSAM or O/S error code underlying an Informix 
  31. error code (if any).  sqlerrd[2] is reserved for row counts, for those
  32. situations where a row count is provided.
  33.  
  34. >sqlca.sqlerrd[3] will hold the TRUE number of updates and deletes but only
  35. >the first of an insert or select.  This is because both insert and select 
  36. >statements need cursors if they are to manipulate more than one row at a time, 
  37. >while update or deletes will affect every row in the table unless some 
  38. >criteria is specified.
  39.  
  40. Nope.  sqlerrd[2] is what you are after... and the rest of what you said 
  41. implies that it will always be =1 for a SELECT, which I don't think is true.
  42. The INSERT statement itself doesn't work with an INSERT cursor -- to add
  43. to an open INSERT cursor, you use PUT, not INSERT.
  44.  
  45. >Hope this clears up any misunderstanding.
  46.  
  47. I think it caused more.   [-:
  48.  
  49.  
  50. --
  51. Alan Denney      aland@informix.com      {pyramid|uunet}!infmx!aland
  52.  
  53. "People burn more calories while sleeping than while bowling."  
  54.                                                - Rush Limbaugh, 12/17/92
  55.