home *** CD-ROM | disk | FTP | other *** search
- .Na "dbsetuserdata"
- .mc |
- .Aa
- .Fu
- Use a DBPROCESS structure to save a pointer to user-allocated data.
- .Ih "user data"
- .Ih "data, user"
- .Sy
- .Sf "void dbsetuserdata(dbproc, ptr)"
- .Sp "DBPROCESS" "*dbproc"
- .Sp "BYTE" "*ptr"
- .Co
- .Bl
- This routine saves, in a DBPROCESS structure, a pointer to user-allocated data.
- The application can access the data later with the \f2dbgetuserdata()\f1 routine.
- .Bl
- \f2dbsetuserdata()\f1 allows the application to associate user data
- with a particular DBPROCESS.
- This avoids the necessity of using global variables for this purpose.
- One use for this routine is to handle deadlock, as shown in the example below.
- This routine is particularly useful when the application has multiple DBPROCESSes.
- .Ih "DBPROCESSes, multiple"
- .Ih "deadlock"
- .Bl
- The application must allocate the data that \f2ptr\f1 points to.
- \*L never manipulates this data; it merely saves the pointer to it for later use by the application.
- .Bl
- Here's an example of using this routine to handle deadlock, a situation which occurs occasionally
- in high-volume applications.
- See the \f2System Administration Guide\f1 for more information on deadlock.
- This program fragment sends updates to the \*S.
- It reruns the transaction when its message handler detects deadlock.
- .SD
- .ta +4n +4n +4n +4n +4n +4n
- .so dbsetuserdata.ex
- .ED
- .Bz
- .Pa
- .Pi dbproc
- A pointer to the DBPROCESS structure that provides the connection
- for a particular front-end/\*S process. It contains all the
- information that \*L uses to manage communications and data between the
- front end and \*S.
- .Pi ptr
- A generic BYTE pointer to the user's private data space.
- .in -.375i
- .Re
- .br
- None.
- .Sa
- dbgetuserdata
- .mc
-