home *** CD-ROM | disk | FTP | other *** search
- .Na "dbdata"
- .Aa
- .Fu
- Return a pointer to the data in a regular result column.
- .Ih "regular column data, getting"
- .Sy
- .Sf "BYTE *dbdata(dbproc, column)"
- .Sp "DBPROCESS" "*dbproc"
- .Sp "int" "column"
- .Co
- .Bl
- This routine returns a pointer to the data in a regular (\f2i.e.,\f1 non-compute)
- result column.
- The data is not null-terminated. You can use
- .I "dbdatlen()"
- to get the length of the data.
- .Bl
- Here's a small program fragment that uses \f2dbdata()\fP:
- .ta +4n +4n +4n +4n +4n +4n
- .SD
- .so dbdata.ex
- .ED
- .Bl
- Do not add a null terminator to string data until you've copied it
- from the DBPROCESS with a routine such as \f2strncpy()\f1.
- For example:
- .ta +4n +4n +4n +4n +4n +4n
- .SD
- .ne 5
- char objname[40]
- ...
-
- strncpy(objname, (char *)dbdata(dbproc,2), (int)dbdatlen(dbproc,2))
- objname[dbdatlen(dbproc,2] = '\e0'
- .ED
- .Bl
- The function
- .I "dbbind()"
- will automatically bind result data to your program variables. It does a
- copy of the data, but is often easier to use than \f2dbdata()\f1.
- Furthermore, it includes a convenient type conversion capability.
- By means of this capability, the application can, among other things,
- easily add a null terminator to a result string or convert money and datetime
- data to printable strings.
- .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 column
- The number of the column of interest. The first column is number 1.
- .in -.375i
- .Re
- .br
- A BYTE pointer to the data for the
- particular column of interest.
- Be sure to cast this pointer into the proper type.
- A NULL BYTE pointer is returned if there is no such column
- or if the data has a null value.
- To make sure that the data is really a null value, you should always
- check for a return of 0 from
- .I "dbdatlen()."
- .Sa
- dbbind,
- dbcollen,
- dbcolname,
- dbcoltype,
- dbdatlen,
- dbnumcols
-