home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer) / NeXT_Developer-3.3.iso / NextLibrary / Documentation / Sybase / DBLIB / Section2 / dbsetuserdata.nr < prev    next >
Encoding:
Text File  |  1993-04-22  |  1.6 KB  |  53 lines

  1. .Na "dbsetuserdata" 
  2. .mc |
  3. .Aa
  4. .Fu
  5. Use a DBPROCESS structure to save a pointer to user-allocated data.
  6. .Ih "user data"
  7. .Ih "data, user"
  8. .Sy
  9. .Sf "void dbsetuserdata(dbproc, ptr)"
  10. .Sp "DBPROCESS" "*dbproc"
  11. .Sp "BYTE" "*ptr"
  12. .Co
  13. .Bl
  14. This routine saves, in a DBPROCESS structure, a pointer to user-allocated data.
  15. The application can access the data later with the \f2dbgetuserdata()\f1 routine.
  16. .Bl
  17. \f2dbsetuserdata()\f1 allows the application to associate user data
  18. with a particular DBPROCESS.
  19. This avoids the necessity of using global variables for this purpose.
  20. One use for this routine is to handle deadlock, as shown in the example below.
  21. This routine is particularly useful when the application has multiple DBPROCESSes.
  22. .Ih "DBPROCESSes, multiple"
  23. .Ih "deadlock"
  24. .Bl
  25. The application must allocate the data that \f2ptr\f1 points to.
  26. \*L never manipulates this data; it merely saves the pointer to it for later use by the application.
  27. .Bl
  28. Here's an example of using this routine to handle deadlock, a situation which occurs occasionally
  29. in high-volume applications.
  30. See the \f2System Administration Guide\f1 for more information on deadlock.
  31. This program fragment sends updates to the \*S.
  32. It reruns the transaction when its message handler detects deadlock.
  33. .SD
  34. .ta +4n +4n +4n +4n +4n +4n
  35. .so dbsetuserdata.ex
  36. .ED
  37. .Bz
  38. .Pa
  39. .Pi dbproc
  40. A pointer to the DBPROCESS structure that provides the connection
  41. for a particular front-end/\*S process.  It contains all the
  42. information that \*L uses to manage communications and data between the
  43. front end and \*S.
  44. .Pi ptr
  45. A generic BYTE pointer to the user's private data space.
  46. .in -.375i
  47. .Re
  48. .br
  49. None.
  50. .Sa
  51. dbgetuserdata
  52. .mc
  53.